# Cl2file.awk reads the windows clipboard and copies it to a file. # This is really handy because I don't like MS Word or Excel or most # other Windows apps, but I can Copy the file contents # (Edit|Select All, then Edit|Copy) to the clipboard # and then run this little program to but it all into a file which I can vi. # Actually, the same thing can be accomplished by doing "cat - >filename" # and then Edit|Paste, bu then you have to watch the screen scroll # while it's pasting. Cl2file happens instantly. # Thanks for a great product, # George Coleman # Copy contents of Windows 95/NT clipboard to a file extern winapi int GetActiveWindow() #Clipboard Functions extern winapi int IsClipboardFormatAvailable(int type) extern winapi int OpenClipboard(long hwnd) extern winapi long GetClipboardData(int type) extern winapi char * GlobalLock(long cHnd) extern winapi int GlobalUnlock(long cHnd) extern winapi int CloseClipboard() # # Predefined Clipboard Formats # local CF_TEXT = 1 local CF_OEMTEXT = 7 local cHnd; # handle for memory - HGLOBAL local lptstr; # ptr to ASCIIZ string in that memory - LPTSTR local File; # File to write clipboard to BEGIN { if (OSMODE != 3) { print "this program only runs on Windows 95 or NT" abort } for (i=1;i>File else print lptstr "\n" >File GlobalUnlock(cHnd); # free the clipboard memory lock } CloseClipboard(); }