Help to adjust a script to trigger an interface button Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cadudesun
Posts: 129
Joined: 04 Jun 2016, 10:26

Help to adjust a script to trigger an interface button

27 Jun 2019, 20:13

Hi,

I'd appreciate help.

Based on the snapshot info, I created the following script, which isn't working properly:

Code: Select all

!x::ControlClick, cc_BitmapButton17, ahk_exe DesignerPro.exe
Could you please provide directions on how to adjust the script to trigger the interface button cc_BitmapButton17?

Thank you very much!
AHK Button-.png
AHK Button-.png (96.83 KiB) Viewed 943 times
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Help to adjust a script to trigger an interface button

27 Jun 2019, 23:13

Some apps doesn't respond to ControlClick consistently. You can try:

Code: Select all

ControlSend, cc_BitmapButton17, {Enter}, ahk_exe DesignerPro.exe

;or less agressive
ControlSend, cc_BitmapButton17, {Space}, ahk_exe DesignerPro.exe

;or 
ControlFocus, cc_BitmapButton17, ahk_exe DesignerPro.exe
Send, {Enter}

;or less agressive again
ControlFocus, cc_BitmapButton17, ahk_exe DesignerPro.exe
Send, {Space}

;or general MouseClick (be sure to use proper CoordMode!, in doubt maximize application)
ControlGetPos,x,y,,, cc_BitmapButton17, ahk_exe DesignerPro.exe
MouseClick,, x+1, y+1
or someghing else. Be creative!
cadudesun
Posts: 129
Joined: 04 Jun 2016, 10:26

Re: Help to adjust a script to trigger an interface button

28 Jun 2019, 09:46

Hi @rommmcek ,

Thank you very much for the scripts and the teachings, since it is the first time I’m trying to deal with buttons through AHK.

I tried the four possibilities you posted:

ControlSend doesn’t have an effect.

ControlFocus is removing the button from the toolbar, instead of triggering the command under the button.

I recorded my screen detailing the tests I performed: http://bit.ly/2IWHypT

Could you please take a look, and if possible provide further feedback about what could be wrong?

Thanks 👍
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Help to adjust a script to trigger an interface button  Topic is solved

28 Jun 2019, 14:47

I installed Xara trial. ControlClick is working fine. However not with !x hotkey.
You have to choose another hotkey e.g.:

Code: Select all

#IfWinActive, ahk_exe DesignerPro.exe
f::ControlClick, cc_BitmapButton6, ahk_exe DesignerPro.exe ; f - forward (next photo)
d::ControlClick, cc_BitmapButton7, ahk_exe DesignerPro.exe ; d - dernier (previous photo)
Note: My trial version has different control numbers as your Xara! Use correct ones!

bye!

Edit: The trouble is, in my opinion, non standard menu. I suppose it's using some fancy hook for the Alt modifier key, which take precedence over hotkey (on the OS level - so not an Ahk issue), that results for the !x into !LButton which doesn't work (try it manually).
You can use any other modifier (e.g. ^f, +f or #f) though.
Last edited by rommmcek on 29 Jun 2019, 15:45, edited 1 time in total.
cadudesun
Posts: 129
Joined: 04 Jun 2016, 10:26

Re: Help to adjust a script to trigger an interface button

29 Jun 2019, 09:28

Hi @rommmcek ,

It was very kind of you to have installed Xara trial to provide me support 👍

Your last script worked perfectly. And I learned a lot from this thread about triggering buttons through AHK using different techniques.

Thank you very much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat and 194 guests