d4rk Posted March 7, 2008 Share Posted March 7, 2008 2, i've written a program with loop inside, there's one hot key which stop the whole program when i press it, and i wonder how to restart the program by another hotkey ? please give me some advice, thx [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
cppman Posted March 7, 2008 Share Posted March 7, 2008 (edited) Here is a way to do it. Rather inefficient but it works.HotKeySet("{F10}", "RestartApp") HotKeySet("{ESC}", "ExitApp") MsgBox(0, "", "Welcome!") While(1) Sleep(10) WEnd Func RestartApp() Run(@ScriptFullPath) Exit EndFunc Func ExitApp() Exit EndFunc Edited March 7, 2008 by chris95219 Miva OS Project Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 7, 2008 Share Posted March 7, 2008 Chris, what you just wrote there is garbage and all you will do is pile up Main functions on the stack. Link to comment Share on other sites More sharing options...
martin Posted March 7, 2008 Share Posted March 7, 2008 (edited) 2, i've written a program with loop inside, there's one hot key which stop the whole program when i press it, and i wonder how to restart the program by another hotkey ? please give me some advice, thx You could have another compiled script which runs in the background. Keep the hotkey to end your program, but have another hotkey in the background program to run your program. Something like this maybe. (This assumes that you are running your script compiled.) HotKeySet("!+s","startup");start your program if needed HotKeySet("!+q","quit"); stop this 'background' program While 1 Sleep(50) WEnd Func startup() If Not ProcessExists("myApp.exe") Then Execute("MyApp.exe") EndFunc Func quit() Exit EndFunc Edited March 7, 2008 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...
d4rk Posted March 7, 2008 Author Share Posted March 7, 2008 (edited) You could have another compiled script which runs in the background. Keep the hotkey to end your program, but have another hotkey in the background program to run your program. Something like this maybe. (This assumes that you are running your script compiled.) HotKeySet("!+s","startup");start your program if needed HotKeySet("!+q","quit"); stop this 'background' program While 1 Sleep(50) WEnd Func startup() If Not ProcessExists("myApp.exe") Then Execute("MyApp.exe") EndFunc Func quit() Exit EndFuncThanks all, but i think martin has met my aim , thanks again guys Edited March 7, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys 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