Jump to content

Collecting And Passing Input


Guest Hillbilly Hacker

Recommended Posts

Guest Hillbilly Hacker

Ok, I managed to write my gui, but dont know how to collect the data that the user puts in, can someone show me the syntax for collecting my user id as a variable $nUser and then sending that to Notepad? Right now it always passes $nUser as 3. Here is my script so far:

;

; AutoProvision - Written By Eric Dawson

;

; Purpose: To eleminate some of the time consuming and repetative tasks associated with provisioning circuits.

;

;

;************************* Create Window ************************************************************

GuiCreate("AutoProvision - Written by Eric Dawson", 330, 300)

GuiShow()

WinActivate("AutoProvision - Written by Eric Dawson")

;************************* Collect F&E login information ********************************************

Opt("GUICoordMode",1)

GUISetControl( "Label", "Please Authenticate FE Access", 10, 10, 170, 80)

GUISetControl("label", "User ID", 10, 30)

$nUser = GUISetControl("input", "V515", 65, 28, 90, 19)

GUISetControl("label", "Password", 10, 60)

GUISetControl( "input", "", 65, 58, 90, 19)

;************************* Collect 3270 emulator information ****************************************

GUISetControl( "group", "Select 3270 Emulator", 200, 10, 120, 80)

GUISetControl( "radio", "Netmanage", 210, 30, 80, 20)

GuiSetControlEx(-1, 1)

GUISetControl( "radio", "Extra TPC/IP", 210, 60, 80, 20)

;************************* Collect Circuit ID *******************************************************

GUISetControl("label", "Circuit Id", 10, 110)

GUISetControl( "input", "W0C76592", 65, 108, 90, 19)

;************************* Select task to be preformed **********************************************

GUISetControl( "group", "Action To Be Taken", 10, 150, 310, 90)

GUISetControl( "radio", "Collect Subordinate Circuit IDs", 20, 170, 280, 20)

GuiSetControlEx(-1, 1)

GUISetControl( "radio", "Collect Bell Circuit IDs for Subordinate Circuits", 20, 190, 280, 20)

GUISetControl( "radio", "Collect Old and New CFAs for Subordinate Circuits", 20, 210, 280, 20)

;************************* Create action buttons ****************************************************

GUISetControl( "button", "Ok", 120, 270, 35)

GUISetControl( "button", "Cancel", 165, 270, 60)

GuiWaitClose()

;************************* Print the value of $nuser in Notepad *************************************

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("User ID collected as: ")

Send($nUser)

Sleep(2000)

Send("!f")

Send("x")

WinWaitActive("Notepad", "No")

Send("n")

WinWaitClose("Untitled - Notepad")

Link to post
Share on other sites

Nice-looking GUI :D

$nUser = GUISetControl("input", "V515", 65, 28, 90, 19)

creates a handle to the control and is not the value of the control

thus, Send($nUser) will not work. You need Send(GuiRead($nUser)) or something similar

Edit: My method assumes you say Opt("GUINotifyMode", 1) at the very top.

JdeB's suggestion should work, too.

I would replace the "action button section" with something like this:

Dim $userID;optional

$buttonOK = GUISetControl( "button", "Ok", 120, 270, 35)
$buttonCancel = GUISetControl( "button", "Cancel", 165, 270, 60)

While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3;user clicked the close button 'x' in corner
        Exit
    Case $msg = $buttonCancel
        Exit
    Case $msg = $buttonOK
        $userID = GuiRead($nUser)
        ExitLoop
    EndSelect
WEnd

;.....
;....print the value in notepad
Send($userID)
;.....

Hope that helps

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to post
Share on other sites

Just some more comments

the following code is not needed because GuiWaitClose will display the GUI

GuiShow()
WinActivate("AutoProvision - Written by Eric Dawson")

you have to care about the size label unless the input control will not work

GUISetControl("label", "User ID", 10, 30,55,15)
$nUser = GUISetControl("input", "V515", 65, 28, 90, 19)
GUISetControl("label", "Password", 10, 60,55,15)
GUISetControl( "input", "test", 65, 58, 90, 19)

THe JdeB method is the preferred for beginner or not needing special interaction when setting info on the gui for verification of coherency.

You can imagine to have 2 input passwords for avoid mistyping if it is a password definition

Good GUI :D

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...