Forums > MaxMSP

help with shell / applescript

Jan 14 2012 | 3:08 am

There’s one thing I can’t do with midi remote or M4L that I really want to do; ‘select all clips’

I have an Apple script that does it well:

tell application "System Events"
tell process "Live"
set frontmost to true
end tell
key code 0 using command down
end tell
(it works)

and using Luke Hall’s lh.applescript I converted it into a format that Bill Orcutt’s [shell] object should understand.

this works too, when lh.applescript is connected to the [shell] inlet. But I don’t want to convert it every time, I just want a small abstraction that sends CMD+A to the LIVE application. I tried to ‘record’ the output from lh.applescript, but when I play that back into [shell] it doesn’t work.

probably because of Max’s curious way of dealing with text, symbols etc.

Anybody any ideas?

Thank you!!

-- Pasted Max Patch, click to expand. --

But when I capture

Jan 18 2012 | 1:02 am

hi all – anyone that can point me in the right direction for triggering an applescript from Max?

Jan 18 2012 | 7:58 pm

I don’t have Live so I can’t test this, but the output of the javascript is this the following, which should work if you keep it in a message box as the patch demonstrates. The javascript knows how to escape characters that max finds problematic so this should work.

The other alternative is to save your applescript as a file and execute it from your hard drive using the [shell] object.

osascript -e 'tell application "System Events"' -e 'tell process "Live"' -e 'set frontmost to true' -e 'end tell' -e 'key code "0" using command down' -e 'end tell'

— Pasted Max Patch, click to expand. —


Jan 21 2012 | 1:24 pm

It works! thanks so much Luke

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP