ControlSend command to send the problem

Get help with using AutoHotkey and its commands and hotkeys
yessorryno
Posts: 22
Joined: 12 Sep 2017, 03:13

ControlSend command to send the problem

18 Sep 2017, 03:17

Hi All,

In the implementation of the background to send instructions to the file and IE browser are normal, but sent to the GOOGLE browser failed, someone can give me help?

The code is as follows:

Code: Select all

F1::
ControlSend, Edit1,abc,test.txt 
ControlSend,Internet Explorer_Server1,{F5 down},20170830 - Internet Explorer
sleep 500
ControlSend,Internet Explorer_Server1,{F5 up},20170830 - Internet Explorer
sleep 500
ControlSend,Chrome_RenderWidgetHostHWND1,{F5 down},Google  - Google Chrome  ;fail The send command was not successful
sleep 500
ControlSend,Chrome_RenderWidgetHostHWND1,{F5 up},Google  - Google Chrome  ;fail The send command was not successful
return
User avatar
jeeswg
Posts: 5956
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ControlSend command to send the problem

18 Sep 2017, 03:53

This worked for me:

Code: Select all

q:: ;google chrome - refresh active tab
ControlSend, Chrome_RenderWidgetHostHWND1, {F5}, Google - Google Chrome
return
It may be that you had an extra space after the word 'Google'.

As a more general solution, this also worked:

Code: Select all

q:: ;google chrome - refresh active tab
DetectHiddenWindows, Off
ControlSend, Chrome_RenderWidgetHostHWND1, {F5}, ahk_class Chrome_WidgetWin_1
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
yessorryno
Posts: 22
Joined: 12 Sep 2017, 03:13

Re: ControlSend command to send the problem

18 Sep 2017, 20:37

jeeswg wrote:This worked for me:

Code: Select all

q:: ;google chrome - refresh active tab
ControlSend, Chrome_RenderWidgetHostHWND1, {F5}, Google - Google Chrome
return
It may be that you had an extra space after the word 'Google'.

As a more general solution, this also worked:

Code: Select all

q:: ;google chrome - refresh active tab
DetectHiddenWindows, Off
ControlSend, Chrome_RenderWidgetHostHWND1, {F5}, ahk_class Chrome_WidgetWin_1
return
Hi,

Thank you for your help, but unfortunately the method is ineffective to me.
User avatar
jeeswg
Posts: 5956
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ControlSend command to send the problem

19 Sep 2017, 04:09

I managed to use Acc to invoke refresh, however, this also activates the window.

ControlSend to refresh the window works, but only if the window is already active.

Code: Select all

;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

q:: ;google chrome - refresh active tab
DetectHiddenWindows, On
WinGet, vWinList, List, ahk_class Chrome_WidgetWin_1
vOutput := ""
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	;the ControlSend approach only works if the window is active
	;ControlSend, ahk_parent, {F5}, % "ahk_id " hWnd
	;ControlSend, ahk_parent, {Ctrl down}r{Ctrl up}, % "ahk_id " hWnd

	;when you invoke it via Acc, it activates the window
	oAcc := Acc_Get("Object", "4.1.2.2.3.3", 0, "ahk_id " hWnd)
	oAcc.accDoDefaultAction(0)
	oAcc := ""
}
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: asad41163, Bing [Bot], evilC, swagfag and 39 guests