Jump to content

Send Key Issue


Joel
 Share

Recommended Posts

Okay, my issue is that the script below works flawlessly on my version of windows 2000. When testing this out on a different machine (different win2k image), it does not work. What happens is this:

The script works fine and brings up the GUI interface with the two tabs. After inputing the configuration information and creating the INI file, I then go to the first tab and start the "Session 1 Fix" button.

It goes this far into the code before it goes to pause:

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.

After this it just sits at this window on the other win2k machine. When I go to the bottom right taskbar it shows the script is paused.

I've tried alternating send key to raw by placing the , 1 after send but this borks up the entire script. So, the script below works flawlessly on my win2k machine but not the other one. Any ideas?

Here is the full code so you can see where it's going:

; ----------------------------------------------------------------------------
;
; 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", 450, 250); will create a dialog box that when displayed is centered
GuiSetBkColor (0x00E0FFFF)
GUISetFont (9, 300)
;First Tab
$tab = GUICtrlCreateTab (0, 0, 450, 250)
$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)
GUICtrlCreateLabel ("Before running the session fixes, please read the help file located under help.", 25, 50, 200, 50)
$button_1 = GUICtrlCreateButton ("FIX Session 1", 25, 120, 110, 20)
$button_2 = GUICtrlCreateButton ("FIX Session 2", 150, 120, 110, 20)
$button_3 = GUICtrlCreateButton ("FIX Session 3", 25, 150, 110, 20)
$button_4 = GUICtrlCreateButton ("FIX Session 4", 150, 150, 110, 20)
;Second Tab
$tab1 = GUICtrlCreateTabitem ("Configure Wizard")
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)
GUICtrlCreateLabel ("Click the directory and select the default directory that the EXTRA.exe application resides in.", 220, 80, 200, 50)
$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", 15, 193, 70, 20)
$button_5 = GUICtrlCreateButton ("Directory", 260, 130, 85, 20)
$resource1 = GUICtrlCreateInput ("", 220, 165, 100, 20)
GUICtrlCreateLabel ("Input the resource name or host alias into the field above and click submit.", 220, 188, 220, 50)
$button_7 = GUICtrlCreateButton ("SUBMIT", 326, 165, 70, 20)
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 = $button_6 Then writeinfo();
   If $msg = $button_7 Then writeinfo1();
   If $msg = $helpitem Then Run(@ComSpec & " /c start " & "wizard.chm")
Wend

Func writeinfo1()
    IniWrite("sessions.ini", "host", "alias", GuiCtrlRead($resource1))
    MsgBox(0, "Configuration Complete", "Your resource/host information has been saved.", 8);
EndFunc

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 session/node 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)
   MsgBox(0, "Configuration Complete", "Your directory information has been saved.", 8);
EndFunc ;==>storeinfo

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

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(7000);Pausing a bit.
 ;About to save the session.
 ;Waiting for Connected to host in Status Bar Text to come up.
   _Send("{ALT}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("{ALT}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(7000);Pausing a bit.
 ;About to save the session.
 ;Waiting for Connected to host in Status Bar Text to come up.
   _Send("{ALT}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("{ALT}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(7000);Pausing a bit.
 ;About to save the session.
 ;Waiting for Connected to host in Status Bar Text to come up.
   _Send("{ALT}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("{ALT}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(7000);Pausing a bit.
 ;About to save the session.
 ;Waiting for Connected to host in Status Bar Text to come up.
   _Send("{ALT}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("{ALT}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]

Link to comment
Share on other sites

Bumping so it doesn't get lost in the shuffle.

Anyone have an answer as to why the send function works on one windows 2000 machine and not another?

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

Link to comment
Share on other sites

Still no resolution.

What would be enabled/disabled on a win2k machine that would cause the send function to not work?

We have two system types for win2k here. For the dell systems, it works fine and for the hp/compaq systems, it does not. I'd like to find out what could be causing issues with the send function since the operating system and the program in use are exactly the same, but the systems are different.

Any ideas?

Maybe third post is the charm.

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

Link to comment
Share on other sites

could you post a Much shorter script that shows the problem? and test it to make sure...

Lar.

<{POST_SNAPBACK}>

Larry,

I believe the issue may be win2k related and not autoit related but I'm just using logical conclusion.

The full script works perfect on my Dell win2k machine. In fact, I have a lot of failsafes in now and everything is working great. The problem occurs when I go to another win2k machine that is hp/compaq. The script works great on that machine until it gets to the macro directing functions. here's a function below:

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")
   _process(); This simply checks to see if the EXTRA.exe process is running. If so, it says to close it.
   _checkdir($directory); This simply checks to see if the directory has been noted.
   _checkalias($host); This checks to see that alias/host/IP info has been submitted.
   _checksess();This checks to see if a valid session configuration exists.
   _check($session1);This duplicates a check on the session to see if it's properly named.
   _file(); This checks to make sure that a sessions.ini file is found.
   MsgBox(0, "Creating New Session", "A new session will now be created. Please do not move your mouse or touch" & @CRLF & "your keyboard during this process. Once this process is finished, you will" & @CRLF & "be notified that it's completed.", 10)
   Run($directory & "\EXTRA.exe");Running the new command.
   WinWaitActive("EXTRA! Personal Client");Waiting for the create new session box to appear.
;HERE IS WHERE THE ERROR OCCURS, ONLY NO ERROR. IT SIMPLY PAUSES THE SCRIPT ON THE OFFENDING WIN2K MACHINES.
   _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(7000);Pausing a bit.
  ;About to save the session.
  ;Waiting for Connected to host in Status Bar Text to come up.
   _Send("{ALT}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("{ALT}fe");Ending the program.
   _Send("{ENTER}{ENTER}");
   MsgBox(0, "Session Repaired", "Your session has been successfully recreated.", 8)
  ;End Session One
EndFunc  ;==>session1

;This is the send function
Func _Send($text)
   Sleep(500);Pausing a bit.
   Send($text)
EndFunc  ;==>_Send

I've noted what each thing does above.

Again, what is occurring is that the script simply pauses on certain win2k machines when it goes to the first send.

The winwaitactive waits for the first box to come up which has the OK button highlighted. So, the first enter on send should push the OK button. In the case of the win2k machines having problems, it's almost like either the window isn't active or it's not pushing the enter. Instead, it pauses the script.

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

Link to comment
Share on other sites

Bah I figured it out by posting it and diagnosing it as I posted.

The other win2k machines were using a slightly different version of EXTRA.exe which had a different window identifier name as the first one.

So, it was the window identifier on the winwaitactive that was causing the problem.

Thanks everyone.

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

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