Script utility to convert Extra! .edp files to Reflection Desktop format

  • 7023204
  • 24-Jul-2018
  • 27-Jul-2018

Environment

Reflection Desktop (including Pro, for X, for IBM, or for UNIX and OpenVMS) 16.1 and later

Situation

If you have a whole lot of Extra! session files (*.edp) and you want to have them all converted for use with Reflection Desktop (*.rd3x, *.rd5x, *.rdox) without having to open each one separately and save it, you can use this script to save them all as Reflection Desktop files.

Resolution

  1. Copy the VBScript code below to a text file and save as "ConvertEDP.vbs".
  2. Copy ConvertEDP.vbs to a directory that contains Extra! .edp files. (The folder should be one that Reflection Desktop recognizes as a "trusted location"...see Reflection Workspace settings.)
  3. Open a cmd.exe command prompt window and cd to the directory containing the script and .edp files.
  4. To run the script, use this syntax:  cscript.exe ConvertEDP.vbs
  5. Note: make sure that the Reflection Workspace setting for "Exit workspace when last document closed" is un-selected when using this script.
'''''''''''''''''''''''''''''''''''''''''''''''''''''
' ConvertEDP.vbs
'
' For every .edp file in the current directory,
' open it in Reflection Desktop, and save as a
' .rd3x, .rd5x, or .rdox (depending on host type).
'
' IMPORTANT: Run this script using cscript.exe, for example:
'     cscript.exe ConvertEDP.vbs
' ...or the echo statements will appear as message boxes instead
' of printing to the console!
'
' Example code provided without warranty or support.
' Please review and understand it before running.
'''''''''''''''''''''''''''''''''''''''''''''''''''''

const TERM3270 = 1
const TERM5250 = 2
const CloseAlwaysSave = 3

Wscript.Echo "===ConvertEDP==="

dim fso, wsh
set fso = WScript.CreateObject("Scripting.FilesystemObject")
set wsh = WScript.CreateObject("WScript.Shell")
 
Wscript.Echo "Launching Reflection for conversion process..."
dim rApp, frame
set rApp = WScript.CreateObject("Attachmate_Reflection_Objects_Framework.ApplicationObject")
set frame = rApp.GetObject("Frame")

dim fcollection, fldr, edp
set fldr = fso.GetFolder(".")
set fcollection = fldr.Files

on error resume next
for each edp in fcollection
   if lcase(Right(edp.Name, 4)) = ".edp" then
                
      'Reflection can't open/save Extra demo sessions,
      'so skip them..
      if instr(edp.Name, "Demo Session") = 0 then
                       
         Wscript.Echo "Converting: " & edp
  
         dim term        
         set term = rApp.CreateControl(edp)
         if err <> 0 then
            err.clear
            Wscript.Echo "Unable to open: " & edp & " err=" & err
            Wscript.Echo "Is this a Reflection ""Trusted Location""?"
         end if

         dim newfile
         newfile = left(edp, len(edp) - 3) 'remove "edp" from filename
         if term.TerminalType = TERM3270 then           
            newfile = newfile + "rd3x"
         elseif term.TerminalType = TERM5250 then
            newfile = newfile + "rd5x"
         else  'VT
            newfile = newfile + "rdox"
         end if
        
         term.SaveAsCompound newfile
         if err <> 0 then
            Wscript.Echo "SaveAs error=" & err
            err.clear           
         end if

         term.Close CloseAlwaysSave
         Wscript.Echo "Saved as: " & newfile

      end if 'instr...       
  end if  'lcase...
next

Wscript.Echo "Done...closing Reflection..."
rApp.Close CloseAlwaysSave

Feedback service temporarily unavailable. For content questions or problems, please contact Support.