While WordStar 7 can use the Win3x and Win4x clipboard (Windows Enhanced Mode), it cannot access the OS/2 Clipboard. The following macros and Rexx scripts get around that limitation.
To use them one needs three programs which can be downloaded from Hobbes or LEO. Two are freeware (both included); Dr. A. Olowofoyeku's, of Keele University, England, RUN-OS/2 (v1.10 on Hobbes, v.1,60 on LEO) and Roddy Collin's SwitchTo. The second is shareware; Don Hawkinson's Command line Clipboard Access 1.12. On LEO the OS/2 System Tools are found at:
http://archiv.leo.org/pub/comp/os/os2/leo/systools/
Run-OS/2 lets one start OS/2 programs from a DOS command line. CCA allows one to copy a file and from the OS/2 Clipboard. SwitchTo returns one to return to the WordStar VDM session after running FromClip.
The Rexx scripts and the macros need to be modified for location of these files. I keep them in a folder called UtilOS2.
Place the Rexx scripts and macros in the WordStar 7 macro folder and assign keystrokes to them. Modify the WordStar folder information to reflect your installation. If one is using Run-OS/2 version 1.6, the nature of the ToClip and FromClip sessions can be defined (for example: foreground, background, windowed, full screen.)
---------------- To ClipBoard ----------------
To copy text to the OS/2 clipboard, mark the text using ^KB and ^KK. Then run ToClip.WSM:
============
Sub Main AutoRestore(ON) SetHelpLevel(4) Insert(ON) CmdTags(OFF) HideDots(ON) ColMode(OFF) ColReplace(OFF) Key("{Ctrl+K}w") Key("c:\temp\ws2clip.txt{Tab}") Key("A") Key("{Enter}") Key("{Ctrl+K}f") Key("c:\utilos2\run c:\ws\macros\ToClip.cmd{Enter}") Key(" ") End Sub============
Using the blocked text, the macro creates a text file in the Temp folder, then runs the ToClip.CMD Rexx script.
============
/* Philip Griffin-Allwood */ /* Rexx script for use with ToClip.WSM */============'c:\utilos2\cca_112\toclip.exe < c:\temp\ws2clip.txt' 'del c:\temp\ws2clip.txt'
/* This line is optional */ /* It opens the Clip Viewer to confirm that the action has been successful */
'e:\os2\clipos2.exe'
The Rexx script runs the CCA ToClip.EXE or ToClip2.EXE (depending on which works best on your system) and load the text created in the temporary folder onto/into the OS/2 Clipboard. The temporary file created by ToClip.WSM is deleted.
The Rexx script concludes by opening the ClipBoard Viewer. I do this to make sure the action has taken place. I have found some OS/2 programs will lock the ClipBoard and stop the action. Closing the offending program will clear the problem.
---------------- From ClipBoard ----------------
To read information from the OS/2 ClipBoard into a WordStar 7 document, run the FromClip.WSM.
============
Sub Main AutoRestore(ON) SetHelpLevel(4) Insert(ON) CmdTags(OFF) HideDots(ON) ColMode(OFF) ColReplace(OFF) Key("{Ctrl+K}f") Key("c:\utilos2\run c:\ws\macros\FromClip.cmd{Enter}") Key(" ") PauseForInput ("{ENTER}", ' Wait for FromClip.CMD. ') Key("{Ctrl+K}r") Key("c:\temp\clip2ws.txt{Enter}") Key("{Ctrl+K}{Ctrl+J}") Key("c:\temp\clip2ws.txt{Enter}") IfException ACK: Key("{Enter}") End IfException End Sub============
The macro runs the FromClip.CMD Rexx script and pauses.
============
/* Philip Griffin-Allwood */ /* Rexx script for use with FromClip.WSM */============'c:\utilos2\cca_112\fclip2.exe > c:\temp\clip2ws.txt' 'c:\utilos2\switchto.exe WS.EXE'
The Rexx script runs CCA's FromClip.EXE to copy text on the ClipBoard to a file in the Temp folder. When the script finishes by using SwitchTo.EXE to return to the WordStar VDM. Note SwitchTo requires a case sensitive program name.
Once back in the WordStar VDM, press <Enter> to have the macro insert the file created by the Rexx script into the WordStar 7 document. The temporary file is deleted by the WordStar macro.
Philip G. A. Griffin-Allwood pgaga@auracom.com