Embedded AppleScript vs. External File AppleScript

This subforum has been locked since we no longer support AppleScript.
anode
Posts: 697
Joined: Sun May 27, 2007 5:33 pm
Location: NC

Embedded AppleScript vs. External File AppleScript

Post by anode »

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)
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: compile benny?

Post by matt (support) »

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
anode
Posts: 697
Joined: Sun May 27, 2007 5:33 pm
Location: NC

Post by anode »

Good stuff! With me away at up to 2 weeks at a clip, less hangs the better. Good guide line.

Thanks.
(great program too. Love the fully scriptable aspect)
ryanbuckner
Posts: 1108
Joined: Sat Oct 08, 2011 12:33 pm
Location: Northern Virginia
Contact:

Re: Embedded AppleScript vs. External File AppleScript

Post by ryanbuckner »

IS there an easy way to create small Applescripts and place them in a directory so functions can be reused?
ryanbuckner
Posts: 1108
Joined: Sat Oct 08, 2011 12:33 pm
Location: Northern Virginia
Contact:

Re: Embedded AppleScript vs. External File AppleScript

Post by ryanbuckner »

ryanbuckner wrote:IS there an easy way to create small Applescripts and place them in a directory so functions can be reused?
I think I just found the answer from the ApplseScript help pages here. This will do it, right?
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.
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Embedded AppleScript vs. External File AppleScript

Post by matt (support) »

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.
Image
ryanbuckner
Posts: 1108
Joined: Sat Oct 08, 2011 12:33 pm
Location: Northern Virginia
Contact:

Re: Embedded AppleScript vs. External File AppleScript

Post by ryanbuckner »

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?
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Embedded AppleScript vs. External File AppleScript

Post by matt (support) »

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.
Image
Locked

Return to “AppleScript Scripting”