Howdy folks, I have been working on an AppleScript to use in conjunction with Keyboard Maestro to add a new expansion to Typinator and am running into an error when trying to set two different properties; one for case handling and the other for the expansion type.
I am able to pass the variables setName
, abbName
, expName
, descr
and whlWrd
with no issues. But when I try to pass either of the variables casHndl
or expType
I get an error saying that it can’t make the contents of those variables into type constant. Attached are screenshots of the errors themselves. As you can see in the AppleScript itself, I am setting those variables to the exact same string that I would otherwise put directly into the properties area, but when that same text is passed as a variable the script fails.
For instance, for case handling I can put in case handling:case does not matter
and it works fine, but if I try to use case handling:casHndl
it fails. Same for expansion type.
I’m hoping somebody here might have an idea as to what I can do to fix this. I’ve reach out to Guy at Typinator and am waiting to hear his response. Any help is greatly appreciated!
-Chris
### Requires Keyboard Maestro 8.0.3+ ###
set kmInst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set setName to getvariable "local__Set Name" instance kmInst
set abbName to getvariable "local__Abbreviation" instance kmInst
set expName to getvariable "local__Expansion" instance kmInst
set descr to getvariable "local__Description" instance kmInst
set whlWrd to getvariable "local__Whole Word" instance kmInst
--set casHndl to getvariable "local__Case Handling" instance kmInst
--set expType to getvariable "local__Expansion Type" instance kmInst
end tell
--for debugging
set setName to "Test Set"
set abbName to "this is the abbreviation"
set expName to "this is the expansion"
set descr to "this is the description"
set whlWrd to "true"
set casHndl to "case does not matter" --this returns an error
set expType to "plain text" --this returns an error
tell application "Typinator"
set setName to rule set setName --sets the Set name to the variable entered above
tell setName
-- These next two lines are the notes that Gue at Typinator provided me
-- case handling: case does not matter, case must match, case affects expansion
-- expansion type: plain text, HTML
set setName to make new rule with properties ¬
{abbreviation:abbName, plain expansion:expName, description:descr, whole word:whlWrd, case handling:casHndl, expansion type:expType}
set newEntry to properties of setName
end tell
end tell
newEntry