Creating a stamp with Applescript to change the linkType property "broad:true" for selected notes?

Is there an easy way to change the linkType broad property to true for selected notes as a stamp? Not sure if this is possible…but hence the question.

I have 4 notes with links. I want to change the link property to broad:true via a stamp. Is there a way to do this to selected note(s)…multiple notes that is? I know I can to into each link manually and set the properties, but instead I would like to automate this via stamp. How do I do this?

I assume it is with Applescript but I cannot seem to get the code correct, I think my gap is … I do not know how to apply the code from Applescript to a number of selected notes.

Here is what I have done so far… it does not work.

tell application id "Cere"
	tell front document
		make linkType with properties {broad:true}
	end tell
end tell

it is based on this code that works from the expert, MarkA for a different purpose… he makes new linkTypes and is able to dynamicaally set the properties via Applescript. Here: Bulk Create Link Types

Here is a test file below

LinkBroad Property Test.tbx (120.0 KB)

To summarize: what i am trying to do is change the linkType property broad to true with Applescript stamp.

In this case, I four notes each with links. I selecte 2 notes and am trying to change the linkType between them with a stamp. Can this be done

1 Like

Out of interest, did you try the eachLink() operator? It would be useful to see the action code to used to change the ‘broad’ setting and which didn’t work. Otherwise, what is the advantage of using AppleScript over an internal Tinderbox process?

Here was the applescript I used that did not work.
No, I did not think of using the eachlink() operator. Ahh, I do see you can set the properties there
Wonderful… this seems to work

eachLink(aLink){

   aLink["broad"]=true;

}

Bonus points…I am just curious… any thoughts on why the Applescript did not work.

Thanks in advance
Tom

AppleScript doesn’t know what linkType is, I believe.

As a general rule, prefer using actions to using AppleScript when working within Tinderbox. AppleScript can be tricky.

Appears that it might know. (The Tinderbox 10 dictionary view in Script Debugger.)

I wrote too hastily. What I should have said is that this tells Tinderbox to instantiate a new link type object. But we don’t save that link type object anywhere, so nothing happens.

What you’d want to do is get the linkType property of the specific link in which you are interested, and then change its properties. That can (I think) be done, but it’s easier to do inside Tinderbox.

2 Likes

I’m not sure I understand. Is there is a need to use AppleScript, there are so many ways to adjust and work with LinkTypes using Tinderbox build in operators.