--Need to first remove application specific formatting from clipboard
set the clipboard to �class ktxt� of ((the clipboard as text) as record)
set the_clip to the clipboard
--Comment out if not needed
display dialog the_clip
tell application "Finder" to set the_folder to (path to temporary items
folder) as text
--If you want to keep the file use
--tell application "Finder" to set the_desktop to (path to desktop folder)
as text
set target_file to the_folder & "JUNK"
--display dialog target_file
my write_to_file(the_clip, target_file, false)
set posix_path to POSIX path of target_file
--display dialog posix_pathsw
set to_print to "lp " & posix_path
do shell script to_print
--For testing
--tell application "Terminal"
--activate
--do script to_print
--end tell
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to �
open for access file target_file with write permission
if append_data is false then �
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
--display dialog "file_done"
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
|