Runman Posted March 30, 2011 Share Posted March 30, 2011 Good day all, You can say i am a bit noobish in AutoIt3 but i am learning it ! I came across a problem and it seems like google isnt my best friend anymore. Here's the problem while 1 $nMsg = GUIGetMsg() If $nMsg = $okbutton then Do while 2 Sleep(3000) Send("{F5}") WEnd Until ("{Del}") then Do Exitloop endif Wend i just cant stop this loop... Del aint doing the trick even if i erase the then Do Exitloop Part. I hope you guys can sort this out for me. I would be gratefull (L) regards, Dennis Link to comment Share on other sites More sharing options...
AppTux Posted March 30, 2011 Share Posted March 30, 2011 When I look quickly over your code, it even won't run!! On the 10th line you have a begin of a Do loop, but after that I never see any Until. You better set it in autoit brackets, that's easier to read. PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore. Link to comment Share on other sites More sharing options...
spudw2k Posted March 30, 2011 Share Posted March 30, 2011 There's a few problems here. First, the Until doesn't know what to do with "{Del}". You should use something like Until _IsPressed, or use a Hotkey. Second, the Then after the Until is incorrect and the Do afterwards is malformed. And Most Important, you have a while statement withina Do Loop, which means the While must end before the Do continues the loop. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
spudw2k Posted March 30, 2011 Share Posted March 30, 2011 Here's how I would do it Global $exit = 0 HotKeySet("{del}","_ExitDo") while 1 $nMsg = GUIGetMsg() If $nMsg = $okbutton then Do Sleep(3000) Send("{F5}") Until $exit endif Wend Func _ExitDo() $exit = 1 EndFunc Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Runman Posted March 30, 2011 Author Share Posted March 30, 2011 wow...how can i fuck up a code that small so fast ^^ I will recorrect these things, i will do my best thanx for the fast reply's ! will post my results Link to comment Share on other sites More sharing options...
BrewManNH Posted March 30, 2011 Share Posted March 30, 2011 (edited) Try this: HotKeySet("{DEL}", "_DEL") Global $del = False, $Timer = TimerInit() While 1 $nMsg = GUIGetMsg() If $nMsg = $okbutton Then Do If TimerDiff($Timer) >= 3000 Then Send("{F5}") $Timer = TimerInit() EndIf Until $del ExitLoop EndIf WEnd Func _DEL() $del = True EndFunc ;==>_DEL Or you could use _IsPressed as stated before, instead of the HotKeySet and the _DEL function. Edited March 30, 2011 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
spudw2k Posted March 30, 2011 Share Posted March 30, 2011 Here's how I would do it Global $exit = 0 HotKeySet("{del}","_ExitDo") while 1 $nMsg = GUIGetMsg() If $nMsg = $okbutton then Do Sleep(3000) Send("{F5}") Until $exit endif Wend Func _ExitDo() $exit = 1 EndFunc You could use the _IsPressed if you want, but the timing is more critical. A hotkey will interrupt, execute, then continue. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Runman Posted March 30, 2011 Author Share Posted March 30, 2011 jezus guys you guys are fast ! i cant even keep up with the reply's !!! Link to comment Share on other sites More sharing options...
Runman Posted March 30, 2011 Author Share Posted March 30, 2011 Thank you brothers Spudw2k i used your code if you dont mind ^^ 1 question regarding the code itself ! What does Global $exit = 0/1 mean? * learning * ^^ Link to comment Share on other sites More sharing options...
Runman Posted March 30, 2011 Author Share Posted March 30, 2011 aw i see its binary? 0 - off 1 - on Link to comment Share on other sites More sharing options...
spudw2k Posted March 30, 2011 Share Posted March 30, 2011 (edited) Global defines a variable that is accessible "globally" (meaning inside and outside functions), Variables can be defined Local which means they can only be used with a limited scope.aw i see its binary?0 - off1 - onbasically. It could also be boolean (True, False); or even Null, Not Null.In this case 0 means null or nothing. The Until command is mearly checking to see if the variable is 0 or not(nothing). You can test this by assigning $exit to anything besides 0 (ie. "Done", True, 12345). Edited March 30, 2011 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Runman Posted March 30, 2011 Author Share Posted March 30, 2011 thats amazing ! ^^ Spudw2k how can I ever repay you?! If you have any questions with webdesign HTML/CSS you come to me ^^ Thank you all ! Link to comment Share on other sites More sharing options...
spudw2k Posted March 30, 2011 Share Posted March 30, 2011 (edited) Also, just for learning...if you examine BrewMan's code, he is using a timer instead of a sleep command. The advantage a timer has is that it is reliably more precise. I would assume since you are merely refreshing the screen (f5) the precision isn't so important, but timer funcs can be very useful. Edited March 30, 2011 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Runman Posted April 6, 2011 Author Share Posted April 6, 2011 so it does the same only preciser ? ^^ i see i see Link to comment Share on other sites More sharing options...
Runman Posted April 6, 2011 Author Share Posted April 6, 2011 ow btw (: maybe somebody can help me out quick ^^ If $nMsg = $Homepage then RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\" , "Start Page" ,"REG_SZ", "http://www.mranderson.nl/") endif Button wont change the Homepage :C can somebody help? (: Link to comment Share on other sites More sharing options...
spudw2k Posted April 7, 2011 Share Posted April 7, 2011 ow btw (: maybe somebody can help me out quick ^^ If $nMsg = $Homepage then RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\" , "Start Page" ,"REG_SZ", "http://www.mranderson.nl/") endif Button wont change the Homepage :C can somebody help? (: Are you closing and re-opening IE between homepage changes? I believe it reads that key when it opens, and not again unless you set it via IE Options. You could force IE to close and re-open. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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