EhJay Posted May 8, 2006 Share Posted May 8, 2006 Hi. I have a point in my script where I would like a msg box or something to pop up and ask me how long I would like to make the script pause for. ex. How long would you like the script to wait? ___5___ OK The script would then wait for 5 seconds or minutes or whatever unit I can use. Thanks for the help. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 8, 2006 Share Posted May 8, 2006 Hi. I have a point in my script where I would like a msg box or something to pop up and ask me how long I would like to make the script pause for.ex.How long would you like the script to wait? ___5___ OKThe script would then wait for 5 seconds or minutes or whatever unit I can use.Thanks for the help.This does not sound hard. What have you got already? Is your InputBox() working? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Geert Posted May 8, 2006 Share Posted May 8, 2006 Sleep(1000*Number(InputBox("Wait 'x' seconds","Enter Time To Wait"))) Link to comment Share on other sites More sharing options...
EhJay Posted May 8, 2006 Author Share Posted May 8, 2006 That worked great. Thanks. Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 Hi again. That's been working great but how do I get the script to abort when I click cancel on the imput box? I press cancel and it just waits the time that's in the imput box before continuing on in the script. I want to put an "Exit" when someone presses the cancel button. Thanks. Link to comment Share on other sites More sharing options...
Bundy Posted June 10, 2006 Share Posted June 10, 2006 Assign InputBox to variable, and look at help: Return Value Success: Returns the string that was entered. Failure: Returns an empty string and sets @error as follows: @Error 0 = The string returned is valid. 1 = The Cancel button was pushed. 2 = The Timeout time was reached. And use sinple If... EndIf. Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 Ok. I understand what you mean by that, but how would I make the ImputBox a variable when it is like this?: Sleep(1000*Number(InputBox("Wait 'x' seconds","Enter Time To Wait"))) With the "Sleep" at the beginning where would I but the $variable ? Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 (edited) Don't use this for accurate time taking thougt $timeout = InputBox("TIMOUT IN","Give ms to timout") ; DO check for cancel see the help file $timeinit = TimerInit() While (TimerDiff($timeinit) < $timeout) TrayTip("","",0) TrayTip("Timout in: ", $timeout - TimerDiff($timeinit),0) sleep(100) Wend Edited June 10, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 Don't use this for accurate time taking thougt $timeout = InputBox("TIMOUT IN","Give ms to timout") ; DO check for cancel see the help file $timeinit = TimerInit() While (TimerDiff($timeinit) < $timeout) TrayTip("","",0) TrayTip("Timout in: ", $timeout - TimerDiff($timeinit),0) sleep(100) Wend Errr... ok thank you. Your thing works like I want it to but when you click cancel it does not exit the script, it just continues what's after the "WEnd". Also, I need to do this silently. Thank you though. Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 , Am I employed by you or somthing? hmm, no I have not seen any checks yet, so I don't think so. ; DO check for cancel SEE THE HELP FILE!!!!! $timeout = InputBox("TIMOUT IN","Give ms to timout") ; DO check for cancel see the help file $timeinit = TimerInit() While (TimerDiff($timeinit) < $timeout) sleep(100) Wend Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 , Am I employed by you or somthing? hmm, no I have not seen any checks yet, so I don't think so. ; DO check for cancel SEE THE HELP FILE!!!!! $timeout = InputBox("TIMOUT IN","Give ms to timout") ; DO check for cancel see the help file $timeinit = TimerInit() While (TimerDiff($timeinit) < $timeout) sleep(100) Wend LOL... Ok I didn't understand what that ment before. Sorry. And I didn't ask you to write me all of that ya know... you chose to. I just asked how to make the ImputBox in Sleep(1000*Number(InputBox("Wait 'x' seconds","Enter Time To Wait"))) a variable. But thank you, this should work. Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 (edited) Umm... Ok I still can't get it to work. Would I put If $timeout = 1 then exit endif into it because the return value of the ImputBox when cancel is presses is 1? I'm sorry I've never used this many variables or "values" in a program before. Thanks again for your help. Edited June 10, 2006 by EhJay Link to comment Share on other sites More sharing options...
Bundy Posted June 10, 2006 Share Posted June 10, 2006 I don't know how to do it properly either but try: $variable = InputBox("Wait 'x' seconds","Enter Time To Wait") If @error Then Exit 0 EndIf If IsInt($variable) And $variable <> "" Then Sleep(1000*Number($variable)) EndIf I don't know how to get @error value ;p Link to comment Share on other sites More sharing options...
EhJay Posted June 10, 2006 Author Share Posted June 10, 2006 I did that and it works. Thank you very much. Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 I don't know how to do it properly either but try: $variable = InputBox("Wait 'x' seconds","Enter Time To Wait") If @error Then Exit 0 EndIf If IsInt($variable) And $variable <> "" Then Sleep(1000*Number($variable)) EndIf Is a contradiction (or a bot to mutch if you like ). Obviously $variable <> "" if $variable is a int (number), or did I miss something ? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
EhJay Posted June 11, 2006 Author Share Posted June 11, 2006 To tell you the truth I don't understand the whole line. If IsInt($variable) And $variable <> "" Then Link to comment Share on other sites More sharing options...
Daniel W. Posted June 11, 2006 Share Posted June 11, 2006 If IsInt($variable) And $variable <> "" Then Lets look at it then If ... Then should be known IsInt( $variable ) : Int ( INTeger) is a number like 2 or 3 or - 1. 1.124 and 1234.124 are not a integers! IsInt(..) returns 1 if the variable is an integer and 0 if the variable is no integer $variable <> "" This is just a check if the variable is defined. When its not defined its "". Then you cant check anything with it And this combines both (isint() $variable <> "") and the if ... then will only be done when BOTH are true! Do you understand it now? --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
EhJay Posted June 11, 2006 Author Share Posted June 11, 2006 Oh! I actualy kinda get it. It's like it's jerryriged then? Link to comment Share on other sites More sharing options...
Daniel W. Posted June 11, 2006 Share Posted June 11, 2006 hmm what means "jerryriged"? Google translate says nothing and my english wordbook doesn't have it. Sorry --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
i542 Posted June 11, 2006 Share Posted June 11, 2006 Maybe that works: $wait=InputBox("How long","Enter time to wait.") If @error Then Exit 1 Sleep($wait) TrayTip("Wait","Wait end") Sleep(5000) ;or you can replace TrayTip with this MsgBox(0,"Wait", "Wait end") I can do signature me. 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