help with shell / applescript

Basvlk's icon

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?

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you!!

But when I capture

Basvlk's icon

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

Luke Hall's icon

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'
Max Patch
Copy patch and select New From Clipboard in Max.

`

Basvlk's icon

It works! thanks so much Luke