Jump to content
Sign in to follow this  
Heroic

Changing Label Display.

Recommended Posts

Heroic

Okay, i used to be able to create AutoIt3 programs but i rarely used it.

Now I've forgotten how to do it!

Thing is, i have the code i want, and HOW i want to do it, but i keep getting errors and i keep failing to succeed.

#include <GUIConstants.au3>
#include <INet.au3>

$Form1 = GUICreate("WhatsMyFIP!", 165, 82, 387, 321)
$Label1 = GUICtrlCreateLabel("IP:", 16, 48, 21, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
$Label2 = GUICtrlCreateLabel( "Displayed IP", 40, 48, 98, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
$Button1 = GUICtrlCreateButton("Click to get IP", 32, 16, 97, 17, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
$IP = _GetIP()
GUISetState(@SW_SHOW)


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

I removed everything i attempted to give you the default.

What i want it to do

When it loads up, it will display no IP in $Label2 but the default text.

When you press the button it will Fetch the IP and display it in $Label2 default text.

Please help me figure this out, i read the F1 help panel and it confused me even more.

Thank you in advance.

Share this post


Link to post
Share on other sites
Madza91

Is this what you want?

#include <GUIConstants.au3>

#include <INet.au3>

$Form1 = GUICreate("WhatsMyFIP!", 165, 82, 387, 321)

$Label1 = GUICtrlCreateLabel("IP:", 16, 48, 21, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Verdana")

$Label2 = GUICtrlCreateLabel( "Displayed IP", 40, 48, 98, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Verdana")

$Button1 = GUICtrlCreateButton("Click to get IP", 32, 16, 97, 17, 0)

GUICtrlSetFont(-1, 8, 400, 0, "Verdana")

$IP = _GetIP()

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

GUICtrlSetData($Label2,$IP)

EndSwitch

WEnd


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites
Heroic

Oh my god!

On my side it looked so hard and i completely forgot about GUICTRLSETDATA. - Thank you so much n3nE.

Love you!!!!!! (This makes its so much easier for my web designing and if i manage to close my browser to get my ip address ^^)

Share this post


Link to post
Share on other sites
Madza91

No problem <_<


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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  

×