Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptHi,
I've had similar timing issues in the past and got around them by not having ENTER at the end of my string, using EMWaitForCurSor after sending the keys to get to the position of the end of username, then sending the ENTER. In extreme cases I've had to loop through the characters of the string waiting for the cursor postion after sending each one. My issues seem to be related to using Rumba over an old version of Citrix though.
hope this helps.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptThat didn't seem to change anything as far as the input of credentials is concerned. Even worse, when the credentials are entered correctly the terminal seems to hang before the menu appears. I spoke to my boss and he seems to think it has something to do with the script running synchronously instead of asynchronously.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptDoes your AS400 prompt separately for Username and Password? Your comments say TAB to password field, but you send an "<ENTER>" with EMSendKey. That will cause a transmission to the host before the password is entered. If you want to send both Username and Password on the same screen use "<TAB>" to position to the next field.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptDoes your AS400 prompt separately for Username and Password? Your comments say TAB to password field, but you send an "<ENTER>" with EMSendKey. That will cause a transmission to the host before the password is entered. If you want to send both Username and Password on the same screen use "<TAB>" to position to the next field.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptDoes your AS400 prompt separately for Username and Password? Your comments say TAB to password field, but you send an "<ENTER>" with EMSendKey. That will cause a transmission to the host before the password is entered. If you want to send both Username and Password on the same screen use "<TAB>" to position to the next field.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptThose comments are leftover from some old scripts. Just in case, I tried <TAB> instead of <ENTER> right after entering the username, but it doesn't look like <TAB> moves the cursor to the next field.
Hi,
I have been trying to write a script to connect to a host on my network. For some reason, the script sometimes hangs before the word "Username:" appears on the screen, and when it doesn't, it sometimes fails to enter the username correctly (i.e. there are missing letters in the beginning or middle). The rest of the time, not very frequently, it succeeds in entering the credentials only to hang anyway.
Is there something wrong with my script?
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "IBUATUSERFF1"
UserPassword = "IBUATUSERFF1"
' Does 2 or 5 matter? Seems to produce the same result.
EMSetTN5250 "Ariell", 23, 2, "COLOR" ' Set host connection
'EMSetTN5250 "Ariell", 23, 5, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "Username:" , 1 , 17 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
EMSendKey UserName & "<ENTER>" ' Enter UserID and Tab to password field
'EMWaitCursor 30 , 1 , 19 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection:" , 1 , 22 , Row , Column ' Wait for command line prompt
'EMWaitCursor 30 , 1 , 17 ' Wait for cursor
End Sub
#Rumba#ScriptThe posted script is generally working.I had to adjust the cursor positions for EMWaitCursor and EMWaitText then it worked very smooth.
Your hard coded username has 12 characters, 12 chars causes problems with my AS/400.I have a max length of 10 chars.Entering a longer password will line break into the password field.
<code>
Sub Main
Dim Row As Integer ' Screen Row
Dim Column As Integer ' Screen Column
Dim UserName As String ' String to hold User ID
Dim UserPassword As String ' String to hold user password
'DlgStart
'DlgItemAsk "UserName :" , UserName ,1, 10
'DlgItemAskQuiet "Password :" , UserPassword ,2, 10
'DlgInquire
'DlgGetItemValue 1 , UserName
'DlgGetItemValue 2 , UserPassword
'DlgEnd
SysHide "Timer"
UserName = "user1"
UserPassword = "user1pwd"
EMSetTN5250 "127.0.0.1", 23, 2, "COLOR" ' Set host connection
EMStartSession "*", "My5250" ' Connect to host
EMWaitText 30 , "User" , 6 , 17 , Row , Column ' Wait for command line prompt
EMWaitCursor 30 , 6 , 53 ' Wait for cursor
EMSendKey UserName & "<TAB>" ' Enter UserID and Tab to password field
EMWaitCursor 30 , 7 , 53 ' Wait for cursor
EMSendKey UserPassword & "<ENTER>" ' Enter Password and Enter Key
EMWaitText 30 , "Selection" , 19 , 2 , Row , Column ' Wait for command line prompt
EMWaitCursor 30 , 20, 7 ' Wait for cursor
End Sub
</code>