I have Extra suites, and i made a config plist to edit which keybinds my main applescript uses, in case their keybindings are different. They are stored in an array that Extra suites won’t understand
( {button(string),control(boolean),shift(boolean),command(boolean),control(boolean)}), and extra suites needs them to be more like “type key q with shift”. Instead of makeing something for all possible combinations, i decided to make a subroutine that turns it into the string “q with shift”. However, Extra suites does not recognize it because it is in the form of a string instead of using reserved words like “and”, “with”, and “shift”. Is there any way to include these reserved words in a variable, or just set a variable to be these?
i cut out the part where it reads the plist since i’m the only one with the file
set unreadableKey to {"q", false, true, false, false}
set typedKey to makeReadable(x)
tell application "Extra Suites"
ES type key typedKey
end tell
on makeReadable(array)
set rStringLength to 1
set rString to item 1 of array as string
if item 2 of array = false and item 3 of array = false and item 4 of array = false then
return rString
else
-- if any one of them is true, add with
set rString to rString & " with"
-- the string cant be more than 2 in length, so add control if it is in keybind
if item 2 of array is true then
set rString to rString & " control"
set rStringLength to rStringLength + 1
end if
-- if control is part of the keybind, and something else too, then add :and shift", else add "shift"
if item 3 of array is true then
if length of rString = 2 then
set rString to rString & " and shift"
else
set rString to rString & " shift"
end if
set rStringLength to rStringLength + 1
end if
-- if control is part of the keybind, and something else too, then add and command, else add command
if item 4 of array is true then
if length of rString ≥ 2 then
set rString to rString & " and command"
else
set rString to rString & " command"
end if
set rStringLength to rStringLength + 1
end if
-- if control is part of the keybind, and something else too, then add and option, else add option
if item 5 of array is true then
if length of rString ≥ 2 then
set rString to rString & " and option"
else
set rString to rString & " option"
end if
set rStringLength to rStringLength + 1
end if
end if
return rString
end makeReadable