Jump to content

variable used without being declard?


d0n
 Share

Recommended Posts

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

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]

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...