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

How to automate copying from clipboard to xywrite with ANSI to ASCII conversion



A recipe for capturing ANSI content clips and converting them to ASCII for easy CALLING into XyWrite. I use this to get browser content into Virtual PC XyWrite for further processing. By pressing F1 in Firefox the selection is captured, the contents of the clipboard are written to disk to a temp file (Clip0000.TMP), this is converted and formatted by the Harbour program, appended to the Ascii INPUT.TXB file in the Virtual PC Share folder C:\VPCSHARE, to be CALLED later by a single keystroke into XyWrite. When I am done collecting clips, I press F2 to go to the Virtual PC session and I land directly in XyWrite if it is the topmost window, but, of course, this works equally well without Virtual PC, and call the resulting INPUT.TXB file. The clip collecting is instantaneous and hidden, courtesy of the "Run, %comspec% [...] min" line.

Main ingredients:
*************
Dave Navarro's Clip.exe (difficult to find on the Net, downloadable from: http://www.lexitec.fi/xywrite/clip.zip)
Autohotkey (http://www.autohotkey.com/)
Harbour xBase compiler (http://harbour-project.sourceforge.net/)
Xywrite
Firefox (or some other modern browser or program you want )
Virtual PC (optional)

Autohotkey script
*************
; F1 key within Firefox
$F1::
IfWinActive, ahk_class MozillaWindowClass
{
Send, {CTRLDOWN}c{CTRLUP}
Run, %comspec% /c c:\util\clip C:\VPCSHARE\Clip0000.TMP /R && c:\util\clipconv.exe && type C:\VPCSHARE\Clip0000.TMP>>C:\VPCSHARE\INPUT.TXB && DEL C:\VPCSHARE\Clip0000.TMP, , min
}
else
Send, {F1}
return
; F2 Key
F2::WinActivate, DOS - Microsoft Virtual PC 2007

Harbour program
*************
proc main
* read ANSI file
txa_str=memoread("C:\VPCSHARE\Clip0000.TMP")
* convert to ASCII
txb_str=HB_ANSITOOEM(txa_str)
* line ending
crlf _pair=chr(13)+chr(10)
* a line to introduce each separate clip, a TAB chr precedes 'Firefox', visual formatting for Xy
firefox="«MDDD» Firefox"+crlf _pair+"«MDNM»"
* write the result to disk
memowrit("C:\VPCSHARE\Clip0000.TMP",firefox+txb_str+crlf _pair)
return

Best regards,

Kari Eveli
LEXITEC Book Publishing (Finland)
lexitec@xxxxxxxx

*** Lexitec Online ***
Lexitec in English: http://www.lexitec.fi/english.html
Home page in Finnish: http://www.lexitec.fi/