Import Subprocess osascript versus Import Applescript

Posted on
Thu Apr 19, 2018 12:03 pm
Monstergerm offline
Posts: 274
Joined: Sep 01, 2009

Import Subprocess osascript versus Import Applescript

What are the pros and cons of running applescripts in the python environment using either the older subprocess osascript method versus importing applescript?

Posted on
Thu Apr 19, 2018 1:04 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Import Subprocess osascript versus Import Applescrip

The subprocess is going to be harder to execute long scripts, but easy to execute an actual script file. The AppleScript library can do better at 'ad lib' scripting. My plugin uses the AppleScript library to run script files directly.

Mostly it's whatever your preference is and what the need is.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Apr 24, 2018 9:18 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Import Subprocess osascript versus Import Applescrip

Using subprocess will, as the name applies, create a new process for the script to run in which is inherently a more expensive operation than just importing py-applescript.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest