| View previous topic :: View next topic |
| Author |
Message |
controlsman2
Joined: 13 Aug 2006 Posts: 49
|
Posted: Fri Sep 15, 2006 4:16 am Post subject: Sending commands to a full screen game |
|
|
I play Empire Earth, and I typically use the same set up all the time, I would like to make/use a macro to do the setup for me. The game is full screen mode only and so I cant use WindowSpy for find the controls. Is there a way for doing this, I just need to send a couple Enter's, mouse click's and page down's. Also, I sent a couple Enter's to the opening screen to choose single player mode and the Send doesn't work properly, I can hear the click but the single play button just gets high-lighted. Here's what I have so far.
| Code: | ;Empire Earth
SetTitleMatchMode, 2
SetTitleMatchMode, fast
SetKeyDelay, 0
SetMouseDelay, 0
DetectHiddenText, on
#InstallKeybdHook
IfWinExist,Empire Earth
WinActivate ; use the window found above
WinWaitActive, Empire Earth,
#e::
Sleep, 5000
Send, {Enter}
Sleep, 2000
;ControlSend, , {Enter}, Empire Earth,
Send, {Enter}
return |
Any help is greatly appreciated. |
|
| Back to top |
|
 |
bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Fri Sep 15, 2006 5:16 am Post subject: |
|
|
Here we go again! I've got this problem (sorry, challenge). Have a look at Peter's solution in the topic:
| Quote: | | Send chars to a minimized window containing a batch file? |
Maybe some clever-dick with a deeper knowledge could help? Hello, Chris? Help!  |
|
| Back to top |
|
 |
.AHK
Joined: 26 Apr 2006 Posts: 662 Location: USA
|
Posted: Fri Sep 15, 2006 5:34 am Post subject: |
|
|
| Maybe you should try SendInput and SendEvent if Input doesnt work? |
|
| Back to top |
|
 |
bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Fri Sep 15, 2006 6:01 am Post subject: |
|
|
Oh.
I'm just going to update AHK to whatever version it's up to. I can't find SendInput or SendEvent.
Back soon... |
|
| Back to top |
|
 |
bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Fri Sep 15, 2006 6:06 am Post subject: |
|
|
Ok, I'm updated, tried both SendInput and SendEvent. I'm using the PID business to make sure the right process is identified. Both Sends work if the window is visible (which I don't want), neither method works when the window is minimised. Here:
| Code: | run, C:\Progra~1\Tools\Comms\Call.bat %1%,C:\Progra~1\Tools\Comms,min, Bat_PID
MsgBox, PhoneCall in progress. `n%1% `nOk when done.
; WinActivate, Phone
SendInput, , {enter}, ahk_pid %Bat_PID%
|
[where's the smiley for tearing out my hair?]  |
|
| Back to top |
|
 |
.AHK
Joined: 26 Apr 2006 Posts: 662 Location: USA
|
Posted: Fri Sep 15, 2006 6:29 am Post subject: |
|
|
Blistering in your case you need to use ControlSend. Have you tried this?
I read your other thread and remember that Chris told me this.
|
|
| Back to top |
|
 |
controlsman2
Joined: 13 Aug 2006 Posts: 49
|
Posted: Fri Sep 15, 2006 6:57 am Post subject: |
|
|
| I tried SendInput and SendEvent and SendInput {raw}, and used them with Sendmode too, didnt work, same thing, just makes click noise and high-lights the single player button, ControlSend doesnt do anything at all, that I can see, either. |
|
| Back to top |
|
 |
bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Fri Sep 15, 2006 6:58 am Post subject: |
|
|
yep. tried ControlSend. Didn't work. I'll go have a look at that reference. Maybe it's something really dopey that I've missed, but I been over and over it and can't find anything.
...time passes...
Checked the reference. No good. In that case the window is visible. I have no trouble sending to a visible window, but once it's minimised... no go joe. (sorry about that, they're playing Frank Sinatra on the radio)  |
|
| Back to top |
|
 |
bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Fri Sep 15, 2006 7:23 am Post subject: |
|
|
Don't try this:
| Code: | PostMessage, 0x100,,,, ahk_pid %Bat_PID%
|
I hung my computer. Had to switch off the power!!
 |
|
| Back to top |
|
 |
.AHK
Joined: 26 Apr 2006 Posts: 662 Location: USA
|
Posted: Fri Sep 15, 2006 9:54 pm Post subject: |
|
|
| I dont know how to use "PostMessage or SendMessage" but you might want to ask Chris. I think it can be used to send chars to the window, but first you would have to learn how. |
|
| Back to top |
|
 |
|