Applescript to shell issues using osascript

Jun 15, 2012 at 9:01am

Applescript to shell issues using osascript

I felt like I had this somewhat under control, but I have tried everything (from the forum, to trial and error, and google) and cannot get this particular one right. I would appreciate you help!

The usual ” to get this ” is not working in Osascript.

This is the script I need:

tell application “System Events”
set MyList to (name of every process)
end tell
if (MyList contains “Spotify”) is true then
tell application “Spotify” to open location “spotify:track:THIS-NEED-TO-DYNAMIC
end if

I’m fine if I hard code everything, but I need the part that says “THIS-NEED-TO-DYNAMIC” to change as needed. Sprintf is not being my friend (and all other ways).

This feels like the closest:

– Pasted Max Patch, click to expand. –

In Luke’s JS here: http://cycling74.com/forums/topic.php?id=25026 It’s all good (hard coded). It spits out with the line breaks (even into a message box?!), so thought I could recreate this by filling textedit using a separator, also ascii conversions to add a “return”. But no luck.

Everything I try has issues. I don’t understand why its not seeing my ” as “

Thanks for any help!

#46594
Dec 12, 2013 at 8:01am

Hello

I’m not sure it responds to the question, but this one works with Spotify and a valid n° of track.
I’m using tap.applescript, do you use another objet to live applescript ?

<code>

– Pasted Max Patch, click to expand. –

</code>

#275521
Dec 12, 2013 at 12:27pm

Hey! Thanks for responding. This was a year and a half ago so luckily I had found a solution using [shell]

Here is my version:

<code>

– Pasted Max Patch, click to expand. –

</code>

Cheers!

#275547

You must be logged in to reply to this topic.