Bookman Posted December 6, 2005 Posted December 6, 2005 I'm running the following script to create hotkeys that control functions of a database. I have 2 problems. The first is that I can't get the script to exit when the DB closes. It remains running, and if I restart the DB, another copy of same script starts, leaving two copies running, more if I restart again. The second is that the script apparently becomes unstable after about 20 minutes of sitting idle. After the idle period, the computer acts as if the shift key is being held down. The CapsLock has no effect and the warm restart of windows doesn't work. The only solution is to shut down windows entirely, and re-start the computer after a minute or so. This solves the problem until another idle period. P4 1Gb, memory plenty of available resources, Win XP pro SP2. Runing the AutoIT 3 Beta version, script compiled under this version also. Global Const $DB='Elsevier PSG*' ;Wait for the DB software to close WinWaitClose($DB) ;Define the hot key set HotkeySet("{F5}", 'Search') HotkeySet("{F9}", 'Card') WinWait ($DB) Func Search() Local $Input = InputBox('Scanning the EAN', 'Book:') If @Error Then Return WinActivate($DB) Send("^s") Sleep(300) Send($Input, 1) Send("{ENTER}", 0) EndFunc Func Card() WinActivate($DB) Send("^h") EndFunc
Valuater Posted December 6, 2005 Posted December 6, 2005 (edited) maybe this $DB='Elsevier PSG*' ;Define the hot key set HotkeySet("{F5}", 'Search') HotkeySet("{F9}", 'Card') While WinActive($DB) ; if this title ($DB) is not active.. the program will exit sleep(20) WEnd Func Search() Local $Input = InputBox('Scanning the EAN', 'Book:') If @Error Then Return WinActivate($DB) Send("^s") Sleep(300) Send($Input, 1) Send("{ENTER}", 0) EndFunc Func Card() WinActivate($DB) Send("^h") EndFunc you could change it to While WinExists($DB) ; that way it does not have to be the "active" window but must exist or the program will close 8) Edited December 6, 2005 by Valuater
Bookman Posted December 8, 2005 Author Posted December 8, 2005 you could change it to While WinExists($DB) ; that way it does not have to be the "active" window but must exist or the program will close 8)
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