Jump to content
Sign in to follow this  
Joel

GUI assistance needed

Recommended Posts

Hi folks.

Before I post this, I had the first portion of the script working flawlessly. Here's what I want it to do.

We have people who use mainframe nodes that sometimes go corrupt. I am creating an application that will rebuild the nodes when they become corrupt. There are two parts to the application.

The first part involves 4 session fix buttons. They fix the sessions through standard move and react sequences and base some of the information from reading the sessions.ini.

The second part involves creating the configuration settings. There are two parts to this also, part a and part b. Part "a" looks for the application directory to the mainframe macro app. It then records this in the sessions.ini, and creates a label in the second gui window.

Part "B" has 4 gui input lines where the resource node information is placed and then upon submitting, should record these to the .ini file.

Here is the code:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win2K
; Author:         ME
;
; Script Function:
;    TN3270 Session Repair Utility
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>
#include <file.au3>
GUICreate ("Session Wizard", 292, 120); will create a dialog box that when displayed is centered
GuiSetBkColor (0x00E0FFFF)
GUISetFont (9, 300)
;First Tab
$tab = GUICtrlCreateTab (0, 0, 292, 120)
$tab0 = GUICtrlCreateTabitem ("Fix Sessions")
Global $defaultstatus = "Ready"
Global $status
$filemenu = GUICtrlCreateMenu ("&File")
$helpmenu = GUICtrlCreateMenu ("&Help")
$helpitem = GUICtrlCreateMenuitem ("Using the Wizard", $helpmenu)
$infoitem = GUICtrlCreateMenuitem ("Version", $filemenu)
$separator1 = GUICtrlCreateMenuitem ("", $filemenu, 2)  ; create a separator line
$exititem = GUICtrlCreateMenuitem ("Exit", $filemenu)
Opt ("GUICoordMode", 1)
$button_1 = GUICtrlCreateButton ("SESSION1", 45, 30, 90)
$button_2 = GUICtrlCreateButton ("SESSION2", 155, 30, 90)
$button_3 = GUICtrlCreateButton ("SESSION3", 45, 60, 90)
$button_4 = GUICtrlCreateButton ("SESSION4", 155, 60, 90)
;Second Tab
$tab1 = GUICtrlCreateTabitem ("Configure Wizard")
GUICtrlCreateLabel ("Click help before configuring.", 57, 33, 190, 20)
$button_5 = GUICtrlCreateButton ("Configure Now", 90, 60, 95)
GUISetState ()      ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
   $msg = GUIGetMsg ()
   
   If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
   If $msg = $infoitem Then MsgBox(0, "About Session Wizard", "Version 1.0 - Created by Joel")
   If $msg = $button_1 Then session1();
   If $msg = $button_2 Then session2();
   If $msg = $button_3 Then session3();
   If $msg = $button_4 Then session4();
   If $msg = $button_5 Then storeinfo();
   If $msg = $helpitem Then Run(@ComSpec & " /c start " & "wizard.chm")
Wend

Func writeinfo()
   IniWrite("sessions.ini", "sessions", "resource1", $sess1info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess2info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess3info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess4info)
   MsgBox(0, "Configuration Complete", "Your configuration information has been saved.", 8);
   
EndFunc  ;==>writeinfo

Func storeinfo()
   $folder = FileSelectFolder("Choose the folder which contains the EXTRA.exe application..", "")
   IniWrite("sessions.ini", "directory", "root", $folder)
   GUICreate ("Configuration Information", 450, 200); will create a dialog box that when displayed is centered
   GuiSetBkColor (0x00E0FFFF)
   GUISetFont (9, 300)
   GUICtrlCreateLabel ("Extra application located at " & $folder, 5, 5, 440, 20)
   GUICtrlCreateLabel ("Input the resource information for each node on the computer. If no node information exists for a particular node, place a 0 in the line. After finishing, click submit.", 5, 35, 440, 50)
   $sess1info = GUICtrlCreateInput ("", 5, 90, 90, 20)
   GUICtrlCreateLabel ("Session 1 Node", 100, 90, 90)
   $sess2info = GUICtrlCreateInput ("", 5, 115, 90, 20)
   GUICtrlCreateLabel ("Session 2 Node", 100, 115, 90)
   $sess3info = GUICtrlCreateInput ("", 5, 140, 90, 20)
   GUICtrlCreateLabel ("Session 3 Node", 100, 140, 90)
   $sess4info = GUICtrlCreateInput ("", 5, 165, 90, 20)
   GUICtrlCreateLabel ("Session 4 Node", 100, 165, 90)
   $button_6 = GUICtrlCreateButton ("SUBMIT", 220, 122, 70)
   GUISetState ()
   While 1
      $msg = GUIGetMsg ()
      If $msg = $button_6 Then writeinfo()
   Wend
EndFunc  ;==>storeinfo

Func session1()
  ;Session One
   Dim $session1 = IniRead("sessions.ini", "sessions", "resource1", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   Send("{ENTER}");To click okay to create a new session.
   Sleep(500);Pausing a bit
   Send("{ENTER}");To click next for the Display.
   Send("{DOWN 2}");Send down arrow twice for TN3270.
   Sleep(500);Pausing a bit.
   Send("{ENTER}");To click next.
   Send("{TAB}");Tab to select "Add"
   Send("{SPACE}");Space to open up the add box.
   Sleep(500);Pausing a bit.
   Send($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   Send("{TAB 7}");To select the General tab.
   Sleep(500);Pausing a bit.
   Send("{RIGHT}");To select the Advanced tab.
   Sleep(500);Pausing a bit.
   Send("{TAB 9}");To select the resource device name input box.
   Sleep(500);Pausing a bit.
   Send($session1);To enter the node.
   Send("{TAB 5}{ENTER}");To select next and hit enter.
   Sleep(500);Pausing a bit.
   Send("{ENTER 2}");To send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   Send("!f");Selecting File
   Send("{DOWN 3}");Sending down three times to select Save session as..
   Sleep(500);Pausing a bit.
   Send("{ENTER}");Sending enter to save session as..
   Sleep(500);Pausing a bit.
   Send("session1{ENTER}");Sending the file name and accepting.
   Sleep(500);Pausing a bit.
   Send("{LEFT}{ENTER}");Sending confirmation for yes and enter.
   Sleep(500);Pausing a bit.
   Send("!fe");Ending the program.
   Sleep(500);Pausing a bit.
   Send("{ENTER}{ENTER}");
  ;End Session One
EndFunc  ;==>session1

Func session2()
  ;Session Two
   Dim $session2 = IniRead("sessions.ini", "sessions", "resource2", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   Send("{ENTER}");To click okay to create a new session.
   Sleep(500);Pausing a bit
   Send("{ENTER}");To click next for the Display.
   Send("{DOWN 2}");Send down arrow twice for TN3270.
   Sleep(500);Pausing a bit.
   Send("{ENTER}");To click next.
   Send("{TAB}");Tab to select "Add"
   Send("{SPACE}");Space to open up the add box.
   Sleep(500);Pausing a bit.
   Send($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   Send("{TAB 7}");To select the General tab.
   Sleep(500);Pausing a bit.
   Send("{RIGHT}");To select the Advanced tab.
   Sleep(500);Pausing a bit.
   Send("{TAB 9}");To select the resource device name input box.
   Sleep(500);Pausing a bit.
   Send($session2);To enter the node.
   Send("{TAB 5}{ENTER}");To select next and hit enter.
   Sleep(500);Pausing a bit.
   Send("{ENTER 2}");To send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   Send("!f");Selecting File
   Send("{DOWN 3}");Sending down three times to select Save session as..
   Sleep(500);Pausing a bit.
   Send("{ENTER}");Sending enter to save session as..
   Sleep(500);Pausing a bit.
   Send("session2{ENTER}");Sending the file name and accepting.
   Sleep(500);Pausing a bit.
   Send("{LEFT}{ENTER}");Sending confirmation for yes and enter.
   Sleep(500);Pausing a bit.
   Send("!fe");Ending the program.
   Sleep(500);Pausing a bit.
   Send("{ENTER}{ENTER}");
  ;End Session Two
EndFunc  ;==>session2

Func session3()
  ;Session Three
   Dim $session3 = IniRead("sessions.ini", "sessions", "resource3", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   Send("{ENTER}");To click okay to create a new session.
   Sleep(500);Pausing a bit
   Send("{ENTER}");To click next for the Display.
   Send("{DOWN 2}");Send down arrow twice for TN3270.
   Sleep(500);Pausing a bit.
   Send("{ENTER}");To click next.
   Send("{TAB}");Tab to select "Add"
   Send("{SPACE}");Space to open up the add box.
   Sleep(500);Pausing a bit.
   Send($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   Send("{TAB 7}");To select the General tab.
   Sleep(500);Pausing a bit.
   Send("{RIGHT}");To select the Advanced tab.
   Sleep(500);Pausing a bit.
   Send("{TAB 9}");To select the resource device name input box.
   Sleep(500);Pausing a bit.
   Send($session3);To enter the node.
   Send("{TAB 5}{ENTER}");To select next and hit enter.
   Sleep(500);Pausing a bit.
   Send("{ENTER 2}");To send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   Send("!f");Selecting File
   Send("{DOWN 3}");Sending down three times to select Save session as..
   Sleep(500);Pausing a bit.
   Send("{ENTER}");Sending enter to save session as..
   Sleep(500);Pausing a bit.
   Send("session3{ENTER}");Sending the file name and accepting.
   Sleep(500);Pausing a bit.
   Send("{LEFT}{ENTER}");Sending confirmation for yes and enter.
   Sleep(500);Pausing a bit.
   Send("!fe");Ending the program.
   Sleep(500);Pausing a bit.
   Send("{ENTER}{ENTER}");
  ;End Session Three
EndFunc  ;==>session3

Func session4()
  ;Session Four
   Dim $session4 = IniRead("sessions.ini", "sessions", "resource4", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   Send("{ENTER}");To click okay to create a new session.
   Sleep(500);Pausing a bit
   Send("{ENTER}");To click next for the Display.
   Send("{DOWN 2}");Send down arrow twice for TN3270.
   Sleep(500);Pausing a bit.
   Send("{ENTER}");To click next.
   Send("{TAB}");Tab to select "Add"
   Send("{SPACE}");Space to open up the add box.
   Sleep(500);Pausing a bit.
   Send($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   Send("{TAB 7}");To select the General tab.
   Sleep(500);Pausing a bit.
   Send("{RIGHT}");To select the Advanced tab.
   Sleep(500);Pausing a bit.
   Send("{TAB 9}");To select the resource device name input box.
   Sleep(500);Pausing a bit.
   Send($session4);To enter the node.
   Send("{TAB 5}{ENTER}");To select next and hit enter.
   Sleep(500);Pausing a bit.
   Send("{ENTER 2}");To send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   Send("!f");Selecting File
   Send("{DOWN 3}");Sending down three times to select Save session as..
   Sleep(500);Pausing a bit.
   Send("{ENTER}");Sending enter to save session as..
   Sleep(500);Pausing a bit.
   Send("session4{ENTER}");Sending the file name and accepting.
   Sleep(500);Pausing a bit.
   Send("{LEFT}{ENTER}");Sending confirmation for yes and enter.
   Sleep(500);Pausing a bit.
   Send("!fe");Ending the program.
   Sleep(500);Pausing a bit.
   Send("{ENTER}{ENTER}");
  ;End Session Four
EndFunc  ;==>session4

If you try it out, you will find that the first gui window doesn't have any problems, it's when you go to the second tab and hit "configure" that the problems begin.

I could use some help and advice on this.

Thanks,

Edited by Joel

[font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font]

Share this post


Link to post
Share on other sites

Class is over, but before I leave I have to say this:

Func _Send($text)
   Sleep(500);Pausing a bit.
   Send($text)
EndFunc

That'll probably shave off about 50 lines of code :)


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

Thanks for the tip mate.

I still need help with the rest of the code. Replacing with the tip you gave me to shorten the code.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:    English
; Platform:    Win2K
; Author:        ME
;
; Script Function:
;   TN3270 Session Repair Utility
;
; ----------------------------------------------------------------------------

#include <GUIConstants.au3>
#include <file.au3>
GUICreate ("Session Wizard", 292, 120) ; will create a dialog box that when displayed is centered
GuiSetBkColor (0x00E0FFFF)
GUISetFont (9, 300)
;First Tab
$tab = GUICtrlCreateTab (0, 0, 292, 120)
$tab0 = GUICtrlCreateTabitem ("Fix Sessions")
Global $defaultstatus = "Ready"
Global $status
$filemenu = GUICtrlCreateMenu ("&File")
$helpmenu = GUICtrlCreateMenu ("&Help")
$helpitem = GUICtrlCreateMenuitem ("Using the Wizard", $helpmenu)
$infoitem = GUICtrlCreateMenuitem ("Version", $filemenu)
$separator1 = GUICtrlCreateMenuitem ("", $filemenu, 2)   ; create a separator line
$exititem = GUICtrlCreateMenuitem ("Exit", $filemenu)
Opt ("GUICoordMode", 1)
$button_1 = GUICtrlCreateButton ("SESSION1", 45, 30, 90)
$button_2 = GUICtrlCreateButton ("SESSION2", 155, 30, 90)
$button_3 = GUICtrlCreateButton ("SESSION3", 45, 60, 90)
$button_4 = GUICtrlCreateButton ("SESSION4", 155, 60, 90)
;Second Tab
$tab1 = GUICtrlCreateTabitem ("Configure Wizard")
GUICtrlCreateLabel ("Click help before configuring.", 57, 33, 190, 20)
$button_5 = GUICtrlCreateButton ("Configure Now", 90, 60, 95)
GUISetState ()    ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
   $msg = GUIGetMsg ()
   
   If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop
   If $msg = $infoitem Then MsgBox(0, "About Session Wizard", "Version 1.0 - Created by Joel")
   If $msg = $button_1 Then session1();
   If $msg = $button_2 Then session2();
   If $msg = $button_3 Then session3();
   If $msg = $button_4 Then session4();
   If $msg = $button_5 Then storeinfo();
   If $msg = $helpitem Then Run(@ComSpec & " /c start " & "wizard.chm")
Wend

Func writeinfo()
   IniWrite("sessions.ini", "sessions", "resource1", $sess1info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess2info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess3info)
   IniWrite("sessions.ini", "sessions", "resource1", $sess4info)
   MsgBox(0, "Configuration Complete", "Your configuration information has been saved.", 8);
   
EndFunc  ;==>writeinfo

Func storeinfo()
   $folder = FileSelectFolder("Choose the folder which contains the EXTRA.exe application..", "")
   IniWrite("sessions.ini", "directory", "root", $folder)
   GUICreate ("Configuration Information", 450, 200) ; will create a dialog box that when displayed is centered
   GuiSetBkColor (0x00E0FFFF)
   GUISetFont (9, 300)
   GUICtrlCreateLabel ("Extra application located at " & $folder, 5, 5, 440, 20)
   GUICtrlCreateLabel ("Input the resource information for each node on the computer. If no node information exists for a particular node, place a 0 in the line. After finishing, click submit.", 5, 35, 440, 50)
   $sess1info = GUICtrlCreateInput ("", 5, 90, 90, 20)
   GUICtrlCreateLabel ("Session 1 Node", 100, 90, 90)
   $sess2info = GUICtrlCreateInput ("", 5, 115, 90, 20)
   GUICtrlCreateLabel ("Session 2 Node", 100, 115, 90)
   $sess3info = GUICtrlCreateInput ("", 5, 140, 90, 20)
   GUICtrlCreateLabel ("Session 3 Node", 100, 140, 90)
   $sess4info = GUICtrlCreateInput ("", 5, 165, 90, 20)
   GUICtrlCreateLabel ("Session 4 Node", 100, 165, 90)
   $button_6 = GUICtrlCreateButton ("SUBMIT", 220, 122, 70)
   GUISetState ()
   While 1
      $msg = GUIGetMsg ()
      If $msg = $button_6 Then writeinfo()
   Wend
EndFunc  ;==>storeinfo

Func _Send($text)
   Sleep(500);Pausing a bit.
   _Send ($text)
EndFunc  ;==>__Send

Func session1()
  ;Session One
   Dim $session1 = IniRead("sessions.ini", "sessions", "resource1", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   _Send ("{ENTER}");To click okay to create a new session.
   _Send ("{ENTER}");To click next for the Display.
   _Send ("{DOWN 2}");_Send down arrow twice for TN3270.
   _Send ("{ENTER}");To click next.
   _Send ("{TAB}");Tab to select "Add"
   _Send ("{SPACE}");Space to open up the add box.
   _Send ($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   _Send ("{TAB 7}");To select the General tab.
   _Send ("{RIGHT}");To select the Advanced tab.
   _Send ("{TAB 9}");To select the resource device name input box.
   _Send ($session1);To enter the node.
   _Send ("{TAB 5}{ENTER}");To select next and hit enter.
   _Send ("{ENTER 2}");To _Send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   _Send ("!f");Selecting File
   _Send ("{DOWN 3}");_Sending down three times to select Save session as..
   _Send ("{ENTER}");_Sending enter to save session as..
   _Send ("session1{ENTER}");_Sending the file name and accepting.
   _Send ("{LEFT}{ENTER}");_Sending confirmation for yes and enter.
   _Send ("!fe");Ending the program.
   _Send ("{ENTER}{ENTER}");
  ;End Session One
EndFunc  ;==>session1

Func session2()
  ;Session Two
   Dim $session2 = IniRead("sessions.ini", "sessions", "resource2", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   _Send ("{ENTER}");To click okay to create a new session.
   _Send ("{ENTER}");To click next for the Display.
   _Send ("{DOWN 2}");_Send down arrow twice for TN3270.
   _Send ("{ENTER}");To click next.
   _Send ("{TAB}");Tab to select "Add"
   _Send ("{SPACE}");Space to open up the add box.
   _Send ($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   _Send ("{TAB 7}");To select the General tab.
   _Send ("{RIGHT}");To select the Advanced tab.
   _Send ("{TAB 9}");To select the resource device name input box.
   _Send ($session2);To enter the node.
   _Send ("{TAB 5}{ENTER}");To select next and hit enter.
   _Send ("{ENTER 2}");To _Send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   _Send ("!f");Selecting File
   _Send ("{DOWN 3}");_Sending down three times to select Save session as..
   _Send ("{ENTER}");_Sending enter to save session as..
   _Send ("session2{ENTER}");_Sending the file name and accepting.
   _Send ("{LEFT}{ENTER}");_Sending confirmation for yes and enter.
   _Send ("!fe");Ending the program.
   _Send ("{ENTER}{ENTER}");
  ;End Session Two
EndFunc  ;==>session2

Func session3()
  ;Session Three
   Dim $session3 = IniRead("sessions.ini", "sessions", "resource3", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   _Send ("{ENTER}");To click okay to create a new session.
   _Send ("{ENTER}");To click next for the Display.
   _Send ("{DOWN 2}");_Send down arrow twice for TN3270.
   _Send ("{ENTER}");To click next.
   _Send ("{TAB}");Tab to select "Add"
   _Send ("{SPACE}");Space to open up the add box.
   _Send ($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   _Send ("{TAB 7}");To select the General tab.
   _Send ("{RIGHT}");To select the Advanced tab.
   _Send ("{TAB 9}");To select the resource device name input box.
   _Send ($session3);To enter the node.
   _Send ("{TAB 5}{ENTER}");To select next and hit enter.
   _Send ("{ENTER 2}");To _Send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   _Send ("!f");Selecting File
   _Send ("{DOWN 3}");_Sending down three times to select Save session as..
   _Send ("{ENTER}");_Sending enter to save session as..
   _Send ("session3{ENTER}");_Sending the file name and accepting.
   _Send ("{LEFT}{ENTER}");_Sending confirmation for yes and enter.
   _Send ("!fe");Ending the program.
   _Send ("{ENTER}{ENTER}");
  ;End Session Three
EndFunc  ;==>session3

Func session4()
  ;Session Four
   Dim $session4 = IniRead("sessions.ini", "sessions", "resource4", "NotFound")
   Dim $host = IniRead("sessions.ini", "host", "alias", "NotFound")
   Dim $directory = IniRead("sessions.ini", "directory", "root", "NotFound")
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
   _Send ("{ENTER}");To click okay to create a new session.
   _Send ("{ENTER}");To click next for the Display.
   _Send ("{DOWN 2}");_Send down arrow twice for TN3270.
   _Send ("{ENTER}");To click next.
   _Send ("{TAB}");Tab to select "Add"
   _Send ("{SPACE}");Space to open up the add box.
   _Send ($host & "{ENTER}"); Inputing Host Alias/IP address and clicking OK.
   _Send ("{TAB 7}");To select the General tab.
   _Send ("{RIGHT}");To select the Advanced tab.
   _Send ("{TAB 9}");To select the resource device name input box.
   _Send ($session4);To enter the node.
   _Send ("{TAB 5}{ENTER}");To select next and hit enter.
   _Send ("{ENTER 2}");To _Send enter twice.
   Sleep(6000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   _Send ("!f");Selecting File
   _Send ("{DOWN 3}");_Sending down three times to select Save session as..
   _Send ("{ENTER}");_Sending enter to save session as..
   _Send ("session4{ENTER}");_Sending the file name and accepting.
   _Send ("{LEFT}{ENTER}");_Sending confirmation for yes and enter.
   _Send ("!fe");Ending the program.
   _Send ("{ENTER}{ENTER}");
  ;End Session Four
EndFunc  ;==>session4

[font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font]

Share this post


Link to post
Share on other sites

I fixed it.

I removed the second gui creation and just enlarged the first application, placing the configuration info on the second page.

Then to fix the ini values I changed the code to this:

Func writeinfo()
   IniWrite("sessions.ini", "sessions", "resource1", GuiCtrlRead($sess1info))
   IniWrite("sessions.ini", "sessions", "resource2", GuiCtrlRead($sess2info))
   IniWrite("sessions.ini", "sessions", "resource3", GuiCtrlRead($sess3info))
   IniWrite("sessions.ini", "sessions", "resource4", GuiCtrlRead($sess4info))
   MsgBox(0, "Configuration Complete", "Your configuration information has been saved.", 8);
   
EndFunc ;==>writeinfo

The old code did not have the GuiCtrlRead statements in the code. So, it was just reading the control id number rather than the input values..


[font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font]

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...