Jump to content

GUI help!


Recommended Posts

hello

i want make a simple gui to login to my servers

i have the following code...

Global $user = "admin"

Func Gui()

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1_1 = GUICreate("GUI", 381, 351, 350, 168)
$Label1 = GUICtrlCreateLabel("my first gui", 20, 88, 339, 17, $SS_CENTER)
$Label2 = GUICtrlCreateLabel("...", 20, 111, 339, 17, $SS_CENTER)
$OK = GUICtrlCreateButton("OK", 152, 304, 76, 25, 0)
GUICtrlCreateCombo("", 140, 264, 100, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "server 1|server 2", "server 1")
GUICtrlCreateInput($user, 120, 208, 140, 18, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateInput("input to $password", 120, 232, 140, 18, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

; save password
Global $password = "the_input"

GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()

Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
Case $OK
    ExitLoop
EndSwitch
WEnd

EndFunc

Gui()
Sleep(50000)

i want save the input password to $password to use it later in my script

also i want the gui close and continue the script

ExitLoop let continue but not close it

how can i do that ?

Edited by sands
Link to comment
Share on other sites

for your first question, look up guictrlinput in the help file. It will show you how to save it.

to close you gui, look up guidelete in the help file.

i can't found guictrlinput in the help file

can you copy and paste it here ?

just the parameters and the example

the other question was fixed with guidelete alright

thanks for reply

Link to comment
Share on other sites

for closeing then use exitloop and continueloop

for the other one go look in the help file after

GUICtrlRead :D

Edit here i will help you a little

$password=GUICtrlCreateInput("input to $password", 120, 232, 140, 18, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))





$readpassword= guictrlread($password)
msgbox (0,"","your password is :"&$password)

i dident test this but should work and print that you write in the password :o

Edited by TheOnlyOne
Link to comment
Share on other sites

GUICtrlCreateInput ()
GUICtrlRead ()

;OR

#Include <Guiconstants.au3>
#Include <EditConstants.au3>
#Include <WindowsConstants.au3>

opt ('Guioneventmode', 1)

GUICreate ('', 200, 200)
$i = GUICtrlCreateInput ('', 5, 5, 100, 20, $ES_PASSWORD)
guisetonevent ($GUI_EVENT_CLOSE, '_Exit')
Guisetstate ()

While 1
Sleep (100)
wend

Func _Exit ()
exit
EndFunc

Link to comment
Share on other sites

$Combo = GUICtrlCreateCombo("", 140, 264, 100, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "server 1|server 2", "server 1")
$In_1 = GUICtrlCreateInput($user, 120, 208, 140, 18, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$in_2 = GUICtrlCreateInput("input to $password", 120, 232, 140, 18, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))

; save password


GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()

Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
Case $OK
    Global $password = GUICtrlRead($in_2)
    GUIDelete()
    ExitLoop
EndSwitch
WEnd

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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