Jump to content

Recommended Posts

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)

825644059_ScreenRecording2021-01-01at11_19_17_03AM.gif.da9e991dd81afcf141eadb1e0f5d93d6.gif

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

 

Share this post


Link to post
Share on other sites

Sleep only has one parameter it should just be Sleep(1000), which is 1 second although unsure why you need the sleep.

Share this post


Link to post
Share on other sites
Posted (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 by IcantCodeHelp

Share this post


Link to post
Share on other sites

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)

 

Share this post


Link to post
Share on other sites

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
Screen Recording 2021-01-01 at 01.32.11.86 PM
 

Share this post


Link to post
Share on other sites

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)

 

Share this post


Link to post
Share on other sites
Posted (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 by TheXman

Share this post


Link to post
Share on other sites

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 ;)

Share this post


Link to post
Share on other sites

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().

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...