[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Outputting to a printer



>Ok, the project I had in mind was modifying the clipboard display droplet
>of last month to print (the clipboard |text clippings|dragged textfiles) on
>the Imagewriter II. Will let you know if anything useful happens.
>Thanks for the advice.

Save the following code as a droplet. When double clicked it should print
any text in the clipboard. It should also print a text file or a text
clipping dropped on it.

David Seay
http://www.mastercall.com/g-s

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------


#!perl

use Mac::Resources;
use Mac::Memory;
package Dartmouth;

&MacPerl::LoadExternals("clipboard.XFCN"); # XCMD for clipboard processing
package main;

if (MacPerl::GetFileInfo($ARGV[0]) eq 'clpt') {
	$fileref = FSpOpenResFile(@ARGV, 1);
	if (defined($fileref)) {
		$reshand = Get1Resource('TEXT', 256);
		if ($reshand) { $clip = $reshand->get() }  # get text clipping
	}
	CloseResFile $fileref;
} elsif ($ARGV[0]) {
	$clip = $ARGV[0];                    # get a dropped, previously
saved file
} else { $clip = &Dartmouth::Clipboard() }   # get clipboard contents


if ($clip) {
	print "$clip\n";
	&MacPerl::DoAppleScript(<<"END_SCRIPT");
	tell application "MacPerl"
		print document 1
		Close Window "MacPerl"
	end tell
END_SCRIPT
} else {
	print "\a";
	&MacPerl::Quit(0); # change to '&MacPerl::Quit(2);' to quit MacPerl
after ending the script
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch