[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Dosemu, Linux, XyWrite -- another clipboard kludge



From: Paul Lagasse 
>In an attempt to avoid having to open a file to transfer text to/from
>XyWrite in Linux, I have come up with with what I think is a somewhat
>easier, more automated kludge for transfering text to and from the Linux
>clipboard when running XyWrite under Dosemu......[snip]
>To clip from say "Firefox," I highlight the text, do ctrl+c, then
>doubleclick "To Xywrite Clipboard," and then do ctrl+alt+v to insert the
>text in XyWrite.

Paul's method above certainly works for cutting and pasting in and out of Xywrite in Linux, but it
requires too many keystrokes and mouse actions for my taste.

However, his kludge suggestion to clip into a file, clip.txt, save it, and then MErge the file into
Xywrite, was brilliant, and led me to come up with my own cut-and-paste kludge that, by using a
Linux macro program, reduces the number of keystrokes for placing text into Xywrite to two, the same
as you would have with any program.

The macro program is called Xmacros. It is part of the Debian package, which means it should also be
available in Ubantu. (At the command prompt: sudo apt-get install xmacros) I should also note that
Xmacros has been incredible useful for running a lot of other macros in all my Linux programs,
thereby reducing the number of repetitive keystrokes I have to do.

Xmacros allows you to create macros two ways. 1. You can run a subprogram, xmacrorec2, to record your keystrokes. I have had problems getting this to function properly. 2. You can write the macro in any plain text editor. The commands are simple (see http://xmacro.sourceforge.net/), and I have found this method to be quick and easy.

To make the whole operation work I keep a text editor with the file clip.txt open at all times. I
use Kwrite, but any plain text editor will do. In Linux, it is easy to place this open file/program
in Desktop 4, out of the way, where it functions as my silent dos clipboard.

The full macro for copying text to Xywrite is as follows. Note that anything after the pound sign is
a comment and can be deleted:

# Switches from command prompt to window where text is selected:
KeyStrPress Alt_L
KeyStrPress Tab
KeyStrRelease Tab
KeyStrRelease Alt_L
# Copies the selection into Linux clipboard:
KeyStrPress Control_L
KeyStrPress C
KeyStrRelease C
KeyStrRelease Control_L
# Switches to Desktop 4, where I keep clip.txt open all the time:
KeyStrPress Control_L
KeyStrPress Alt_L
KeyStrPress 4
KeyStrRelease 4
KeyStrRelease Alt_L
KeyStrRelease Control_L
# Pastes selection into clip.txt:
KeyStrPress Control_L
KeyStrPress R
KeyStrRelease R
KeyStrRelease Control_L
# Saves clip.txt:
KeyStrPress F12
KeyStrRelease F12
# Selects all (necessary to make future selections work):
KeyStrPress Control_L
KeyStrPress A
KeyStrRelease A
KeyStrRelease Control_L
# Switches back to Desktop 1, back where I started:
KeyStrPress Control_L
KeyStrPress Alt_L
KeyStrPress 1
KeyStrRelease 1
KeyStrRelease Alt_L
KeyStrRelease Control_L

I created a text file of the above and named it doscopy.macro.

I then used the KDE menu editor to create a shortcut to doscopy.macro in the Start menu. (Sidebar: I
use Debian Etch with KDE as my Xwindows GUI. The KDE menu editor allows me to create a menu of
program shortcuts accessible by pressing the Start key. I put all my macro shortcuts in Start -
System - Macros. Each macro gets its own shortcut menu item.) For the doscopy shortcut the command
line should read:

cat /home/bob/programs/macros/doscopy.macro | xmacroplay -d 15:0

The "-d 15:0" puts a 15 millisecond delay between each command. I have found with testing
that this can sometimes be as low as 0, and sometimes must be as high as 30, for the macro to work
reliably. I try to keep the number low to speed things along. It just requires a little
experimentation to find the right number.

I also check "run in terminal" in the shortcut options. I then assign a shortcut key to
this shortcut menu item. For my doscopy.macro, I gave it Ctrl-Alt-C.

In my Xywrite 3.55 keyboard.kbd file, I created a keyboard macro at Ctrl-Space, like so:

57=BC,m,e, ,E,:,\,x,y,w,r,i,t,e,4,\,x,y,4,\,c,l,i,p,.,t,x,t,XC,CH

In my Xywrite 4 xy4.kbd file, I created the following keyboard macro for Ctrl-Space:

57=BX,(,m,e, ,D,:,\,x,y,w,r,i,t,e,4,\,x,y,4,\,c,l,i,p,.,t,x,t,)

Thus, to paste some text into either Xywrite 3.55 or Xywrite 4, I select the text in any Linux
program and press Ctrl-Alt-C. Then in Xywrite I press Ctrl-Space and the text is inserted. Very
simple.

Sidebar: I use DosBox as my Dos emulator. I have found it very stable, reliable, easy to use, and
very flexible. However, this system should also work very easily with Dosemu.

As for pasting out of Xywrite into Linux, I don't need to do it very often. If I do, I find I
generally have to paste the whole file. In that case it is easier to save it, and then upload it
directly using another program.

I also use Xmacros to run two macros for allowing me to write all my emails in Xywrite. With one
keystroke I tell my email program to reply, quote the text of the original email, and then using
clip.txt cut and paste this into Xywrite. Once I've finished writing my email it takes two
keystrokes to cut and paste my written email out of Xywrite and back into my email program, ready to
send. If anyone is interested I can write up the details on how these macros work for the listserv.

It is now three weeks since I began working in my Linux box full time. All told, I am very happy
with Linux, especially when I read about the numerous problems others on this list are having
adapting to Vista. Linux is not perfect, but it works. And in those cases where something goes
wrong, I have found that the solution is almost always transparent and obvious, not hidden behind
the typically inexplicable error messages of Windows that provide no information at all.

Bob
__________________________
4708 Montgomery Place
Beltsville, Maryland 20705
301-937-0394
See my books and essays at:
http://members.bellatlantic.net/~vze3cxxp/zimbib.htm