AppleScript - copying $Text between notes

I guess this it the right point to ask/remind of this:

I’m still at the very beginning of my AppleScriptObjC journey but am pretty sure there’s a lot potential if Tinderbox would allow to set a note’s $Text via AppleScript :slight_smile:

But you can already set the $Text of a note. I just did this (in Script Debugger v8.0.1):

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Tinderbox 9"
	tell its document "Untitled"
		tell note named "Some note"
			set value of attribute named "Text" to "Hello World"
		end tell
	end tell
	
end tell

The part left as an exercise for those with the need is to replace the "Hello World" part with a variable object holding the desired rich text.

I’m afraid there’s little to do as it’s currently not possible to set a note’s $Text to rich text via AppleScript.

Setting $Text to plain text may work fine in many cases, however there’s a lot of information that gets removed (bold, links, etc. ). So I think it would be very handy to be able to actually set a note’s text properly - that is without loosing information :slight_smile:

Can you post a script that illustrates the problem? I’m trying to help but am real busy so having a well-defined problem to start with helps.

Sorry, I won’t post a script that shows what’s not possible. Tinderbox doesn’t support setting a note‘s text to rich text. If you try you‘ll get an error. (If it would really help I could of course create a script that shows the error but I doubt that it‘s useful)

I understand, but it makes it hard to help. As a fellow user giving their own time and expertise for free, it didn’t seem an unreasonable request to make. also, FWIW, I’m not an AppleScript export.

It transpires that as AppleScript original development pre-dates widespread use of styled text it seems—after much Googling and reading AppleScript books I have to hand—that the problem is basic AppleScript has no native support for ‘just’ copying RTF.

Have you looked at any AppleScript fora for info on copying RTF text?

I believe I do understand the limitation that @Pete is raising here.

In the original context (a separate thread), I believe we were talking about pdf contents: to reduce file size, we contemplated a script that would extract the desired passage from the pdf.

Another approach would be to drag the whole pdf into Tinderbox, and then use an action to extract the desired passage and remove what isn’t needed.

Indeed, but the thread branched, as seen in the first post above into an AppleScript problem. After wasting a large part of my morning trying to resolve it, it transpired to be nothing to do with Tinderbox’s AppleScript but rather a limitation in apple’s implementation of core AppleScript.