I tried to figure out how to create an AppleScript Library with terminology inspired by Shane’s
https://macosxautomation.com/mavericks/libraries/mda/libraries-with-terminology.m4v
in SD. I couldn’t so I tried Script Editor which was used in the video. My version is Version 2.11 (229); not the same as in the video: different button to open/close its bundle and no check box for selecting AppleScript/Objective-C Library in particular.
I made the sdef,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary>
<suite name="Text Utilities" code="NYTT" description="Commands to edit text">
<command name="transform text" code="NYTTTRNS" description="">
<direct-parameter type="text" description="The text to transform."/>
<parameter name="to" code="ToCs" type="case conversion" description=".."/>
</command>
<enumeration name="case conversion" code="CSEC">
<enumerator name="upper case" code="UppC" description=""/>
<enumerator name="lower case" code="Lowc" description=""/>
<enumerator name="word case" code="WrdC" description=""/>
</enumeration>
</suite>
</dictionary>
created a new document in SE, re-saved it as .scptd, dragged the above sdef into the bundle, re-saved it and closed the window. I put the scptd into my Home Library Folder.
I created a new script in SE using the command.
use script "Terminoly test 004"
transform text "blahblah" to upper case
It recognized the terminology but gag on the Obj-C so I added a use framework “Foundation” statement to the sdef and it worked.
use framework "Foundation"
on transform text sourceText to caseIndicator
set the sourceString to current application's NSString's stringWithString:sourceText
-- apply the indicated transformation to the Cocoa string
if the caseIndicator is upper case then
set the adjustedString to sourceString's uppercaseString()
else if the caseIndicator is lower case then
set the adjustedString to sourceString's lowercaseString()
else
set the adjustedString to sourceString's capitalizedString()
end if
-- convert from Cocoa string to AppleScript text
return (adjustedStri
Next I created the same script in SD. It didn’t recognize the terminology/compile.
What am I doing wrong? How can I create the Script Library with Terminology in SD?
Thanks