
Running an Automator file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Running an Automator file
Is it possible to run/launch an Automator .workflow file from within LC? ... and how? 

Re: Running an Automator file
Hi,
Use AppleScript for this:
Kind regards,
Mark
Use AppleScript for this:
Code: Select all
tell application "Automator Launcher"
open "/path/to/file.workflow"
end tell
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Running an Automator file
Thank you Mike!
You won two more questions, test your knowledge...
1. And to run an applescript file?
2. Is there differences by run an external AS file and run a AS script from a contained with the command Do as applescript? (I know this one it's a bit naif)
You won two more questions, test your knowledge...

1. And to run an applescript file?
2. Is there differences by run an external AS file and run a AS script from a contained with the command Do as applescript? (I know this one it's a bit naif)
Re: Running an Automator file
Hi,
My name is not Mike. Unfortunately, I don't know your name, that's why I don't include it in the salutation.
You don't need to run an AppleScript file. Just paste the script in a field or store it in a custom property and execute it with
or
If you really want to execute a file, there are a few options. You can save the AppleScript file as an app and launch the app from within LiveCode with the launch command. You can also save the file as a script and run the syntax
Unfortunately, you still need to store a script in a field or customer property this way. An advantage, however, might be that you don't need to store the script each time when you change it.
You can also use the shell to execute the script:
Kind regards,
Mark
My name is not Mike. Unfortunately, I don't know your name, that's why I don't include it in the salutation.
You don't need to run an AppleScript file. Just paste the script in a field or store it in a custom property and execute it with
Code: Select all
do fld "AppleScript" as AppleScript
Code: Select all
do the cAppleScript of me as AppleScript
Code: Select all
put "/path/to/file.scpt" into myPath
put "set myScript to (POSIX file" && quote & myPath & quote && ") as alias" & cr & \
"run script myScript" into myAppleScript
do myAppleScript as AppleScript
You can also use the shell to execute the script:
Code: Select all
put "/path/to/file.scpt" into myPath
put "osascript -e" && quote & myPath & quote into myShell
get shell(myShell)
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Running an Automator file
Hi Mark, sorry for the typo, I think an auto-correction issue. I know your name and also I own your book on LiveCode
Thank you so much for your post very comprehensive (as usual). I think I will go with the way to save the file as a script and run the first syntax you suggested.
I know there are thee formats for an applescript file, if somebody know more, please post here, thank you.
.applescript
.scpt
.scptd

Thank you so much for your post very comprehensive (as usual). I think I will go with the way to save the file as a script and run the first syntax you suggested.

I know there are thee formats for an applescript file, if somebody know more, please post here, thank you.
.applescript
.scpt
.scptd
Re: Running an Automator file
Mark wrote:Hi,
Use AppleScript for this:
Kind regards,Code: Select all
tell application "Automator Launcher" open "/path/to/file.workflow" end tell
Mark
There must be something that I'm wrong...

Code: Select all
tell application "Automator Launcher"
open "/Users/fire/Desktop/OpenPreferences.workflow"
end tell
Re: Running an Automator file
Hi Mag,
That surprised me. However, you can make an Automator app with exactly the same steps as a workflow. Just choose Application instead of Workflow when the dialog appears. Save the "flow" as application and just start the app like a normal app (launch "/path/to/new_application.app"). Does that work for you?
Mark
That surprised me. However, you can make an Automator app with exactly the same steps as a workflow. Just choose Application instead of Workflow when the dialog appears. Save the "flow" as application and just start the app like a normal app (launch "/path/to/new_application.app"). Does that work for you?
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Running an Automator file
I Mark, maybe it's a new security limitation of Mavericks. Thank you for the workaround, This is a much less versatile solution so I will evaluate whether to include it or not.