Forums > MaxMSP

shell script delete and down key.. stopped working

November 3, 2012 | 12:48 am

Hi all, I’ve always struggled with this because I don’t really understand shell scripts. I’m using Bill’s Orcutt’s [shell] external.

WHAT I"M TRYING TO DO
1) with one button (on my Ipad) copy a clip in AbletonLIVE and paste it in the slot below
2) with one button, delete a clip

HOW I"M TRYING TO DO IT
send 3 commands to the shell script, the first is ‘copy’ the second ‘arrow down’ the third ‘paste’

WHAT WORKS
the copy and the paste commands. these are the lines I send to shell:
COPY:
osascript -e ‘tell application "System Events"‘ -e ‘tell process "Live"‘ -e ‘set frontmost to true’ -e ‘end tell’ -e ‘key code "8" using command down’ -e ‘end tell’
PASTE:
osascript -e ‘tell application "System Events"‘ -e ‘tell process "Live"‘ -e ‘set frontmost to true’ -e ‘end tell’ -e ‘key code "9" using command down’ -e ‘end tell’

WHAT DOESNT WORK
the arrow – down. It works when I’m in the file browser, but not when I’m in the clipgrid
the delete key doesn’t work either

These don’t work:
Arrow down
osascript -e ‘tell application "System Events"‘ -e ‘tell process "Live"‘ -e ‘set frontmost to true’ -e ‘end tell’ -e ‘key code 125′ -e ‘end tell’
Delete
osascript -e ‘tell application "System Events"‘ -e ‘tell process "Live"‘ -e ‘set frontmost to true’ -e ‘end tell’ -e ‘key code 51′ -e ‘end tell’

Any ideas? I’m happy to not use the shell script, as long as I can delete clips and copy clips to a slot below I’ll be happy!

Thanks!!!


November 13, 2012 | 6:18 pm

anybody? any ideas how to reliably send a key command to and application (eg LIVE)?
Thanks!


November 23, 2012 | 5:20 pm

well I got it working, not sure what it was – I’m having the same scripts as before. Did lose a lot of time on the following though!

if you’re in patching mode and you use the cmd key to click on user interface elements (eg I send the message ‘delete’ into a patcher that than issues the ‘delete’ key command to an application)….. the cmd key is effectively still down when the key is sent to the application.

so it’s better to make sure your patcher is locked and you don’t use modifier keys when your patch is sending keystrokes…


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