Orcc Posted March 18, 2008 Share Posted March 18, 2008 (edited) hey i have a script for a game. and i want it to run only for that game anyone have a clue what to look for under help?Also a pause key? Plus can a you explain what steps and what each code is for (pause) key?(ie; Send("{F1}") ;simluate f1 keypress)#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Booleen Script Function: Template AutoIt script.#ce ----------------------------------------------------------------------------HotKeySet("-", "Stop") ;script can be stopped by pressing -Sleep(4000) ;wait 4sec's before starting the cycle, to allow the user to navigate to the correct windowWhile 1 ;repeat endlessly Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 secondsWEnd ;repeatFunc Stop() ;to allow the script to stop Exit ;sameEndFunc ;same Edited March 18, 2008 by Orcc Link to comment Share on other sites More sharing options...
covaks Posted March 18, 2008 Share Posted March 18, 2008 (edited) maybe something like this? press F1 to pause script, press F1 again to continue. You'll need to edit the WinActive() to the window title of your game. HotKeySet("{F1}","Pause") $PauseFlag = False HotKeySet("-", "Stop") ;script can be stopped by pressing - Sleep(4000) ;wait 4sec's before starting the cycle, to allow the user to navigate to the correct window While 1 ;repeat endlessly If WinActive("Game window title goes here") Then Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds EndIf WEnd ;repeat Func Stop() ;to allow the script to stop Exit ;same EndFunc ;same Func Pause() If $PauseFlag = False Then $PauseFlag = True Else $PauseFlag = False EndIf While $PauseFlag Sleep(100) WEnd EndFunc Edited March 18, 2008 by covaks Link to comment Share on other sites More sharing options...
Orcc Posted March 18, 2008 Author Share Posted March 18, 2008 maybe something like this? press F1 to pause script, press F1 again to continue. You'll need to edit the WinActive() to the window title of your game. HotKeySet("{F1}","Pause") $PauseFlag = False HotKeySet("-", "Stop") ;script can be stopped by pressing - Sleep(4000) ;wait 4sec's before starting the cycle, to allow the user to navigate to the correct window While 1 ;repeat endlessly If WinActive("Game window title goes here") Then Send("{F1}") ;simluate f1 keypress Sleep(800) ;wait 1 seconds EndIf WEnd ;repeat Func Stop() ;to allow the script to stop Exit ;same EndFunc ;same Func Pause() If $PauseFlag = False Then $PauseFlag = True Else $PauseFlag = False EndIf While $PauseFlag Sleep(100) WEnd EndFunc How do I find the game title. Ty for help btw. Link to comment Share on other sites More sharing options...
covaks Posted March 18, 2008 Share Posted March 18, 2008 It's the title in the window. Eg: when you open notepad it says "Untitled - Notepad", that would be the title. Or Calc.exe is "Calculator". You can use the AutoIT Window Info Tool to get the window title if you aren't sure. or if you can't find a title, get the PID from ProcessExists() function, and get the handle using Thisor any of countless other ways to go about this. 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