calling a user defined session in attachmate macro
calling a user defined session in attachmate macro
(OP)
I am having some problems allowing the user to specify which session they would like to use when running a macro.
Users on our system can open two Attachmate windows, one named WGS.edp and the other named WGSSession.edp. These
names are constant in our system, regardless of the desktop the application is being run on.
When you first sign on to a session on our system, you can enter either TPXC or TPXW. If you have a session open, and are logged in to it using TPXC, you MUST log in to the other session using TPXW. What I would like to do is set it so a value of TPXC (gotten from input via tpxTextBox.text and assigned to the variable TPX) always uses the "WGS" session and a value of TPXW to always use the "WGSSession" session.
i format my object the standard way via Sess0 = System.ActiveSession
i tried using some 'if' logic to assign a session based on the value of TPX
but im thinking now it might just be
or
any help would be greatly appreciated
thanks
-obfuscate
Users on our system can open two Attachmate windows, one named WGS.edp and the other named WGSSession.edp. These
names are constant in our system, regardless of the desktop the application is being run on.
When you first sign on to a session on our system, you can enter either TPXC or TPXW. If you have a session open, and are logged in to it using TPXC, you MUST log in to the other session using TPXW. What I would like to do is set it so a value of TPXC (gotten from input via tpxTextBox.text and assigned to the variable TPX) always uses the "WGS" session and a value of TPXW to always use the "WGSSession" session.
i format my object the standard way via Sess0 = System.ActiveSession
i tried using some 'if' logic to assign a session based on the value of TPX
CODE
If TPX = "TPXC" then
Sess0 = System.ActiveSession.WGS
Else
Sess0 = System.ActiveSession.WGSSession
end if
Sess0 = System.ActiveSession.WGS
Else
Sess0 = System.ActiveSession.WGSSession
end if
CODE
Sess0 = System.Session.WGS
CODE
sess0 = System.Session.WGSSession
any help would be greatly appreciated
thanks
-obfuscate
RE: calling a user defined session in attachmate macro
Did you follow up on what you were thinking?
Hint: Only ONE session can be 'active'.
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: calling a user defined session in attachmate macro
ill let you know how it works out
all to often in programming i find myself looking so deeply at complexly at a problem to find the answer, i miss the simple solution that might be (probably is) floating right in front of my face.
RE: calling a user defined session in attachmate macro
Say i want to target the WGS Session....
the code below results in a 438 Run Time Error with msg 'object doesnt support this property or method'
CODE
Dim System, Sess0, Sessions, excel_app As Object
' Get the main system object
Set System = CreateObject("EXTRA.System")
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 time for the host screen to settle
g_HostSettleTime = 250
g_HostSettleTime1 = 1000
If (g_HostSettleTime > System.TimeoutValue) Then
System.TimeoutValue = g_HostSettleTime
End If
Set Sess0 = System.Session.WGS
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 Row, Column, rCount, cCount As Integer
Dim ExcelSource, toExcel As String
Dim test As Integer
ExcelSource = "c:\excel\ScreenRun.xls"
Set excel_app = CreateObject("Excel.Application")
excel_app.Workbooks.Open (ExcelSource)
Set excel_sheet = ActiveSheet
rCount = 1
Row = 1
Column = 1
Do While rCount <= 24
cCount = 1
Do While cCount <= 80
toExcel = ""
toExcel = Sess0.Screen.Area(rCount, cCount, rCount, cCount).Value
excel_sheet.Cells(rCount, cCount).Value = toExcel
cCount = cCount + 1
Loop
rCount = rCount + 1
Loop
MsgBox ("Screen rip complete. Please change the target file 'ScreenRun' to get the capture to a new tab and formatted properly")
End Sub
If i can just figure out how to target specific session by name I will be able to figure out how to use a variable to target the session I need but what i have just isint doing it
To clarify, I do have access to VBA and the system at the same time, i just have to take it home to code it in VS2008
RE: calling a user defined session in attachmate macro
CODE
muh hahahahaha
thanks for letting me bounce ideas around, im new here so ill do my best to make sure im on and contributing
<>bfuscate
RE: calling a user defined session in attachmate macro
You never seem to declare WGS or assign or set WGS.
So what is it?
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: calling a user defined session in attachmate macro
CODE
Dim Sys As Object, Sess As Object
Set Sys = CreateObject("EXTRA.System")
' Assumes one or more open sessions
SessionCount = Sys.Sessions.Count
For i = 1 to SessionCount
If Sys.Sessions.Item(i).Connected Then
Connected$ = Connected$ + Sys.Sessions.Item(i).Name + " "
End If
Next
MsgBox "The following sessions are connected: " + Connected$
End Sub
RE: calling a user defined session in attachmate macro
yea, i dont think my idea of System.Session(WGS) is working altough for some reason a VBA version will execute in the WGS window while i have my VB version running in the WGSSession window (the vb macro uses the statement Sess0 = System.ActiveSession) but always seems to go to WGSSession.
When i leave the VBA code for the second session as
CODE
but when i use
CODE
i cant make two different versions of the VBA sub use different windows though
grrrrr
RE: calling a user defined session in attachmate macro
Then you use as...
CODE
Skip,
Just traded in my old subtlety...
for a NUANCE!
RE: calling a user defined session in attachmate macro
Sess0 = System.Sessions(WGS)
and
Sess0 = System.Session(WGSSession)
are valid and working fine via VBA (wierd, i know)