acer20006 Posted February 8, 2010 Share Posted February 8, 2010 i have question about hotkeyset and how to combine it with while at script that had already a while _ >> make it simply look at the code HotKeySet("{end}", "msg2") HotKeySet("{ESC}", "Terminate") ;;;; Body of program would go here ;;;; While 1 MsgBox (0,"msg box","1st while") WEnd ;;;;;;;; Func msg2() While 2 MsgBox (0,"msg box","2nd while") WEnd EndFunc Func Terminate() Exit EndFunc my script already have a while 1 but when i push end (hotkey) while 2 start working and while 1 stoped >>>>>> so how to make script run the both whiles Link to comment Share on other sites More sharing options...
Minikori Posted February 8, 2010 Share Posted February 8, 2010 You can't have two loops running at the same time, you could look into AdlibRegister() though. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 8, 2010 Share Posted February 8, 2010 AutoIt is not multithreaded, so you can't do it like that, it would be more like: HotKeySet("{end}", "msg2") HotKeySet("{ESC}", "Terminate") Local $iFlag = False While 1 MsgBox (0,"msg box","1st while") If $iFlag Then MsgBox (0,"msg box","2nd while") WEnd Func msg2() $iFlag = Not $iFlag EndFunc Func Terminate() Exit EndFunc .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
NerdFencer Posted February 8, 2010 Share Posted February 8, 2010 (edited) All you need to do is make your one loop a bit smarter, and have a condition for if the first has been pressed. Like this... HotKeySet("{end}", "msg2") HotKeySet("{ESC}", "Terminate") ;;;; Body of program would go here ;;;; Global $seccondPressed=False While 1 ConsoleWrite("First Loop"&@CRLF) If $seccondPressed Then ConsoleWrite("Seccond Loop"&@CRLF) EndIf Sleep(15) WEnd ;;;;;;;; Func msg2() $seccondPressed = Not($seccondPressed) EndFunc Func Terminate() Exit EndFunc Edit: Oops, AdmiralAlkex beat me to it Edited February 8, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
acer20006 Posted February 8, 2010 Author Share Posted February 8, 2010 thx all _ i will find another way 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