Dynamic creation of an AppleScript via AppleScript
I want to create an AppleScript .scpt file programmatically without using Script Editor. The goal is to have some Apple Script commands in a plain text file to be used as a template. I want to create an AppleScript that should ask the user a couple questions and then use the answers to fill in the "template" and finally save the resulting script to disk.
set theApplication to XXXXX
tell application theApplication
-- many things....
My script should ask the user for the name of the application, then load the template and replace XXXXX by what the user has given. At the end the result should become a .scpt file on disk.
Thanks for any help
On 09/03/2018, at 09:24, Markus Ruggiero <mailinglists@...> wrote:
I want to create an AppleScript .scpt file programmatically without using Script Editor.
Have a look at these two post on the Applescript Users List.
osacompile -o <object-file> <source-file> (see the man page)
On top of what Chris said, you can also create and run AppleScripts as .sh files.
Just write your AppleScript with a shebang targeting osascript:
display dialog "hello, world"