Save clipboard to PICT file?

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Save clipboard to PICT file?

Post by emendelson »

Another thread raised the question of how to get PICT images from the SheepShaver clipboard into current version of macOS, where the clipboard can't read the PICT format. I found a complicated way to this, but I've trying to find a simpler way.

The simplest way seems to be to save a picture in the SheepShaver clipboard to a PICT file and then read or convert the PICT file in the host macOS. Bit Sur's clipboard can't handle PICT format, but other utilities in macOS can read and covert that format. I've tried using this AppleScript in SheepShaver to save the clipboard to a file. The basic method works perfectly with text, but I can't make it copy picture content. Can anyone suggest what I've been doing wrong, or is this a SheepShaver problem? I don't have a real OS 9 Mac with me to test:

Code: Select all

set clipInfo to (clipboard info) as string
if clipInfo contains "picture" then
	set filePath to ((path to desktop) as text) & "savefile.pict"
	set theImage to the clipboard as picture
	tell application "Finder"
		try
			set openedFile to open for access filePath with write permission
			write theImage to openedFile
			close access openedFile
			set fileAlias to filePath as alias
			set the file type of fileAlias to "PICT"
			set the creator type of fileAlias to "ttxt"
		on error err
			try
				close access openedFile
				display dialog "Could not save image to file." & return & return & err buttons {"OK"} giving up after 2
			end try
		end try
	end tell
else
	display dialog "No image in clipboard." buttons {"OK"} giving up after 2
end if
error number -128
In Big Sur, similar code (without the file type and file creator lines, and using «class 8BPS» for the "clipboard as" line works perfectly to save the clipboard contents as a TIFF file.

I vaguely remember that SheepShaver has some problems with the clipboard, and I wonder if one those problems is getting in the way here.
Post Reply