Jump to content

Recommended Posts

Posted

Hello,

Sorry for this noob question, but how can i use variables which are in the form ?

For example, i want IE open the url in the input when i press "ok".

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$example = GUICreate("example", 471, 129, 193, 115)
$url = GUICtrlCreateInput("http://www.google.com", 32, 16, 409, 21)
$ok = GUICtrlCreateButton("ok", 136, 56, 201, 41, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

If i write this script after, nothing append when i press "ok"

If $ok = "ok" Then
    $oIE = _IECreate ($url)
EndIf

Thx :)

  • Developers
Posted (edited)

try:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $url
            $oIE = _IECreate(GUICtrlRead($url))     
    EndSwitch
WEnd
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Thx for reply :)

But i need variables after the gui is closed.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $go
            $oIE = _IECreate(GUICtrlRead($url))
            GUIDelete()
        Case $cancel
            Exit

EndSwitch
WEnd

After the "Wend", i need to script to parse the webpage.

Or i write the script under the "Case $go" ?

This is the step which i would like :

- Open GUI with differents inputs

- Close the GUI and open IE with $url

- Parse webpage with others inputs in parameters.

But i don't know how can i keep inputs in "memory" after the gui is closed.

I'm not sure if it's clear coz my english is bad, sorry :)

Thx ^_^

Edited by gimx
Posted (edited)

Well use ExitLoop instead of Exit and then GUIDelete(). The variables should stay the way they are.

edit:

#include <GUIConstants.au3>
#include <IE.au3>

#Region ### START Koda GUI section ### Form=
$example = GUICreate("example", 471, 129, 193, 115)
$url = GUICtrlCreateInput("http://www.google.com", 32, 16, 409, 21)
$ok = GUICtrlCreateButton("ok", 136, 56, 201, 41, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ok
             $Address=GUICtrlRead($url)
             GUIDelete()
            $oIE = _IECreate( $Address);,0,1,0)
            ;You can set the _IEcreate to not wait till the page loads so your script continues immediately.
            ExitLoop
;~         Case $cancel
;~             ExitLoop

EndSwitch
WEnd

MsgBox(0,"","And your script continues! :P")
Edited by Nahuel
Posted (edited)

I didn't know this ExitLoop, i have tried and it work.

Thanks a lot :)

Edited by gimx

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
×
×
  • Create New...