Jump to content

Help building a GUI


big_daddy
 Share

Recommended Posts

  • Moderators

I've been working on some scripts that will automate the installation of several programs that we use. On a lot of these installations the setup of the software is PC or user specific. Therefore I need a way to ask for information during the install to allow for these different setups. Here is an example:

We have a piece of software called iSeries Client Access that we use to connect to our AS/400 server. The differences in the installs are if you are a Teller you get a regular session and a print session. Otherwise you get session1 and session2. Also you have to specify a workstation ID which we use the first part of the computer name along with S1 or S2.

This is what I have so far:

#include <GUIConstants.au3>

;This is the program to configure a session
Run("C:\Program Files\IBM\Client Access\Emulator\pcsfe.exe")
WinWaitActive("IBM Personal Communications  -  Session Manager")
;It opens half off the screen so I move and resize it
WinMove("IBM Personal Communications  -  Session Manager", "", 450, 100, 341, 412) 
;The easiest way I could find to open an explorer window
Run("cmd")
WinWaitActive("It wouldn't let me post with this here???") 
Send("start c:\")
Send("{Enter}")
Sleep(500)
WinClose("It wouldn't let me post with this here???")
WinWaitActive("C:\")
WinMove("C:\", "", 7, 8, 332, 581)
Sleep(200)
Send("{Tab}")
;This opens so I can create the shortcuts to the sessions in the All Users\Desktop folder
Send("C:\Documents and Settings\All Users\Desktop") 
Send("{Enter}")
WinActivate("IBM Personal Communications  -  Session Manager")
;Opens the new session setup window
Send("!n")  
WinWaitActive("Configure PC5250")
;Creates GUI for workstation info
$Form1 = GUICreate("", 322, 202)
$Group1 = GUICtrlCreateGroup("Session Setup Info", 0, 0, 321, 201)
$Button1 = GUICtrlCreateButton("OK", 120, 152, 75, 25)
$Checkbox1 = GUICtrlCreateCheckbox("If this is a Teller PC check the box", 72, 112, 193, 17)
$Input1 = GUICtrlCreateInput("", 96, 56, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Enter workstation name, do not include S1 or S2.", 48, 32, 235, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
    $Name = GUICtrlRead($Input1)
    $Type = GUICtrlGetState(5)
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button1
         Exit   
    Case $msg = $GUI_EVENT_CLOSE
         Exit
    Case $msg = $Input1
         ControlSend ( "Configure PC5250", "", 1015, $Name&"S1") 
         ControlClick ("Configure PC5250", "", 1026)
         ControlSend ("Configure PC5250", "", 1026, "{Down}" & "{Enter}")
         ControlClick ("Configure PC5250", "", 1)
         Sleep(2000)
         If WinExists ("User Authentication", "Use password authentication") Then
             Send("{Esc}")
         EndIf
         WinWaitActive ("Session A - [24 x 80]", "")
         WinMenuSelectItem("Session A - [24 x 80]", "", "&Edit", "Preference&s", "&Appearance", "&Window Setup")
         Send ("{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Tab}" & "{Space}" & "{Enter}")
         WinWaitActive ("Session A", "")
         WinMenuSelectItem("Session A", "", "&File", "Save &As")
         WinWaitActive ("Save WorkStation Profile as", "")
         Send ("Session3" & "{Enter}")
         WinWaitActive ("Session A", "")
         WinMenuSelectItem ("Session A", "", "&Communication", "Con&figure...")
         WinWaitActive ("Configure PC5250", "")
         Send ("{Tab}" & "{Tab}" & "{Tab}")
         ControlSend ( "Configure PC5250", "", 1015, $Name&"S2") 
         ControlClick ("Configure PC5250", "", 1)
         Sleep(2000)
         If WinExists ("User Authentication", "Use password authentication") Then
             Send("{Esc}")
         EndIf
         WinWaitActive ("Session A", "")
         WinMenuSelectItem("Session A", "", "&File", "Save &As")
         WinWaitActive ("Save WorkStation Profile as", "")
         Send ("Session4")
         Sleep(500) 
         Send ("{Enter}")
         WinClose ("Session A", "")
    EndSelect
WEnd
Exit

What I'm trying to accomplish is taking the workstation name that is entered and input that into a window Title: "Configure PC5250" Control ID: 1015 then add S1 on to the end of the workstation name. After that it will carry out a few more steps then needs to repeat the same process but this time with and S2 on the end of the workstation name. Unless the checkbox was checked then it would enter what is in the printer name box and use that instead.

If someone could get me going in the right direction with this I'd greatly appreciate it.

Edited by big_daddy
Link to comment
Share on other sites

  • Moderators

Okay, maybe I made this a little too complicated right off the bat?

First off can someone show me how I could take what was entered into $Input1 and append S1 to that, then put all that into a input in a window using its control ID when the OK button is pushed?

I've got this much, just don't know how to append the S1?:

Case $msg = $Input1
         ControlSend ( "Configure PC5250", "", 1015, $Name&"S1")

Nevermind on that one I figured it out on my own.

Edited by big_daddy
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...