It would be super nice to have a function that converts a multiline script into a proper “-e” prefixed form for use with osascript on the command line…
Do you find that the heredoc
pattern circumvents that need with AS ?
(It generally does with JS)
2 Likes
e.g.
osascript -l AppleScript <<AS_END 2>/dev/null
-- unlines :: [String] -> String
on unlines(xs)
-- A single string formed by the intercalation
-- of a list of strings with the newline character.
set {dlm, my text item delimiters} to ¬
{my text item delimiters, linefeed}
set s to xs as text
set my text item delimiters to dlm
s
end unlines
unlines({"Alpha", "Beta", "Gamma"})
AS_END
2 Likes