crbeard Posted November 27, 2007 Share Posted November 27, 2007 I'm trying to make a small macro for a mundane action in a game. I'm not sure why this isn't working, any ideas? Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) HotKeySet("^!a", "MyMacro") HotKeySet("{ESC}", "MyExit") AutoItSetOption("SendKeyDelay", 20) WinWait("Program Manager","") If Not WinActive("Program Manager","") Then WinActivate("Program Manager","") WinWaitActive("Program Manager","") WinWait("game_window_title","") If Not WinActive("game_window_title","") Then WinActivate("game_window_title","") WinWaitActive("game_window_title","") WinSetState("game_window_title", "", @SW_MAXIMIZE) While 1 Sleep(30) WEnd Func MyMacro() ;stuff EndFunc Func MyExit() Exit EndFunc BTW, I'm pretty new to AutoIt so the problem could be very obvious and I'm just an idiot. Basically what I want to happen is, I start the game. I then minimize it and run this macro. The macro should maximize the game, then it should just sleep continuously until I hit CTRL+ALT+A, then it should do the stuff in MyMacro(). It maximizes the game, then it just seems like the hotkeys aren't going through at all. I don't think the game is stopping AutoIt from detecting the hotkeys because I've made it work in windowed mode before. Is there something I don't understand about how active windows work in fullscreen mode? Thanks, crbeard Link to comment Share on other sites More sharing options...
martin Posted November 27, 2007 Share Posted November 27, 2007 (edited) Is "game_window_title" really the title of the game window? Can you say what happens, if anything, and give a bit more detail about what doesn't work? BTW, welcome to the forums Edited November 27, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
crbeard Posted November 27, 2007 Author Share Posted November 27, 2007 Lol, na "game_window_title" isn't the name, but I'd rather not say the name as having macro's is against TOS in the game, but this macro wouldn't give me any edge, it would just take a mundane task out of the game for me. But what happens is: I minimize then start the macro. The macro then maximizes the game and then, theoretically, waits for me to hit CTRL+ALT+A to run the function MyMacro(). The problem is it doesn't do anything when I hit CTRL+ALT+A. I'm not sure if it's because it's not the active window or something to do with it being full screen (I've had the macro work in windowed mode), or if the game is blocking AutoIt from reading the keystrokes. Also, the code in MyMacro() isn't ";stuff", it's actual code, but it's just a bunch of mousemoves/clicks etc. Oh, and ty for the welcome Thanks, crbeard Link to comment Share on other sites More sharing options...
lordicast Posted November 27, 2007 Share Posted November 27, 2007 try, and set your game title under "$game_window_title" var CODEOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) HotKeySet("^!a", "MyMacro") HotKeySet("{ESC}", "MyExit") $game_window_title = ;enter your title between "" AutoItSetOption("SendKeyDelay", 20) WinWait("Program Manager","") If Not WinActive("Program Manager","") Then WinActivate("Program Manager","") WinWaitActive("Program Manager","") WinWait(""&$game_window_title&"","") If Not WinActive(""&$game_window_title&"","") Then WinActivate(""&$game_window_title&"","") WinWaitActive(""&$game_window_title&"","") WinSetState(""&$game_window_title&"", "", @SW_MAXIMIZE) While 1 Sleep(30) WEnd Func MyMacro() ;stuff EndFunc Func MyExit() Exit EndFunc [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
crbeard Posted November 27, 2007 Author Share Posted November 27, 2007 @lordicast: I like that idea, keeping the title in a variable, I tried it, but the macro still doesn't work. Any other ideas? Is there a way for me to test to see if the game is stopping the hotkeys from autoit? Thanks, crbeard Link to comment Share on other sites More sharing options...
lordicast Posted November 27, 2007 Share Posted November 27, 2007 Use the Autoit Window Info tool to see if your using the correct window title. [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
crbeard Posted November 27, 2007 Author Share Posted November 27, 2007 Ok, I found a way to do it without using HotKeys. Thanks a ton guys for the help, crbeard Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now