IcantCodeHelp Posted January 1, 2021 Share Posted January 1, 2021 Can someone explain the Autoit error to me I'm not sure what I did wrong #Include <MsgBoxConstants.au3> Local $PanMan = InputBox("Title Im on top", "Prompt Im at bottom", "Im the PassCode Part", "","M2" _ - 1, -1, 0, 0) Sleep("1000", $PanMan) ;MsgBox($MB_SYSTEMMODAL, "", $PanMan) ;MsgBox($MB_OK, "", $PanMan) Here's a gif I've created (To give you a better perspective) I put 1000 so that the sleep time could be 1000 But I don't know what the error is telling me, hopefully you can make it sound more simple Link to comment Share on other sites More sharing options...
Subz Posted January 1, 2021 Share Posted January 1, 2021 Sleep only has one parameter it should just be Sleep(1000), which is 1 second although unsure why you need the sleep. Link to comment Share on other sites More sharing options...
IcantCodeHelp Posted January 1, 2021 Author Share Posted January 1, 2021 (edited) 9 minutes ago, Subz said: Sleep only has one parameter it should just be Sleep(1000), which is 1 second although unsure why you need the sleep. I need sleep, to change the value of it by using the input GUI And thank you Edited January 1, 2021 by IcantCodeHelp Link to comment Share on other sites More sharing options...
Subz Posted January 1, 2021 Share Posted January 1, 2021 Sorry that doesn't make sense, inputbox will pause until the user has clicked the OK button, so there is no need for the sleep, your parameters are also incorrect it should be something like: Local $sValue = InputBox("Title Im on top", "Prompt Im at bottom", "", " M2") MsgBox(4096, "", $sValue) Link to comment Share on other sites More sharing options...
IcantCodeHelp Posted January 1, 2021 Author Share Posted January 1, 2021 Thank you, And if you were wondering- I was trying to make what ever was typed in for $sValue the the amount of Milliseconds for sleep for example something like this Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 1, 2021 Moderators Share Posted January 1, 2021 Where did you get that Sleep accepted more than one param? Certainly not by looking at it in the help file... "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Dan_555 Posted January 1, 2021 Share Posted January 1, 2021 You can simply use Sleep ($PanMan) or better: #Include <MsgBoxConstants.au3> Local $PanMan = InputBox("Title Im on top", "Prompt Im at bottom", "5000", "","M2" _ - 1, -1, 0, 0) Sleep((IsNumber($PanMan)=1) ? $PanMan : 3000) ;Check if the $PanMan is a number, then sleep for that amount, or if not, sleep for 3 seconds. MsgBox($MB_SYSTEMMODAL, "", $PanMan) Some of my script sourcecode Link to comment Share on other sites More sharing options...
TheXman Posted January 1, 2021 Share Posted January 1, 2021 (edited) 32 minutes ago, Dan_555 said: You can simply use Sleep ($PanMan) or better: #Include <MsgBoxConstants.au3> Local $PanMan = InputBox("Title Im on top", "Prompt Im at bottom", "5000", "","M2" _ - 1, -1, 0, 0) Sleep((IsNumber($PanMan)=1) ? $PanMan : 3000) ;Check if the $PanMan is a number, then sleep for that amount, or if not, sleep for 3 seconds. MsgBox($MB_SYSTEMMODAL, "", $PanMan) @Dan_555 The data type of the return value of InputBox() is a string, regardless of the value. Therefore, in your second example, IsNumber($PanMan) will always return FALSE. IsNumber() checks the variable's data type not its value. It does not check if the value is numeric. Edited January 1, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
IcantCodeHelp Posted January 1, 2021 Author Share Posted January 1, 2021 Thank you all for your help I'm understanding now Link to comment Share on other sites More sharing options...
Dan_555 Posted January 2, 2021 Share Posted January 2, 2021 Thanks for mentioning it, ... @TheXman When i tested the code, it worked. Anyway this should work now: Local $PanMan = int(InputBox("Title Im on top", "Prompt Im at bottom", "5000", "","M2" _ - 1, -1, 0, 0)) Sleep((IsNumber($PanMan)=1) ? $PanMan : 3000) ;Check if the $PanMan is a number, then sleep for that amount, or if not, sleep for 3 seconds. MsgBox($MB_SYSTEMMODAL, "", $PanMan) should work Some of my script sourcecode Link to comment Share on other sites More sharing options...
Nine Posted January 2, 2021 Share Posted January 2, 2021 Not quite. By putting the int() in front of the InputBox, you are loosing the possibility to test @error. And then not able to check if user has cancelled... Use instead StringIsInt(). Dan_555 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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