randy17 Posted August 18, 2009 Share Posted August 18, 2009 (edited) Hi all, hope there is a answer to my problem >_< I'm writing a bot for a game (in fact the bot is finished) The bot controls mouse and keyboard, works flawless. BUT: From time to time i want to interact with the game myself. Atm i stop the bot, do what i need and restart it afterwards. A much more elegant version would be, if i had something like the old basic "anykey". Something like hotkeyset ("anykey", _sleep2seconds()) ;go to sleep for 2 secs if any key is pressed Of course i have to make sure it doesn't get nested. np If there would be something like "anymouse" it would be like heaven Any ideas? Edited August 18, 2009 by randy17 Link to comment Share on other sites More sharing options...
WolfWorld Posted August 18, 2009 Share Posted August 18, 2009 Hi all,hope there is a answer to my problem >_<I'm writing a bot for a game (in fact the bot is finished)The bot controls mouse and keyboard, works flawless. BUT:From time to time i want to interact with the game myself.Atm i stop the bot, do what i need and restart it afterwards.A much more elegant version would be, if i had somethinglike the old basic "anykey". Something like hotkeyset ("anykey", _sleep2seconds()) ;go to sleep for 2 secs if any key is pressedOf course i have to make sure it doesn't get nested. npIf there would be something like "anymouse" it would be like heaven Any ideas?There is a Pause button on the system tray. Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
randy17 Posted August 18, 2009 Author Share Posted August 18, 2009 There is a Pause button on the system tray.Not elegant >_<Game window loses focus and i have to use the mouse (and aim exactly). Worse than it is nowAtm: esc (closes script) - do what i want - doubleclick on script (gives focus back to game automaticly)I could think of writing a gui for my script just to have a pause button but imho thats overkill (and not much better than close/open)Some kind of "on anykey" would simply be the most charming Link to comment Share on other sites More sharing options...
Yashied Posted August 18, 2009 Share Posted August 18, 2009 (edited) Try to play with this.#Include <WinAPIEx.au3> Global $Time, $pTime = _WinAPI_GetIdleTime() While 1 Sleep(10) $Time = _WinAPI_GetIdleTime() ConsoleWrite('Active' & @CR) EndIf $pTime = $Time WEndWinAPIEx.au3 Edited August 18, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
randy17 Posted August 18, 2009 Author Share Posted August 18, 2009 Try to play with this. #Include <WinAPIEx.au3> Global $Time, $pTime = _WinAPI_GetIdleTime() While 1 Sleep(10) $Time = _WinAPI_GetIdleTime() ConsoleWrite('Active' & @CR) EndIf $pTime = $Time WEnd WinAPIEx.au3 Thx, but i suppose this wont work as my bot moves mouse and pushes keys like wild ^^ Link to comment Share on other sites More sharing options...
randy17 Posted August 19, 2009 Author Share Posted August 19, 2009 Not sure if pushing is allowed. I'll just do it >_ Link to comment Share on other sites More sharing options...
junkew Posted August 19, 2009 Share Posted August 19, 2009 helpfile: _WinAPI_SetWindowsHookEx FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 19, 2009 Share Posted August 19, 2009 All you need to do is look at the example in the HotKeySet() function in the helpfile. It has a Pause ability. The only other thing to worry about is if you want the script to continue where it left off, or to restart at the beginning. Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
randy17 Posted August 20, 2009 Author Share Posted August 20, 2009 helpfile: _WinAPI_SetWindowsHookExwow, a lot of code for this simple objective but it will dodank u wel >_< 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