Any reason to use the embedded apple script over a seperate file? I can see separate for ease of getting to it if Indigo for some odd reason crashes.
But embedded offers ease of maintenance from a system level approach.
(Its nice to have choices!)
But main Q is, any reason to compile an embedded script? Speed can't be that much better (coms will slow it down anyways)
Embedded AppleScript vs. External File AppleScript
- matt (support)
- Site Admin
- Posts: 21476
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: compile benny?
For small AppleScripts that do not depend on communicating with other applications or network connectivity, I recommend embedded. Non-embedded scripts have the advantage of being run in their own process by Indigo.
This becomes a very big advantage if the AppleScript hangs waiting for a response from an application (ex: iTunes if a modal dialog is open) or a network response (NOAA sync script). If those script were run embedded, then there is the potential the entire Indigo Server will hang while the script waits. But if you run it non-embedded then Indigo Server can keep on processing.
Regards,
Matt
This becomes a very big advantage if the AppleScript hangs waiting for a response from an application (ex: iTunes if a modal dialog is open) or a network response (NOAA sync script). If those script were run embedded, then there is the potential the entire Indigo Server will hang while the script waits. But if you run it non-embedded then Indigo Server can keep on processing.
Regards,
Matt
-
- Posts: 1108
- Joined: Sat Oct 08, 2011 12:33 pm
- Location: Northern Virginia
- Contact:
Re: Embedded AppleScript vs. External File AppleScript
IS there an easy way to create small Applescripts and place them in a directory so functions can be reused?
-
- Posts: 1108
- Joined: Sat Oct 08, 2011 12:33 pm
- Location: Northern Virginia
- Contact:
Re: Embedded AppleScript vs. External File AppleScript
I think I just found the answer from the ApplseScript help pages here. This will do it, right?ryanbuckner wrote:IS there an easy way to create small Applescripts and place them in a directory so functions can be reused?
And, other people can create attachment scripts and share them via the user contribution library - there are already quite a few there. Scripts that are placed in the /Library/Application Support/Perceptive Automation/Indigo 5/Scripts/Attachments/ folder will automatically be loaded when the IndigoServer starts up.
- matt (support)
- Site Admin
- Posts: 21476
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Embedded AppleScript vs. External File AppleScript
Yes, that is exactly what the attachment AppleScripts are for (shared scripting functions).
We highly recommend using Python over AppleScript – it is more reliable and we will be adding more APIs to it in the future.
We highly recommend using Python over AppleScript – it is more reliable and we will be adding more APIs to it in the future.
-
- Posts: 1108
- Joined: Sat Oct 08, 2011 12:33 pm
- Location: Northern Virginia
- Contact:
Re: Embedded AppleScript vs. External File AppleScript
As I switch over and learn Python, can you give me a quick example of where to place the function and how to , I guess import it into the Embedded script to run?
- matt (support)
- Site Admin
- Posts: 21476
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Embedded AppleScript vs. External File AppleScript
This tutorial is the best place to start. Read over the entire page for a good overview, but there is a section on that page that talks about sharing classes/methods across scripts.