Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to get the full path of open Reflection Session

Status
Not open for further replies.

RitaG

Programmer
Aug 6, 2012
11
US
Hey,

Is there a way to get the full path of an open Reflection session ?? e.g C:\Documents and Settings\...\Reflection.rd3x

On my system the Reflection session is stored in a folder in "My Documents". But thats not necessarily the same location the client will store his session. The following code works perfectly if Reflection.rd3x is in the location as specified.

Set objWSHShell = CreateObject("WScript.Shell")
strSpecialFolderPath = objWSHShell.SpecialFolders("MyDocuments") & "\Reflection\Reflection.rd3x"
Terminals = App.GetControlsByFilePath(strSpecialFolderPath)

When I run this macro, i have the Reflection session already open. Is there any way to find out the entire path of the open session ?? I cant seem to find any working solution anywhere (and I HAVE looked !).

Please, any assistance would be highly aprreciated !!
 
hi,

Whatever your system object is...
Code:
dim oSess as object
  for each oSess in YourSystemObject.sessions
     debug.print oSess.Name, oSess.Path
  next


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip,

Thanks for replying so quickly. I'm new to VBA in Attachmate so i'm not really sure how to implement what you just said. I am attaching a code snippet of what I have so far.

Code:
Dim oSess As Object
 On Error Resume Next
  Set App = GetObject("Reflection Workspace")
    On Error GoTo 0
    If IsEmpty(App) Or (App Is Nothing) Then
        MsgBox "Need to open reflection first"
        Exit Sub
    End If
    Set Frame = App.GetObject("Frame")  
    Frame.Visible = True  
          
    Dim objWSHShell As Object
    Dim strSpecialFolderPath
    Set objWSHShell = CreateObject("WScript.Shell")
    strSpecialFolderPath = objWSHShell.SpecialFolders("MyDocuments") & "\" & "Attachmate\Reflection\Reflection.rd3x"
    Set objWSHShell = Nothing
    Terminals = App.GetControlsByFilePath(strSpecialFolderPath)

I tried doing as you suggested, like this

Code:
    For Each oSess In App.Sessions
        Debug.Print oSess.Name, oSess.Path
    Next
But I am getting an error saying that the Object does not support this property. What am I doing wrong ??
 
Error on WHAT statement?

BTW, I very rarely code in the Attachmate Editor.

I mych rather drive a Rolls Royce than a Yugo, so I code in Excel VBA, since I am always starting with Excel data and/or ending up with data in Excel--so my advise is faq707-4594.



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Sorry ! I am getting the error in the line
Code:
For Each oSess In App.Sessions
I'm guessing App.Sessions is whats causing the problem. I am also coding in Excel VBA and not in Attachmate Editor.

Using the Watch window, I cannot seem to find the File path but I did get the InstanceID through the Frame object.
Code:
id_i = Frame.SelectedView.InstanceId

But I'm back to square one because when I try this
Code:
Terminals = App.GetControlByInstanceId(id_i)
I get an error saying "Automation Error:Invalid Pointer"...Any thoughts ??
 
???

My experience is with Attachmate Extra.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top