Jump to content

GUI Error


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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

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

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
Link to comment
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 ;)

Some of my script sourcecode

Link to comment
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().

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...