Jump to content
Sign in to follow this  
d0n

variable used without being declard?

Recommended Posts

d0n

i dont know why, but this code gives me variable used without being declared once it gets to getinfo()

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If $msg = $go Then
        $date1 = GUICtrlRead($date)
        GUICtrlSetData($date_lable, "Data for: "&$date1)
    EndIf
    If $msg = $upload Then
        login()
        getinfo()
    EndIf
WEnd
GUIDelete()
Exit

Func login ()
    GUICtrlSetData($status, "Logging in...")
    $IE = _IECreate($Login_page)
    $Form = _IEFormGetCollection ($IE, 0)
    $Query = _IEFormElementGetCollection ($Form, 0)
    _IEFormElementSetValue ($Query, $username)
    $Query = _IEFormElementGetCollection ($Form, 1)
    _IEFormElementSetValue ($Query, $userpass)
    $login = _IEGetObjByName($IE, "login")
    _IEAction($login, "click")
    _IELoadWait($IE)
    GUICtrlSetData($status, "Logged in, uploading info...")
EndFunc

Func getinfo ()
    _IELinkClickByText($IE, "Attendance")
EndFunc

Share this post


Link to post
Share on other sites
Monamo

i dont know why, but this code gives me variable used without being declared once it gets to getinfo()

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If $msg = $go Then
        $date1 = GUICtrlRead($date)
        GUICtrlSetData($date_lable, "Data for: "&$date1)
    EndIf
    If $msg = $upload Then
        login()
        getinfo()
    EndIf
WEnd
GUIDelete()
Exit

Func login ()
    GUICtrlSetData($status, "Logging in...")
    $IE = _IECreate($Login_page)
    $Form = _IEFormGetCollection ($IE, 0)
    $Query = _IEFormElementGetCollection ($Form, 0)
    _IEFormElementSetValue ($Query, $username)
    $Query = _IEFormElementGetCollection ($Form, 1)
    _IEFormElementSetValue ($Query, $userpass)
    $login = _IEGetObjByName($IE, "login")
    _IEAction($login, "click")
    _IELoadWait($IE)
    GUICtrlSetData($status, "Logged in, uploading info...")
EndFunc

Func getinfo ()
    _IELinkClickByText($IE, "Attendance")
EndFunc

Your creation of the variable $IE is inside of another function - "Local" to that function. As far as your getinfo() function is concerned, it does not yet exist. You could try either:

  • Declaring your $IE variable as Global, or
  • Declaring the variable prior to the function calls

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.