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 

Sending commands to a full screen game

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



Joined: 13 Aug 2006
Posts: 49

PostPosted: Fri Sep 15, 2006 4:16 am    Post subject: Sending commands to a full screen game Reply with quote

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
View user's profile Send private message
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Fri Sep 15, 2006 5:16 am    Post subject: Reply with quote

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! Confused
Back to top
View user's profile Send private message Send e-mail Visit poster's website
.AHK



Joined: 26 Apr 2006
Posts: 662
Location: USA

PostPosted: Fri Sep 15, 2006 5:34 am    Post subject: Reply with quote

Maybe you should try SendInput and SendEvent if Input doesnt work?
Back to top
View user's profile Send private message Visit poster's website AIM Address
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Fri Sep 15, 2006 6:01 am    Post subject: Reply with quote

Oh.Shocked

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
View user's profile Send private message Send e-mail Visit poster's website
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Fri Sep 15, 2006 6:06 am    Post subject: Reply with quote

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?] Confused
Back to top
View user's profile Send private message Send e-mail Visit poster's website
.AHK



Joined: 26 Apr 2006
Posts: 662
Location: USA

PostPosted: Fri Sep 15, 2006 6:29 am    Post subject: Reply with quote

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.

Quote:

If that doesn't work, there are some other topics that show other sending methods, such as via PostMessage: http://www.autohotkey.com/forum/viewtopic.php?p=49772#49772
Back to top
View user's profile Send private message Visit poster's website AIM Address
controlsman2



Joined: 13 Aug 2006
Posts: 49

PostPosted: Fri Sep 15, 2006 6:57 am    Post subject: Reply with quote

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
View user's profile Send private message
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Fri Sep 15, 2006 6:58 am    Post subject: Reply with quote

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) Laughing
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Fri Sep 15, 2006 7:23 am    Post subject: Reply with quote

Don't try this:
Code:
PostMessage, 0x100,,,, ahk_pid %Bat_PID%


I hung my computer. Had to switch off the power!!
Shocked
Back to top
View user's profile Send private message Send e-mail Visit poster's website
.AHK



Joined: 26 Apr 2006
Posts: 662
Location: USA

PostPosted: Fri Sep 15, 2006 9:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
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