Can't copy styled text to guest OS clipboard in SheepShaver

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

Can't copy styled text to guest OS clipboard in SheepShaver

Post by emendelson »

This problem occurs in SheepShaver running 9.0.4. It does NOT occur in Qemu running 9.2.

When I work in Script Debugger (see another thread about that wonderful program), I can paste into a Script Debugger editing window, but I can't copy anything from the window. If I copy from the editing window, the clipboard reports that it contains styled text, but the clipboard is actually empty.

EDIT: See below for more detail. This is a problem with any application that copies styled text to the clipboard under SheepShaver.
Last edited by emendelson on Tue Jul 11, 2017 2:51 pm, edited 2 times in total.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A copy-to-clipboard oddity in SheepShaver

Post by emendelson »

It turns out that this is a problem with any application running under SheepShaver that tries to copy "styled text" to the clipboard. If you format some text in ClarisWorks, for example, and copy it to the clipboard, you get an empty clipboard.

So it's a SheepShaver but that will presumably never be fixed, alas.

EDIT: There's a patch here for copying styled text to the HOST clipboard from SheepShaver/BasiliskII under BEOS, but it doesn't seem to apply to this issue:

https://github.com/cebix/macemu/commit/ ... 7fd96e85cd

EDIT: And the relevant patches already seem to be in the code that I've been building...
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: A copy-to-clipboard oddity in SheepShaver

Post by Ronald P. Regensburg »

emendelson wrote:It turns out that this is a problem with any application running under SheepShaver that tries to copy "styled text" to the clipboard. If you format some text in ClarisWorks, for example, and copy it to the clipboard, you get an empty clipboard.
I have been discussing this issue and similar clipboard oddities in SheepShaver years ago and at the time found some (convoluted) workarounds. But I forgot the specifics and I do not even remember where I had this discussion and with whom. Could have been here, or in cebix/macemu, or in the old B2-devel mailing list, or in an email exchange. When I have the time, I will try to recover the discussion. With a simple search here I cannot find it.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: A copy-to-clipboard oddity in SheepShaver

Post by emendelson »

Ronald P. Regensburg wrote:
emendelson wrote:It turns out that this is a problem with any application running under SheepShaver that tries to copy "styled text" to the clipboard. If you format some text in ClarisWorks, for example, and copy it to the clipboard, you get an empty clipboard.
I have been discussing this issue and similar clipboard oddities in SheepShaver years ago and at the time found some (convoluted) workarounds. But I forgot the specifics and I do not even remember where I had this discussion and with whom. Could have been here, or in cebix/macemu, or in the old B2-devel mailing list, or in an email exchange. When I have the time, I will try to recover the discussion. With a simple search here I cannot find it.
Thank you for looking for this - I certainly haven't found anything here, and the only thing I found on cebix/macemu was the fix for BeOS. Anything you can find would be worth having.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: A copy-to-clipboard oddity in SheepShaver

Post by adespoton »

Ronald P. Regensburg wrote:
emendelson wrote:It turns out that this is a problem with any application running under SheepShaver that tries to copy "styled text" to the clipboard. If you format some text in ClarisWorks, for example, and copy it to the clipboard, you get an empty clipboard.
I have been discussing this issue and similar clipboard oddities in SheepShaver years ago and at the time found some (convoluted) workarounds. But I forgot the specifics and I do not even remember where I had this discussion and with whom. Could have been here, or in cebix/macemu, or in the old B2-devel mailing list, or in an email exchange. When I have the time, I will try to recover the discussion. With a simple search here I cannot find it.

I think it was on the mailing list IIRC.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Can't copy styled text to guest OS clipboard in SheepSha

Post by Ronald P. Regensburg »

I found the discussion, which was mostly about the 64-bit SheepShaver that does not run on later OSX hosts. It was so complicated that I have difficulty to understand it again myself, but it seems that in classic MacOS there is not one clipboard, but several clipboards that do not cooperate nicely in the emulator.

It depends on in which application you copy and were you want to paste.

For instance, in 32-bit SheepShaver:

Styled text copied in CW/AW will not show on the clipboard (as viewed from the Finder Edit menu) but it can be pasted in SimpleText and will show styles in as far as SimpleText can show styles.

Again copied from SimpleText, it will appear on the clipboard, albeit without styles. And it can be pasted as such anywhere, also in the host.

Styled text that is copied in CW/AW can also be pasted in Tex-Edit Plus. When again copied in Tex-Edit Plus it will appear with styles on the clipboard and can be pasted with styles in several other applications. But it will not appear at all on the host's clipboard.
Last edited by Ronald P. Regensburg on Thu Aug 31, 2017 6:51 am, edited 2 times in total.
Reason: corrected "Edit" menu
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Can't copy styled text to guest OS clipboard in SheepSha

Post by emendelson »

Ronald, you're right! Excellent discovery. To repeat it in brief:

If you copy text from Script Debugger etc. in SheepShaver, the way to paste it into an application that expects styled text is to first paste it into something like SimpleText or any other text editor, then copy it again to the clipboard. The copied text can then be pasted back into Script Debugger, etc. as plain text.

Presumably an AppleScript could be set up to do the job of copying/pasting into a text editor/cutting from the text editor, etc.

Incidentally, this clipboard problem does NOT occur with SheepShaver for Windows.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Can't copy styled text to guest OS clipboard in SheepSha

Post by Ronald P. Regensburg »

When you install Tex-Edit Plus 4.1.3 in MacOS9 and use that as intermediate text editor, styles will be preserved. And Tex-Edit Plus is scriptable.

http://www.tex-edit.com
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Can't copy styled text to guest OS clipboard in SheepSha

Post by emendelson »

It turns out that you don't need a scriptable text editor to copy styled text to the clipboard as text so that it can be pasted elsewhere. This code fragment script does the job (you lose styles, but you can at least paste the text):

Code: Select all

if first window exists then
    set theDocument to first document
    set theText to selection of theDocument as string
    if theText is not "" then set the clipboard to theText
end if
As written, that works from the Script menu in Script Debugger. It should be easily adaptable to anything else.
Post Reply