Hi, I am having some issue with my code. I am going through attachmate since this is the application my coworkers and I use the most. This is the last piece of the puzzle (apart from exporting some of the results to excel) for this code and I am at a loss here. It will give me syntax if I put parenthesis around Until and an error code saying it doesnt recognize whats going on on line 54 (highlighted) if I exclude the parenthesis. Any help is appreciated. Here is my code:
Code:
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim n As Integer
n = 6
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 3000 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
' This section of code contains the recorded events
[highlight #FCE94F] Do Until Sessions.WaitForString("NO PART SELECTED", 23, 2, 16)[/highlight]
Sess0.Screen.Sendkeys("<Clear>/for ESEOU04<Enter>1q<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
If n = 23 Then
Sess0.Screen.Sendkeys("<Enter>")
n = 6 'resets integer
Sess0.Screen.Area(n, 9, n, 16).select
Sess0.Screen.Area(n, 9, n, 16).copy
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.MoveTo 3, 15
Sess0.Screen.Paste
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Exit Do
Else
Sess0.Screen.Area(n, 9, n, 16).select
Sess0.Screen.Area(n, 9, n, 16).copy
Sess0.Screen.Sendkeys("<Pf5>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.MoveTo 3, 15
Sess0.Screen.Paste
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Exit Do
End If
If Found1st Then
Found = Sessions.WaitForString("", 10, 74)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.MoveTo 4, 15
Sess0.Screen.Sendkeys(" ") 'removed c for testing
Sess0.Screen.Area(10, 74, 10, 75).select
Sess0.Screen.Area(10, 74, 10, 75).copy
Sess0.Screen.MoveTo 5, 15
Sess0.Screen.Paste
Sess0.Screen.Area(11, 73, 11, 80).select
Sess0.Screen.Area(11, 73, 11, 80).copy
Sess0.Screen.MoveTo 6, 15
Sess0.Screen.Paste
Sess0.Screen.MoveTo 12, 15
Sess0.Screen.Sendkeys("n")
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.Sendkeys("<Enter>")
ElseIf Found2nd Then
Found = Sessions.WaitForString("N", 10, 74)
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.MoveTo 4, 15
Sess0.Screen.Sendkeys(" ") 'removed c for testing
Sess0.Screen.Area(10, 74, 10, 75).select
Sess0.Screen.Area(10, 74, 10, 75).copy
Sess0.Screen.MoveTo 5, 15
Sess0.Screen.Paste
Sess0.Screen.Area(11, 73, 11, 80).select
Sess0.Screen.Area(11, 73, 11, 80).copy
Sess0.Screen.MoveTo 6, 15
Sess0.Screen.Paste
Sess0.Screen.MoveTo 12, 15
Sess0.Screen.Sendkeys("n")
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.Sendkeys("<Enter>")
Else
n = n + 1
End If
Loop
System.TimeoutValue = OldSystemTimeout
End Sub