 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Boriskey
Joined: 26 Jul 2004 Posts: 2
|
Posted: Mon Jul 26, 2004 5:59 pm Post subject: Newbie Problems |
|
|
Okay sorry if these are simple questions, but this is going over my head.
I'm playing a game where i need to drag stuff from one box to another, fairly simple stuff, and i have a code to do this........
#m::
IfWinExist, ALPHA
SetTimer, Moving, 5000
return
#s:: SetTimer, Moving, off
return
Moving:
MouseGetPos, xpos, ypos
MouseClickDrag, LEFT, 750, 700, 750, 550, 5
Sleep, 500
MouseMove, %xpos%, %ypos%
return
This works fine, but i have 2 versions of the game running, and thus need to switch between the two after each movement, i.e move stuff from one box to the other, switch program, move stuff from one box to the other, and then repeat constantly. I can't work out how to do this, any ideas?
Please note both program's are called the same name, so its hard to differentiate, and i tend to play both program's in windows |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Mon Jul 26, 2004 6:24 pm Post subject: |
|
|
Use the WinGet command to find a window's unique ID. Then activate each window using that id:
; If you have two windows open:
WinGet, game_id1, ID, <Game Title> ; Topmost window
WinGet, game_id2, IDLast, <Game Title> ; Bottommost window.
WinActivate ahk_id %game_id1%
Sleep, 1000
WinActivate ahk_id %game_id2% |
|
| Back to top |
|
 |
Boriskey
Joined: 26 Jul 2004 Posts: 2
|
Posted: Mon Jul 26, 2004 7:33 pm Post subject: |
|
|
sorry i really don't get this at all, this is going way over my head, I've tried cutting and pasting this into my script, but it doesn't seem to do anything, does it go b4 or after my script, and also how do i use the WinGet command to find each window's unique ID.
Sorry |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Mon Jul 26, 2004 10:55 pm Post subject: |
|
|
It was just an example of how to use WinGet. It's up to you when to use the command. For example, you could use it at the top of the script (in the autoexecute section) to get the unique ID of both windows. Then you can refer to those IDs with the WinActivate command as shown in the example above.
Generally, a window must be active for mouse dragging to work. However, some programs might allow the use of ControlClick to drag (probably unlikely in this case).
More details at:
http://www.autohotkey.com/docs/commands/WinGet.htm
http://www.autohotkey.com/docs/commands/WinActivate.htm |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|