HI
New to the forums
I wonder if any of you great people out there can help me with a problem.
I am trying to get a hotkey that will simulate a mouse click .
I can do this on the normal desktop, but when I open the program i will be using, it won't click the area of the window that is in focus??
I have tried ''IfWinActive', but I am not sure what info I need to identify the program in focus, and also where this line goes in the script?
Any help would be appreciated
pootler
mouse/touch click??
Re: mouse/touch click??
Try:
Replace notepad.exe with the executable name of the program that you're using and the numbers with the coordinates that you want to click at.
Code: Select all
#If WinActive("ahk_exe notepad.exe")
Q::Click, 100, 100
Re: mouse/touch click??
Thanks very much for the reply.
That doesnt seem to work
To try and eliminate things, I set up a very simple hotkey script to simulate a mouse click,
I then opened several programs, manually placed the mouse over various controls , and ran the hotkey.
Most of the programs ( and apps) reacted correctly, as if I had clicked the mouse in the program.
However, when I open the specific program I use ( it is called 'Centrafuse', and is a carpc program), and do the same thing, the program does not react?
Do I somehow need to identify the program, or title a bit more clearly??
Thanks
pootler
That doesnt seem to work
To try and eliminate things, I set up a very simple hotkey script to simulate a mouse click,
I then opened several programs, manually placed the mouse over various controls , and ran the hotkey.
Most of the programs ( and apps) reacted correctly, as if I had clicked the mouse in the program.
However, when I open the specific program I use ( it is called 'Centrafuse', and is a carpc program), and do the same thing, the program does not react?
Do I somehow need to identify the program, or title a bit more clearly??
Thanks
pootler
Re: mouse/touch click??
Is this program run with administrator privileges? Your script would also need to be run with admin permissions. (Right click the script, select "Run as Administrator".)
Re: mouse/touch click??
No The prog does not have privileges, BUT i ran the script with it, and success!
NOw for some reason with multiple presses of the script the mouse seems to move sometimes?
I guess I need to find someway of locking it to the control window?
I don't quite understand how to assign a window title and such,
I guess just experiment?
Many Thanks
Keith
NOw for some reason with multiple presses of the script the mouse seems to move sometimes?
I guess I need to find someway of locking it to the control window?
I don't quite understand how to assign a window title and such,
I guess just experiment?
Many Thanks
Keith
Re: mouse/touch click??
You might be interested in Window Spy which can be accessed by right-clicking the tray icon (by the system clock) of a running script.
The only way that I imagine the mouse moving, if you're doing only Click commands in AHK, is if the window itself is moving as a result of being clicked. Would be odd behavior and I can't say I've witnessed such a thing before except for clicking on the Minimize/Maximize buttons on a program. You might be able to circumvent that issue by using CoordMode, Mouse, Absolute.
The only way that I imagine the mouse moving, if you're doing only Click commands in AHK, is if the window itself is moving as a result of being clicked. Would be odd behavior and I can't say I've witnessed such a thing before except for clicking on the Minimize/Maximize buttons on a program. You might be able to circumvent that issue by using CoordMode, Mouse, Absolute.
Re: mouse/touch click??
HI,
Thanks very much for your help so far.
I have posted another thread with this next problem as it seemed a bit off topic from the original subject,
Let me explain though.
I am using an mce remote to control this software.
From the pictures you can see , when I use this software at its opening screen, then my script ( Media_Next:: Click, 745,50 ) clicks the correct part of the screen
i.e the 'next track/previous track' buttons.
Everything works fine- until I then call up one of the programs, e.g DigiRx ( a DAB radio program )
When thatprogram embeds into the centre part of the screen, as you can see, the mouse moves down onto ( what I am guessing) is the 'active' window.
Same when i click the 'Music' program. ( haven't got nav sorted yet )
NO amount of further script running will get the mouse back, UNLESS I select the opening screen again.
I think that things go wrong when the focus falls to the windows that are embedded?
How can I make sure the mouse clicks at the same point ( focused or not) every time?
Many Thanks
pootler
Thanks very much for your help so far.
I have posted another thread with this next problem as it seemed a bit off topic from the original subject,
Let me explain though.
I am using an mce remote to control this software.
From the pictures you can see , when I use this software at its opening screen, then my script ( Media_Next:: Click, 745,50 ) clicks the correct part of the screen
i.e the 'next track/previous track' buttons.
Everything works fine- until I then call up one of the programs, e.g DigiRx ( a DAB radio program )
When thatprogram embeds into the centre part of the screen, as you can see, the mouse moves down onto ( what I am guessing) is the 'active' window.
Same when i click the 'Music' program. ( haven't got nav sorted yet )
NO amount of further script running will get the mouse back, UNLESS I select the opening screen again.
I think that things go wrong when the focus falls to the windows that are embedded?
How can I make sure the mouse clicks at the same point ( focused or not) every time?
Many Thanks
pootler
- Attachments
-
- opening music program
- centrafuse 3.PNG (63.29 KiB) Viewed 2413 times
-
- opening DAB program
- centrafuse2.PNG (67.09 KiB) Viewed 2413 times
-
- opening screen
- centrafuse1.PNG (54.94 KiB) Viewed 2413 times
Re: mouse/touch click??
I'm not sure, hopefully someone familiar with the app can help you. It looks like a simple GUI designed/skinned to look fancy, so you might look at using Window Spy to identify a Control Value for the Next/Previous controls to use in the command ControlClick. (This would not move the normal mouse cursor, but trick the program into thinking you clicked on the button.)
Otherwise, run some testing with both Window Spy reporting the Window Position in each of those scenarios (opening screen / DAB / music programs) and also trying to use the WinGetPos command on the original window ("mce remote"? or "centrafuse"?)
Otherwise, run some testing with both Window Spy reporting the Window Position in each of those scenarios (opening screen / DAB / music programs) and also trying to use the WinGetPos command on the original window ("mce remote"? or "centrafuse"?)
Re: mouse/touch click??
O.K,
I have found a possible kludge method of working >-)
If I click OUTSIDE of the program window, and then rerun the script, the mouse clicks back in the correct position.
How do I send two consecutive mouse clicks to two different destinations with one key stroke?
Can that be done with AHK?
Many THanks
Pootler
I have found a possible kludge method of working >-)
If I click OUTSIDE of the program window, and then rerun the script, the mouse clicks back in the correct position.
How do I send two consecutive mouse clicks to two different destinations with one key stroke?
Can that be done with AHK?
Many THanks
Pootler
Re: mouse/touch click??
You'd need to make your hotkey multiline, such as:
You may need to put a Sleep between the clicks.
As a bonus, you may be interested in using WinSet to set the window to be AlwaysOnTop, then you can click on another window without worrying about your program being hidden. You may also find it better to use WinActivate to activate a different program instead of clicking outside of your remote control/media player program, so that you don't actually cause an action in the other program, like navigating to a different website or clicking the "Self Destruct Computer" button.
Code: Select all
q::
Click, 100, 100
Click, 200, 100
return
As a bonus, you may be interested in using WinSet to set the window to be AlwaysOnTop, then you can click on another window without worrying about your program being hidden. You may also find it better to use WinActivate to activate a different program instead of clicking outside of your remote control/media player program, so that you don't actually cause an action in the other program, like navigating to a different website or clicking the "Self Destruct Computer" button.
Re: mouse/touch click??
Many Thanks for all your help.
Only fine tuning required now.
Have a great day
Pootler
Only fine tuning required now.
Have a great day
Pootler
Re: mouse/touch click??
HI,
Just thought I'd let you know, with the help of this forum I found a more elegant solution.
i.e. CoordMode, Mouse, Screen
Click, 1200, 70
- ignores any active windows, and clicks in the same position every time!
Cheers
Pootler
Just thought I'd let you know, with the help of this forum I found a more elegant solution.
i.e. CoordMode, Mouse, Screen
Click, 1200, 70
- ignores any active windows, and clicks in the same position every time!
Cheers
Pootler
Who is online
Users browsing this forum: RussF and 378 guests