Jump to content
Sign in to follow this  
BrettF

Expecting a "=" operator...

Recommended Posts

Ok... I tried this in response to Jakits' Question about multiple message boxes as a quick example, yet I get an error, which I can't seem to work out in any shape or form why I get it...

The Offending Code:

#include <GUIConstants.au3>

Dim $gui
Dim $txt
Dim $btn_ok

For $i = 1 To 10    
    $gui[$i] = GUICreate("Title: " & $i, 260, 95, 195, 115, $WS_SYSMENU+$WS_CAPTION+$WS_POPUPWINDOW+$WS_BORDER+$WS_CLIPSIBLINGS)
    $txt[$i] = GUICtrlCreateLabel("txt", 8, 4, 247, 53)
    $btn_ok[$i] = GUICtrlCreateButton("Ok", 92, 64, 75, 25, 0)
    GUISetState(@SW_SHOW, $gui[$i])
Next

While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $btn_ok
            GUIDelete($gui[$msg[1]])
    EndSelect
WEnd

The Error:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "d:\my documents\My Files\My Stuff\help.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams 
+>15:44:58 Starting AutoIt3Wrapper v.1.9.2
>Running AU3Check (1.54.9.0)  from:C:\Program Files\AutoIt3
+>15:44:58 AU3Check ended.rc:0
>Running:(3.2.6.0):C:\Program Files\AutoIt3\autoit3.exe "d:\my documents\My Files\My Stuff\help.au3"    
D:\My Documents\My Files\My Stuff\help.au3 (8) : ==> Expected a "=" operator in assignment statement.: 
$gui[$i] = GUICreate("Title: " & $i, 260, 95, 195, 115, $WS_SYSMENU+$WS_CAPTION+$WS_POPUPWINDOW+$WS_BORDER+$WS_CLIPSIBLINGS) 

->15:44:59 AutoIT3.exe ended.rc:1
+>15:44:59 AutoIt3Wrapper Finished
>Exit code: 1   Time: 1.756

Thanks for the help... :)

Share this post


Link to post
Share on other sites

One way...

#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -

Dim $gui[11]
Dim $txt[11]
Dim $btn_ok[11]

For $i = 1 To 10    
    $gui[$i] = GUICreate("Title: " & $i, 260, 95, 195 + $i, 115 + $i);, $WS_SYSMENU+$WS_CAPTION+$WS_POPUPWINDOW+$WS_BORDER+$WS_CLIPSIBLINGS)
    $txt[$i] = GUICtrlCreateLabel("txt", 8, 4, 247, 53)
    $btn_ok[$i] = GUICtrlCreateButton("Ok", 92, 64, 75, 25, 0)
    GUISetState(@SW_SHOW)
Next

While 1
    $msg = GUIGetMsg()
    
    for $x = 1 to 10
        If $msg = $btn_ok[$x] Then 
            If $msg = $btn_ok[1] Then Exit 
            MsgBox(0x0,"button pressed", "number " & $x, 3)
            GUIDelete($gui[$x])
        EndIf
    Next
   
WEnd

8)

Share this post


Link to post
Share on other sites

its these that are wrong:

Dim $gui
Dim $txt
Dim $btn_ok

Should be this as Valuater pointed out:

Dim $gui[11]
Dim $txt[11]
Dim $btn_ok[11]
Edited by Jos
spelling

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
Sign in to follow this  

×
×
  • Create New...