Hi,
Is there a way to use this code in a function or header file that can be accessed by Main()?
What I'd like to do is only have the "formula" ...
Then access it from the Main() macro when needed, but the system generates errors. It wants MyTerminal, Sess0, System and the like declared. How would I get it to recognize that these are already open and declared in Main(). I won't say that this is a stupid question, but rather a "this guy just doesn't know" question. What am I missing?
unawares,
Is there a way to use this code in a function or header file that can be accessed by Main()?
Code:
Sub main()
Dim Sessions As Object
Dim System As Object
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
' 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)
'____________________________________
Dim Sys As Object, OPenSess As Object, MyTerminal As Object
Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
Sys.TimeoutValue = 850
Set OpenSess = Sys.ActiveSession
Set MyTerminal = OPenSess.Screen
[COLOR=purple]
MyTerminal.WaitHostQuiet(500)
NumRtrn=Trim(MyTerminal.GetString(14,72,2))
xLn=10
If NumRtrn = 1 then
MyTerminal.PutString "x", 15, 72
MyTerminal.WaitHostQuiet(500)
MyTerminal.SendKeys("<Enter>")
MyTerminal.WaitHostQuiet(500)
GetPer=MyTerminal.GetString(xLn, 21, 8)
ElseIf NumRtrn > 1 then
MyTerminal.PutString "x", 15, 72
MyTerminal.WaitHostQuiet(500)
MyTerminal.SendKeys("<Enter>")
MyTerminal.WaitHostQuiet(500)
For x=1 to NumRtrn
If xLn>10 then
GetPer=MyTerminal.GetString(xLn, 21, 8)
NewPer=NewPer & "/"
ElseIf xLn=10 then
GetPer=MyTerminal.GetString(xLn, 21, 8)
End If
xLn=xLn+1
NewPer=NewPer & GetPer
Next x
Elseif NumRtrn = "" OR NumRtrn = 0 then
' Do Nothing
End If
msgBox NewPer
End Sub [/color]
What I'd like to do is only have the "formula" ...
Code:
MyTerminal.WaitHostQuiet(500)
NumRtrn=Trim(MyTerminal.GetString(14,72,2))
xLn=10
If NumRtrn = 1 then
MyTerminal.PutString "x", 15, 72
MyTerminal.WaitHostQuiet(500)
MyTerminal.SendKeys("<Enter>")
MyTerminal.WaitHostQuiet(500)
GetPer=MyTerminal.GetString(xLn, 21, 8)
ElseIf NumRtrn > 1 then
MyTerminal.PutString "x", 15, 72
MyTerminal.WaitHostQuiet(500)
MyTerminal.SendKeys("<Enter>")
MyTerminal.WaitHostQuiet(500)
For x=1 to NumRtrn
If xLn>10 then
GetPer=MyTerminal.GetString(xLn, 21, 8)
NewPer=NewPer & "/"
ElseIf xLn=10 then
GetPer=MyTerminal.GetString(xLn, 21, 8)
End If
xLn=xLn+1
NewPer=NewPer & GetPer
Next x
Elseif NumRtrn = "" OR NumRtrn = 0 then
' Do Nothing
End If
unawares,