the_lord_mephy Posted September 13, 2004 Share Posted September 13, 2004 Does the Do command not work with functions? because when i put a function in i get an error that says the Do statement does not have an Until statement. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 13, 2004 Share Posted September 13, 2004 Can you provide an example? I havent had such problems, but I might be able to assist you. *** Matt @ MPCS Link to comment Share on other sites More sharing options...
the_lord_mephy Posted September 13, 2004 Author Share Posted September 13, 2004 (edited) For example HotKeySet("!t", "time") $i = 0 Do Func time() $hour=@hour If $hour > 12 Then $hour = $hour - 12 EndIf $sec=@sec $min=@min MsgBox(0, "Time", "The time is: "& $hour&":"&$min&":"& $sec) EndFunc Until $i = 1 [Edit] Well for that i dont need the do until but it still give the same error Edited September 13, 2004 by the_lord_mephy My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 13, 2004 Share Posted September 13, 2004 (edited) Functions are nothing but coding structures... they are there so you can pull code that you repeat in your scripts and only type it once... well maybe I can show you better with your code. I don't understand what you are trying to accomplish with your code but I will do my best to assist you. If you want the application to sit and wait until the "Alt + T" ket combination is pressed, then you would want to do something like this: HotKeySet("!t", "time") ; Loop inifinitly While 1 Sleep(10) WEnd Func time() $hour=@hour If $hour > 12 Then $hour = $hour - 12 EndIf $sec=@sec $min=@min MsgBox(0, "Time", "The time is: "& $hour&":"&$min&":"& $sec) EndFunc You may also consider adding an exit key combination, such as, 'ALT + Q', so there is a way to kill the script. That would look something like this: HotKeySet("!t", "time") HotKeySet("!q", "ExitNow" ) ; Loop inifinitly While 1 Sleep(10) WEnd Func time() $hour=@hour If $hour > 12 Then $hour = $hour - 12 EndIf $sec=@sec $min=@min MsgBox(0, "Time", "The time is: "& $hour&":"&$min&":"& $sec) EndFunc Func ExitNow() Exit EndFunct I hope that helps! Happy Posting! *** Matt @ MPCS EDIT: Changed the while loop per Jon's comment. Edited September 13, 2004 by Matt @ MPCS Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 13, 2004 Administrators Share Posted September 13, 2004 And change this: While 1 WEnd to While 1 Sleep(10) WEnd Otherwise CPU gets maxed out. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
JSThePatriot Posted September 13, 2004 Share Posted September 13, 2004 Thanks for telling me how to do the tid bit on launching a script but making it wait till I pressed a button. I was just browsing while contemplating how to put my problem when I ran across this. Thanks. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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