Click class nn

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Click class nn

Post by gazmoz17 » 06 Oct 2022, 08:38

Hi, been playing around for an hour!

Code: Select all

^m::
ControlClick,#SG32DTBUTTON148, Price lists, Sage 50cloud Accounts Professional - GRP(UK)LTD,,,, NA
Return

Trying to click the "Price List" button?
Class NN.PNG
Class NN.PNG (45.55 KiB) Viewed 1299 times
Ther class nn button name changes I've noticed so need to go from button text ideally.

Many Thanks

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: Click class nn

Post by mikeyww » 06 Oct 2022, 09:41

I would review syntax: :arrow: ControlClick. There is no guarantee that it will work, but the second parameter is the WinTitle.

gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Click class nn

Post by gazmoz17 » 06 Oct 2022, 14:17

Hi, yeah Ive reviewed the literature. Unfortunately I cant get it to work a simple click a button. Ive tried multiple combinations from the ControlClick guide. Im sure Ive attempted this in prior years 🤦🏼‍♂️ Not sure if its my understanding or because ControlClick is just finnickey/buggy anyway. So hoping to rule out thats my poor understanding and then if still doesnt work just move on that it cant be done for whatever reason. Was going to try image search or automate my task next.

RussF
Posts: 1237
Joined: 05 Aug 2021, 06:36

Re: Click class nn

Post by RussF » 06 Oct 2022, 14:26

I've written a number of scripts where I wait for the respective window to appear, based on whatever criteria I need to identify it, then click on specific coordinates with CoordMode for mouse set to Window.

This only works if the button appears in the same place on the window every time.

Russ

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: Click class nn

Post by mikeyww » 06 Oct 2022, 14:43

Like I wrote, the second parameter is the WinTitle. This does not seem to match what you are showing.

gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Click class nn

Post by gazmoz17 » 06 Oct 2022, 15:27

Hi Mikey, apologies yeah I understood your point per what code Ive quoted. But I’m pretty sure I had written that today at work with “Sage 50 Cloud…..”as second parameter. But I’ll revisit when Im back in work tomorrow so I’m not guessing what code I have and haven’t tried so far 👍.

Thank you

gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Click class nn

Post by gazmoz17 » 10 Oct 2022, 04:47

Hi,

I've tried this no joy?

Code: Select all

^m::
ControlClick, Price Lists,Sage 50cloud Accounts Professional - GRP(UK)LTD
Return
Automate my task finds button for actual click.PNG
Automate my task finds button for actual click.PNG (7.74 KiB) Viewed 1174 times
Ive used Automate my task and it doesnt work for a control click but does for an actual click. Is there a way to just send a click to a button name rather than co-ordinates? Im guessing if it doesnt work for Auto,ate my task then it just wont work for ControlClick method?

Many Thanks

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: Click class nn

Post by mikeyww » 10 Oct 2022, 05:20

There is no guarantee of success, but could try:

Code: Select all

^m::
SetControlDelay -1
ControlClick, Price lists, Sage,,,, NA
Return
Demonstration:

Code: Select all

Gui, Font, s10
Gui, Add, Text  , w230, Press CTRL-M.
Gui, Add, Button, wp  , Price lists
Gui, Show,, Sage this that

^m Up::
SetControlDelay -1
ControlClick, Price lists, Sage,,,, NA
Return

ButtonPriceLists:
MsgBox, Test
Return

gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Click class nn

Post by gazmoz17 » 10 Oct 2022, 06:15

Hi Mikey,

Really appreciate your time here 👍.
Result.PNG
Result.PNG (8.23 KiB) Viewed 1143 times
So nothing fires when I click control m. Only when I click the button do I get the "Test" msg box.

thanks

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: Click class nn

Post by mikeyww » 10 Oct 2022, 06:19

Interesting.

1. You are running the exact script posted, with no additional code?
2. You have closed all other scripts? Look for AutoHotkey.exe in Windows Task Manager.
3. You have no other software with the same hotkey already assigned?
4. What AHK version are you running?

How about a different hotkey?

Code: Select all

Gui, Font, s10
Gui, Add, Text  , w230, Press F3.
Gui, Add, Button, wp  , Price lists
Gui, Show,, Sage this that

F3 Up::
SetControlDelay -1
ControlClick, Price lists, Sage,,,, NA
Return

ButtonPriceLists:
MsgBox, Test
Return

gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Click class nn

Post by gazmoz17 » 10 Oct 2022, 07:20

Hi,

Sorry I had put the full window title in where you had "Sage".

I also tagged it to bottom of an existing script.

Both ^m & F3 scripts will now bring up the message box when clicked.

...Does this mean its found the button?

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: Click class nn

Post by mikeyww » 10 Oct 2022, 07:33

Yes. You can test it with your target program. If it fails, try running the script as admin or with UI access.

Post Reply

Return to “Ask for Help (v1)”