Date
1 - 3 of 3
Dynamic creation of an AppleScript via AppleScript
Markus Ruggiero
Hi,
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. Simplified example: Template.txt contains set theApplication to XXXXX tell application theApplication -- many things.... end tell 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 ---markus--- |
|
|
|
Christopher Stone
On 09/03/2018, at 09:24, Markus Ruggiero <mailinglists@...> wrote:
I want to create an AppleScript .scpt file programmatically without using Script Editor. Hey Markus, Have a look at these two post on the Applescript Users List. -- Best Regards, Chris
osacompile -o <object-file> <source-file> (see the man page) |
|
|
|
2551phil
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: #! /usr/bin/osascript display dialog "hello, world" Best Phil |
|
|