Jump to content
Sign in to follow this  
BryanMc

how do u declare GUICtrlSetData

Recommended Posts

BryanMc

well i cant seem to get this to work... i keep getting the error variable used without being declared.... the error looks like this

Line 17 (File "C:\Desktop)

GUICtrlSetData ($input1, " Starting Script ")
GUICrtlSetData (^ERROR

Error: Variable used without being declared.

and here is my script can any one help me asap thanks...

#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolBar.au3>
#include <GuiConstantsEx.au3>

HotKeySet("{F7}", "ExitProg")
HotKeySet("{F8}", "Stop")
HotKeySet("{F9}", "Shapphire")
HotKeySet("{F10}", "Ruby")
HotKeySet("{F11}", "Emerald")
HotKeySet("{F6}", "Topaz")

Opt('MustDeclareVars', 1)

Func Topaz()
While 1
      GUICtrlSetData ($input1, "     Starting script")
        Sleep (2000)
        Send("{RIGHT down}")
            Sleep (9000)
        Send("{RIGHT up}")
        Send("{SPACE 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (1000)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{DOWN 1}")
            Sleep (500)
        Send ("{Space 1}")
            Sleep (3000)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
            Sleep (500)
        Send("{LEFT down}")
        Send("{UP down}")
            Sleep (3000)
        Send("{LEFT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (1000)
        Send("{RIGHT 3}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (2000)
        Send("{z 100}")
        Send("{RIGHT down}")
        Send("{UP down}")
            Sleep (6000)
        Send("{RIGHT up}")
            Sleep (3000)
        Send("{UP up}")
            Sleep (500)
        Send("{RIGHT 12}")
            Sleep (500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{LCTRL 1}")
            Sleep (1500)
        Send("{z 100}")

        Send("{DOWN down}")
        Send("{LALT 2}")
            Sleep (500)
        Send("{DOWN up}")
        Send("{RIGHT down}")
            Sleep (600)
        Send("{RIGHT Up}")
            Sleep (500)
        Send("{UP 5}")
            Sleep (1500)
WEnd
EndFunc

_Main()

Func _Main()
    Local $filemenu, $fileitem, $recentfilesmenu, $separator1
    Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton, $button1, $button2, $button3, $button4, $input1, $input2, $label1, $label2, $label3, $label4, $label5
    Local $msg, $file
    #forceref $separator1

    GuiCreate("Created By BryanMc",357,232,310,165)

    $filemenu = GUICtrlCreateMenu("File")
    $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $helpmenu = GUICtrlCreateMenu("?")
    $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
    
    $button1=GuiCtrlCreateButton("Shapphire Gem",2,4,88,27)
    $button2=GuiCtrlCreateButton("Ruby Gem",2,54,88,27)
    $button3=GuiCtrlCreateButton("Emerald Gem",2,103,88,27)
    $button4=GuiCtrlCreateButton("Topaz Gem",2,153,88,27)
    $input1=GuiCtrlCreateInput("",90,170,201,20)
    $input2=GuiCtrlCreateInput("Close Program: F7       | |       Stop: F8",90,189,201,20)
    $label1=GuiCtrlCreateLabel("Hotkey: F9",13,30,70,15)
    $label2=GuiCtrlCreateLabel("Hotkey: F10",13,80,70,15)
    $label3=GuiCtrlCreateLabel("Hotkey: F11",14,129,70,15)
    $label4=GuiCtrlCreateLabel("Hotkey: F12",14,179,70,15)
    $label5=GuiCtrlCreateLabel("By: BryanMc",295,173,64,15)
    $cancelbutton = GUICtrlCreateButton("Exit", 292,186,65,24)
    $okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20)
    
    GuiSetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        
        If $msg=-3 Then Exit
        If $msg=$button1 Then Shapphire()
        If $msg=$button2 Then Ruby()
        If $msg=$button3 Then Emerald()
        ;If $msg=$button4 Then Topaz()

        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                ExitLoop

            Case $msg = $fileitem
                $file = FileOpenDialog("Choose file...", @DesktopDir, "All (*.*)")
                If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

            Case $msg = $exititem
                ExitLoop
                
            Case $msg = $aboutitem
                MsgBox(0, "About", "GUI Menu Test")
                
            Case $msg = $okbutton
                MsgBox(0, "Click", "You clicked OK!")
            
            Case $msg = $button4
                MsgBox(0, "Click", "You clicked OK!")
        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Share this post


Link to post
Share on other sites
somdcomputerguy

You're declaring $input1 as a local variable in the function _Main, but trying to use it in the function Topaz. Declare it as a global variable.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
BryanMc

You're declaring $input1 as a local variable in the function _Main, but trying to use it in the function Topaz. Declare it as a global variable.

ok figured it out thanks so much ....

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  

×