ZeroByDevide

variables

4 posts in this topic

#1 ·  Posted

i have this code running but it just would not start the code:

Local $rndSleep = Int (Random(180000,240000,1000))

MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep)

 

here is the error it shows me:

"C:\Users\numan\Desktop\scipiie.au3" (23) : ==> Variable used without being declared.:
MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep)
MsgBox(^ ERROR

Share this post


Link to post
Share on other sites



#2 ·  Posted

Helpfile says:

Quote

Constants are defined in MsgBoxConstants.au3.

have also a look at example1, there you can see how to include it.

Share this post


Link to post
Share on other sites

#3 ·  Posted

It looks like it is pointing at your $MB_SYSTEMMODAL variable. Did you include MsgBoxConstants.au3 at the top of your script? Otherwise it runs just fine for me.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

That or this...^_^    was already all typed out when you posted Bert

This code works on my PC

Local $rndSleep = Int (Random(180000,240000,1000))

MsgBox(0, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep)

Please use the <> in the menu when posting code. :)

Edited by l3ill
1 person likes this

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

  • Similar Content

    • cappy2112
      What are the alternatives to the tiny MsgBox?
      By cappy2112
      The MsgBox() function is fine if your messages are very short.
      What are the AutoI alternatives if you need to display larger messages?
      Is there a lager dialog available, or do I need to write something from scratch?
       
      Thanks
    • harvester2001
      Variable must be of type "Object" inside loop
      By harvester2001
      Hi
      I need help, I found script to check computer model. I want use it in loop to chceck multiple pc`s (targets.txt with computer names).
      But when i try use inside loop i get error: Variable must be of type "Object" and I dont know how to fix this
      Plz help
       
      Local $targets = @ScriptDir& "\targets.txt" Local $log_name = "\scan.log" $msgBox = MsgBox(4, "Scan", "need tergets.txt") Example() Func Example() If $msgBox = 7 Then exit EndIf If Not FileExists($targets) Then MsgBox($MB_SYSTEMMODAL, "", "File: targets.txt - no exist !") Exit EndIf FileOpen($targets, 0) Global $arr[1000] ReDim $arr[_FileCountLines($targets)+1] For $i = 1 to _FileCountLines($targets) $line = FileReadLine($targets, $i) $arr[$i] = $line ; chceck if pc is online Local $iPing = Ping($arr[$i], 250) If $iPing Then ; ONLINE Local $strComputer = $arr[$i] $colItems = "" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _ "0x10" + "0x20") If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Vendor: " & $objItem.Vendor & @CRLF $Output = $Output & "SN: " & $objItem.IdentifyingNumber & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "UUID: " & $objItem.UUID & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" ) Endif Else ;OFFLINE _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" OFFLINE") EndIf Next EndFunc  
       
    • Masum
      ExcelRangeRead intermittent error
      By Masum
      Hi all,
      I'm facing a random error, whereby the ExcelRangeRead function is storing the first letter of a string as a lowercase rather than the uppercase it is stored in Excel. This happens about 10% of the times. And only with one of the ExcelRangeRead functions below, Global $RTERuleName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'I' & $Row)
      Func ExtractDCWData() Global $PoolName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'G' & $Row) Global $PoolDescription = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'H' & $Row) Global $RTERuleName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'I' & $Row) Global $FirstName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'F' & $Row) Global $LastName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'E' & $Row) Global $Notes = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'L' & $Row) Sleep(200) EndFunc ;==>ExtractDCWData The excel column looks like this.

      The script that writes the data out is as follows.
      Func AddRTERule() MouseClick('Primary', 69, 657, 1) ;Click Rules... Sleep(200) MouseClick('Primary', 363, 228, 1) ;Click Type Sleep(200) MouseClick('Primary', 363, 266, 1) ;Click RTE Sleep(200) MouseClick('Primary', 363, 545, 1) ;Click New Rule Sleep(200) Send($RTERuleName) ;Enter Mnemonic Sleep(200) Send('{TAB}') ;Enter Description Sleep(100) ;Theres more lines of code in this function... EndFunc ;==>AddRTERule Any ideas?
       
    • Masum
      Move MsgBox Function
      By Masum
      Hi all,
      Can this function be modified to support  @CRLF in the MsgBox's text?
      ; Move Message Box ; Author - herewasplato _MoveMsgBox(0, "testTitle", "testText", 0, 10) Func _MoveMsgBox($MBFlag, $MBTitle, $MBText, $x, $y) Local $file = FileOpen(EnvGet("temp") & "\MoveMB.au3", 2) If $file = -1 Then Return;if error, give up on the move Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')' Local $line2 = 'WinWait("' & $MBTitle & '", "' & $MBText & '")' Local $line3 = 'WinMove("' & $MBTitle & '", "' & $MBText & '"' & ', ' & $x & ', ' & $y & ')' FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3) FileClose($file) Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\MoveMB.au3") MsgBox($MBFlag, $MBTitle, $MBText) FileDelete(EnvGet("temp") & "\MoveMB.au3") EndFunc;==>_MoveMsgBox  Thanks
    • RyukShini
      Array variable has incorrect number of subscripts
      By RyukShini
      Local $okay _FileReadToArray("Okay.txt", $okay) ; read the list of names to array For $i = 1 To UBound($okay) - 1 $Read = $okay[$i] If I run this and it goes to the end of Okay.txt it returns an error.
      "Array variable has incorrect number of subscripts or subscript dimension range exceeded.:"
      so can I either exitloop if its run through the file or add some error checking that exitloop if array = empty?
      Thanks in advance.