Page 1 of 1

Help to adjust a script to trigger an interface button

Posted: 27 Jun 2019, 20:13
by cadudesun
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 941 times

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

Posted: 27 Jun 2019, 23:13
by rommmcek
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!

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

Posted: 28 Jun 2019, 09:46
by cadudesun
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 👍

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

Posted: 28 Jun 2019, 14:47
by rommmcek
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.

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

Posted: 29 Jun 2019, 09:28
by cadudesun
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!