Mac Catalina Python 3 code conflict with Indigo Python 2

Posted on
Sat Apr 04, 2020 1:19 pm
wiliamboatright offline
User avatar
Posts: 12
Joined: Nov 30, 2019

Re: Python not working with AppleScript (work-a-round)

Thanks again.

Just for FYI, the AppleScript part of the code Ilast posted works on as a file with Python 3.7 on Catalina OS. As per my first post in this topic, I have Indigo Python produce the thermostat data file.txt and send an email email to my Mac Maiil app. This triggers a mail app rule to run this AppleScript file that populates the Numbers spreadsheet with the file.txt data and the formulae. Been using this method for several weeks with no problems.

As I was wrong starting this topic under this Topic name, is there a way to change this topic's title name so that this topic does not infer a serious problem with Indigo Python and AppleScript? I wouldn't want to mislead people when they are searching this forum for answers.

Posted on
Sun Apr 05, 2020 6:56 am
wiliamboatright offline
User avatar
Posts: 12
Joined: Nov 30, 2019

Re: Python not working with AppleScript (work-a-round)

Again, not sure if best method, but it works. I used the Mac Script Editor app to export the AppleScript file as an application (option- Run Only). Then moved moved new app to Applications folder. The following code was embedded in the Indigo Python script.

Code: Select all
import subprocess, sys

applescript = '''

Tell application "App Name"
   activate
end tell

'''
args = [item for x in [("-e",l.strip()) for l in applescript.split('\n') if l.strip() != ''] for item in x]
proc = subprocess.Popen(["osascript"] + args ,stdout=subprocess.PIPE )

Posted on
Sun Apr 05, 2020 7:38 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Python not working with AppleScript (work-a-round)

wiliamboatright wrote:
As I was wrong starting this topic under this Topic name, is there a way to change this topic's title name so that this topic does not infer a serious problem with Indigo Python and AppleScript? I wouldn't want to mislead people when they are searching this forum for answers.


Try editing your very first post that started this thread, and changing the title there.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Apr 05, 2020 7:55 am
wiliamboatright offline
User avatar
Posts: 12
Joined: Nov 30, 2019

Re: Mac Catalina Python 3 code conflict with Indigo Python 2

That did change the thread title. Subsequent earlier posts' subject remained the same. At least people can see the new thread title and updated subject on new reply posts
Thanks.

Who is online

Users browsing this forum: No registered users and 4 guests

cron