Sign in to follow this  
Followers 0
unclefishy

input variable?

3 posts in this topic

ok so i have the following issue....

on the following script i need the username and their password passed later in the script... when it goes to input the entered text it merely outputs"21" into the field... it works just fine it i declare it's value with a dim... weird.

CODE
Dim $USERNAME = "username"

Dim $PWORD = "mypassword"

I would hardcode it all the time but need passwords expire in our domain expire every 90 days...

any help would be appreciated

CODE
#include <GUIConstants.au3>

;Variables

#region

Dim $username

Dim $pword

Dim $Var1_CHKBOX

Dim $Var2_CHKBOX

Dim $Var3_CHKBOX

Dim $Var4_CHKBOX

Dim $Var5_CHKBOX

Dim $Var6_CHKBOX

Dim $Var7_CHKBOX

Dim $Var8_CHKBOX

Dim $Var9_CHKBOX

Dim $Var10_CHKBOX

Dim $RUN

Dim $EXIT

Dim $VarStatus1

Dim $VarStatus2

Dim $VarStatus3

Dim $VarStatus4

Dim $VarStatus5

Dim $VarStatus6

Dim $VarStatus7

Dim $VarStatus8

Dim $VarStatus9

Dim $VarStatus10

Dim $GUINAME = "Imager"

Dim $Caption = "Please Select an Image:"

Dim $Note = "Note: Selecting *Other* will just map the drive and launch ghost allowing you to select your image or push one up"

Dim $logo = "c:\nj-tmp\logo_tag_lrg.gif"

#endregion

DirCreate("C:\nj-tmp")

FileInstall("logo_tag_lrg.gif",$logo)

;creat gui

#region

GUICreate($GUINAME, 580, 380)

GUISetBkColor(0xFFFFFF)

GUISetIcon(@SystemDir & "\winmine.exe", 0)

;GUICtrlCreatePic("small-logo1.jpg", 0, 0, 520, 138)

GUICtrlCreatePic($logo, 117, 0, 346, 110)

GUISetFont(10, 400)

GUICtrlCreateLabel($Caption, 60, 100)

GUISetFont(9, 400)

GUICtrlCreateGroup("Desktops:", 30, 130, 150, 160)

GUICtrlCreateGroup("Laptops:", 210, 130, 150, 160)

GUICtrlCreateGroup("Credentials:", 390, 130, 150, 160)

;checkboxes

;desktops

$Var1_CHKBOX = GUICtrlCreateCheckbox("OptiPlex 755", 60, 150, 100 , 25) ;Checkbox 1

$Var2_CHKBOX = GUICtrlCreateCheckbox("OptiPlex 745", 60, 175, 100, 25) ;Checkbox 2

$Var3_CHKBOX = GUICtrlCreateCheckbox("OptiPlex GX280", 60, 200, 100, 25) ;Checkbox 3

$Var4_CHKBOX = GUICtrlCreateCheckbox("OptiPlex Gx270", 60, 225, 100, 25) ;Checkbox 4

$Var5_CHKBOX = GUICtrlCreateCheckbox("OptiPlex GX620", 60, 250, 100, 25) ;Checkbox 5

;laptops

$Var6_CHKBOX = GUICtrlCreateCheckbox("Lattitude D630", 240, 150, 100 , 25) ;Checkbox 6

$Var7_CHKBOX = GUICtrlCreateCheckbox("Lattitude D620", 240, 175, 100, 25) ;Checkbox 7

$Var8_CHKBOX = GUICtrlCreateCheckbox("Lattitude D610", 240, 200, 100, 25) ;Checkbox 8

$Var9_CHKBOX = GUICtrlCreateCheckbox("Lattitude D600", 240, 225, 100, 25) ;Checkbox 9

$Var10_CHKBOX = GUICtrlCreateCheckbox("*Other*", 240, 250, 100, 25) ;Checkbox 10

;creds

GUICtrlCreateLabel("Username:", 400, 155)

GUICtrlCreateLabel("CMH\", 400, 180)

GUICtrlCreateLabel("Password:", 400, 230)

$username = GUICtrlCreateInput ( "", 430, 175, 100, 20)

$pword = GUICtrlCreateInput ( "", 400, 250, 130, 20,$ES_PASSWORD)

;$ES_PASSWORD

;fucntion buttons

$RUN = GUICtrlCreateButton("Image!", 405, 350, 50, 20) ;This is the Run button

;view it

GUISetState()

;other note

GUISetFont(9,400)

GUICtrlCreateLabel($Note, 10, 320)

#endregion

;

;make gui visible, and handles for checkbosex

Call("Keep_Alive") ;This is the main function that keeps the program open even after you have ran one or more of the items.

;Example, if you have 30 items you can run more items without having to restart the appliction.

Func Keep_Alive()

Do

$msg = GUIGetMsg()

;This checks the state of the Checkbox if it is checked or 1 then it will set the variable to that.

$VarStatus1 = GUICtrlRead($Var1_CHKBOX)

$VarStatus2 = GUICtrlRead($Var2_CHKBOX)

$VarStatus3 = GUICtrlRead($Var3_CHKBOX)

$VarStatus4 = GUICtrlRead($Var4_CHKBOX)

$VarStatus5 = GUICtrlRead($Var5_CHKBOX)

$VarStatus6 = GUICtrlRead($Var6_CHKBOX)

$VarStatus7 = GUICtrlRead($Var7_CHKBOX)

$VarStatus8 = GUICtrlRead($Var8_CHKBOX)

$VarStatus9 = GUICtrlRead($Var9_CHKBOX)

$VarStatus10 = GUICtrlRead($Var10_CHKBOX)

Until $msg = $RUN Or $msg = $GUI_EVENT_CLOSE

If $msg = $EXIT Then

DirRemove("C:\nj-tmp", 1)

Exit

ElseIf $msg = $GUI_EVENT_CLOSE Then

DirRemove("C:\nj-tmp", 1)

Exit

EndIf

;If the status is 1 for the variable checkboxes when run is hit, it will execute those lines below which call the functions

If $VarStatus1 = 1 Then Call("ITEM_1")

If $VarStatus2 = 1 Then Call("ITEM_2")

If $VarStatus3 = 1 Then Call("ITEM_3")

If $VarStatus4 = 1 Then Call("ITEM_4")

If $VarStatus5 = 1 Then Call("ITEM_5")

If $VarStatus6 = 1 Then Call("ITEM_6")

If $VarStatus7 = 1 Then Call("ITEM_7")

If $VarStatus8 = 1 Then Call("ITEM_8")

If $VarStatus9 = 1 Then Call("ITEM_9")

If $VarStatus10 = 1 Then Call("ITEM_10")

Call("Keep_Alive")

EndFunc ;==>Keep_Alive

Func ITEM_1()

;PE-Network Configurator and Map Drive

Sleep(2000)

Send("{LWINDOWN}")

Send("d")

Send("{LWINUP}")

sleep(1000)

Send("!m")

sleep(1000)

Send("!m")

sleep(1000)

Send("{DOWN 2}")

Send("{ENTER}")

SLEEP(1000)

Send("{ENTER}")

Send("{UP}")

Send("{ENTER}")

WinWaitActive("Confirm","&No")

Send("{ENTER}")

WinWaitActive("PE Network Configurator - Network Profiles","Cancel")

Send("{ENTER}")

WinWaitActive("PE Network Configurator", "Network Identification")

Send("{TAB}")

Send("{DOWN 2}")

Send("!n")

Send("{DOWN 21}")

Send("{TAB}")

Send("\\cmhimg01\images")

Send("{TAB}")

Send("cmh\")

Sleep(500)

Send($username)

Send("{TAB}")

Sleep(500)

Send($pword)

Send("{TAB}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ALTDOWN}")

Send("{F4}")

Send("{ALTUP}")

WinWaitActive("PE Network Configurator", "Network Identification")

Send("{TAB 4}")

Send("{ENTER}")

#endregion

;Launch Ghost

#region

Send("{LWINDOWN}")

Send("d")

Send("{LWINUP}")

Send("!m")

Sleep(5000)

Send("!m")

Send("{DOWN}")

Send("{ENTER}")

Send("{DOWN 6}")

Send("{ENTER}")

Send("{ENTER}")

WinWaitActive("Ghost32 8.3")

Send("{ENTER}")

#endregion

;launch OptiPlex 755 Image

#region

#endregion

EndFunc ;==>ITEM_1

thanks again...

uncle fishy ;)

Share this post


Link to post
Share on other sites

GUICtrlRead($username) and GUICtrlRead($pword)

Share this post


Link to post
Share on other sites

Thanks Richard!!

that will do it ;)

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  
Followers 0