AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need some help with a few somewhat advanced scripts...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Erko
Guest





PostPosted: Mon Aug 08, 2005 5:38 pm    Post subject: Need some help with a few somewhat advanced scripts... Reply with quote

I'm sure some people will just laugh at this and I'm sure this is very easily done once you know a bit more than I do about this program. I have only read about and tested a few things with this program for a bit more than a day now, but I feel I could probably get a bit better feedback in this forum than in the AutoHotkey Help (wich by the way is really good as well). Are there any scripting-gods out there who could help me?


Now, what I would like to do:

First of all I would like to have a script, that every time I press a certain button, three things happens in the following order:
1. The mouse-cursor moves to a certain X, Y of the screen, and right-clicks. (I've been able to make it that far.)
2. The mouse-cursor moves to a different certain X, Y of the screen, and left-clicks. (I've only been able of making this in a script that only performs this function and then shuts down, don't seem to manage to make it happen over and over again.)
3. The mouse-cursor then returns to the area it was at the moment I pressed the hotkey in the first place. (I have no idea of how to do this.)

And I would like this to happen practically instantly. Can the steps two and/or three even be done? Confused



Secondly, and this one is kind of similar to the first script, I would like a script to perform the following; again every time a certain button is pressed:

1. The mouse-cursor moves to a certain X, Y of the screen and right-clicks. (Again, been able to do this)
2. The mouse-cursor returns to the location it was at right before I pressed the hotkey, and left-clicks. (And again, I have no idea at all of how to do this)



Third, every time I press a certain button:

1. Ctrl is pressed down.
2. The mouse "mouseclickdrag" (holds down the mouse-button and "drags") from the location the mouse is currently at, to a set X, Y coordinates, and then releases the mouse-button.
3. Ctrl is released up.
4. The mouse returns to the original position (where it was when I pressed the hotkey).



If anyone could help me with this (or point out the fact that it cannot be done), it would be of extreme help and I would appreciate it greatly. Meanwhile I'll continue to try myself. Smile
Back to top
Litmus Red



Joined: 25 Jul 2005
Posts: 139
Location: Richmond, Virginia

PostPosted: Tue Aug 09, 2005 2:06 am    Post subject: Reply with quote

What you want to do is possible. Create the following script and double click on the file. Then press F3 to run it. This script right-clicks on the position X = 300 Y = 200 and returns to it's original position. The X and Y coordinates are relative to the upper-left corner of the open window.

Code:
F3::
MouseGetPos, XPos, YPos
MouseClick, Right,  300,  200, , 3
MouseMove, %XPos%, %YPos%, 3
Sleep, 1000
Send, {Esc}
Return

This script does the same thing, but much faster.

Code:
F3::
MouseGetPos, XPos, YPos
MouseClick, Right,  300,  200, , 0
MouseMove, %XPos%, %YPos%, 0
Sleep, 1000
Send, {Esc}
Return

Also, if you didn't know, the Window Spy tool can be used to get X/Y coordinates.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group