Jump to content
Sign in to follow this  
gimx

GUI Help

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites

try:

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Thanks a lot :)

Edited by gimx

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