alhadrad Posted March 27, 2007 Share Posted March 27, 2007 i need help i have worked with visual basic before but am hveing trouble debuging my script. i am trying to run a program that by default has a menu. there is a function to hide the menu by pressing the escape key. so in my script when the program loades immeadiately the escape key is pressed to hide the menu. i next want the program to kill using the escape key by defauld the program escape function is alt+f4. i want this script to run in the backround all the time but i can only get it to work on the initial load of the program. the second time the program loads it just quits it. if anyone could help that would be great. p.s. the program i am tryring to run is snes9x Global $hotkey="{esc}" main() func main() While 1=1 WinWaitClose("Snes9X v1.43 for Windows") WinWaitActive("Snes9X v1.43 for Windows") hidemenu() wend endfunc func hidemenu() send("{esc}") escmap() endfunc func escmap() HotKeySet($hotkey, "killemu") endfunc Func killemu() send("!{F4}") call("main") endfunc Link to comment Share on other sites More sharing options...
Valuater Posted March 27, 2007 Share Posted March 27, 2007 PLayed with it a little, hope you can understand expandcollapse popupGlobal $hotkey = "{esc}" Global $win_active = True ToolTip($win_active, 20, 20) $Title = "Snes9X v1.43 for Windows" ; for testing $Title = "Untitled"; for testing HotKeySet("{F9}", "Test_Run") While 1 If WinWaitActive($Title) And $win_active Then hidemenu() $win_active = False HotKeySet("{F9}") EndIf ToolTip($win_active, 20, 20) Sleep(10) WEnd Func hidemenu() Send($hotkey) HotKeySet($hotkey, "killemu") EndFunc ;==>hidemenu Func killemu() Send("!{F4}") Sleep(500) HotKeySet($hotkey) HotKeySet("{F9}", "Test_Run") $win_active = True EndFunc ;==>killemu Func Test_Run() Run("notepad.exe") EndFunc 8) Link to comment Share on other sites More sharing options...
alhadrad Posted March 27, 2007 Author Share Posted March 27, 2007 i may jsut be retarded but i cant seem to get it to work right download the emulater at Snes9x.zip when snes9x.exe is executed i want the esc key pressed to hide the menu and i also want the esc key to kill the program via alt+f4. execute my script and then start up snes it works flawlessley except i want it to proform the same action when the emulater is killed and restarted. i can seem to get it to do this. on the second execution of snes9x.exe it just kills the program. i jsut dont understand the lexon of autoit enough to make this happen properly. thanks for your help` drew koerner Link to comment Share on other sites More sharing options...
alhadrad Posted March 27, 2007 Author Share Posted March 27, 2007 update: thanks i figured it out works flawlessly i spent the better part of two days trying to figure this out i am going to be running this program in a arcade machine. once again thanks for the help it is very much apprieated 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