Entry
TSE: Using version 2.0 of TSE, is there a way to copy and paste to Windows applications?
Nov 9th, 2001 16:56
Knud van Eeden, Fred Olson,
------------------------------------------------------------------------
--- Knud van Eeden - 8 November 2001 - 10:45 pm ------------------------
METHOD: external program: 4DOS:
A solution is to use an external program.
In this very simple solution, you use 4DOS as the external program, and
its in-built functions @CLIPW to copy, and @CLIP to paste:
1. Download and install 4DOS
[http://www.faqts.com/knowledge_base/view.phtml/aid/12704/fid/936]
2. Save this text below e.g. as clipwind.s, and compile it in TSE (e.g.
pressing <CTRL><F9>, or menu 'Macro'->'Compile')
3. if you inside TSE after that press the key <F11> to copy,
and the key <F12> to paste 1 line
// library: clipboard: Windows: copy: 1 line: 4dos: only
PROC PROCClipboardWCopyLine4DosOnly()
STRING s[255] = GetMarkedText()
IF s == ""
Warn( "please highlight upto 1 line of text" )
ELSE
Dos( "4dos.com echo %@CLIPW[" + s + "] >nul", _DONT_PROMPT_ )
ENDIF
END
// library: clipboard: Windows: paste: 1 line: 4dos: only
PROC PROCClipboardWPasteLine4DosOnly()
PushPosition()
PushBlock()
Dos( "4dos.com echo %@CLIP[0] >ddd.ddd", _DONT_PROMPT_ )
EditFile( "ddd.ddd" )
MarkLine()
Copy()
KillFile()
PopBlock()
PopPosition()
Paste()
END
<F11> PROCClipboardWCopyLine4DosOnly()
<F12> PROCClipboardWPasteLine4DosOnly()
---
---
METHOD: TSE: internal macro: CopyToWinClip() and PasteFromWinClip()
For the latest versions of TSE for DOS (e.g. v2.5) , you have the
function
CopyToWinClip()
or
PasteFromWinClip()
(see e.g. TSE menu 'Help'->'Index')
---
---
METHOD: external program: TSE v3.0 for Windows
This two above functions do not function if TSE for DOS (e.g. v2.5)
is used in the 32 bits WindowsNT/2000/XP (but they work ok in the 16/32
bits Windows95/98/ME)
In TSE v2.0 this two above functions are not present at all.
Now, if this functions CopyToWinClip() and PasteFromWinClip() are not
available/working, and you insist in working with the TSE for DOS
(e.g. v2.5)
version (e.g. because you still have a lot of unconverted macros,
or you simply like that particular version better --
instead of working with the more appropriate TSE for Windows version
(e.g. v3.0)
in which this 2 clipboard functions are working as expected -- )
you could use the following general workaround:
The idea is to use an external program, e.g. written in C++ or Delphi,
or even another version of TSE (this method is used here), which has
the possibility to copy to/paste from the Windows clipboard)).
---
to copy:
1. you highlight the text
2. by running a TSE macro (e.g. mycopy.mac) write this text to an
external file (e.g. mycopy.txt)
3. then the same macro calls an external program (e.g. mycopy.exe, or
mycopy.bat, or 'e32.exe mye32copymacro') that reads this external file
4. and copies it to the Windows clipboard.
---
to paste:
1. you put your cursor where you want to have your text pasted
2. by running a TSE macro (e.g. mypaste.mac)
3. call that external program (e.g. mypaste.exe, or mypaste.bat,
or 'e32.exe mye32pastemacro'), which
pastes the content of the Windows clipboard to an external file.
4. Then from TSE you read this external file (e.g. mypaste.txt)
5. and then inserts this content at the current cursor position in
the file you are editing.
---
---
Overview of an example, that illustrates the above ideas:
In the following working (on my network) example (in this case for TSE
v2.5 for DOS in
combination with TSE v3.0 for Windows, running on WindowsNT/2000/XP.
I use this macros all the time to copy to/paste from the Windows
clipboard, also for this question), 4 files are given:
1. the 'copy to Windows clipboard' macro for TSE v2.5 for DOS:
(save and compile as 'clipwcop.s')
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12642/fid/900]
2. the 'copy to Windows clipboard' macro for the external program
(here TSE v3.0 for Windows):
(save this in the macro directory of TSE v3.0, and compile this
macro as 'cliptwtd.s')
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12643/fid/900]
3. the 'paste to Windows clipboard' macro for TSE v2.5 for DOS:
(save and compile this macro as 'clipwpas.s')
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12644/fid/900]
4. the 'paste to Windows clipboard' macro for the external program
(here TSE v3.0 for Windows):
(save this in the macro directory of TSE v3.0, and compile this
macro as 'clipptwd.s')
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12645/fid/900]
Further:
5. To automate it, change your .ui file (make a backup first),
and change all the occurrences of copy to and paste from the
Windows clipboard so that the above two macros are called instead
(such that CopyToWindowsClipboard (e.g. <CTRL C>) calls the
macro 'clipwcop.mac', and PasteFromWindowsClipboard (e.g. <CTRL V>
calls the macro 'clipwpas.mac'), then recompile this .ui file so that
it is permanently burned into your TSE editor.
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12650/fid/900]
---
PS
ad 6. For the record, and by the way, I further use this global
variable initialization file which makes it easy to switch computers
in the network, home or job, by making the corresponding #DEFINE
computername
TRUE and all the other computernames FALSE, then recompiling on that
particular computer. Some of this global variables are used in the other
macros, so you might have to adapt it to your own computer and or
computer system.
[Internet: see:
http://www.faqts.com/knowledge_base/view.phtml/aid/12660/fid/900]
---
---
METHOD: external program: Windows Notepad
For a quick solution, load an external program (e.g. notepad),
do the copy/paste there.
e.g. run this macro in TSE:
PROC Main()
Dos( "notepad " + CurrFilename() )
END
<F12> Main()
------------------------------------------------------------------------