I am trying to take advantage of the new Mavericks feature and set up a “Script Libraries”. (I copied and pasted so spelling could be verified.)
So I have a file ~/Library/Script Libraries/TID.scpt. It has the content:
on SaveTID(newTID)
set currentTID to AppleScript's text Delimeter
set AppleScript's text Delimeter to newTID
return currentTID
end SaveTID
on RestoreTID(oldTID)
set AppleScript's text Delimeter to oldTID
end RestoreTID
first of all there is a syntax typo in your code. It’s
AppleScript text item delimiters
but in the scope of AppleScript you can write
on SaveTID(newTID)
set currentTID to text item delimiters
set text item delimiters to newTID
return currentTID
end SaveTID
on RestoreTID(oldTID)
set text item delimiters to oldTID
end RestoreTID
To use the script as library you have to implement the use statement and tell the script to do the handler
use script "TID"
tell script "TID" to set oldTID to SaveTID("=")
That’s right. But you will see that he also defined terminology in an .sdef file; that’s the stuff that gets read in via a use command. Without that (and sometimes even with that), you still need to use a tell or equivalent.