Forums > MaxMSP

applescript pro needed

June 21, 2007 | 11:57 am

hello,
i’m searching the commands to use with the shell object to move the cursor inside ableton live…
i mean to do keystroke "direction" ( up down right left ) and keystroke "enter"
i googled osascript but i didn’t found or didn’t understood :o ..

any idea?

zank you

freeka


June 21, 2007 | 2:09 pm

Hi Freeka,

To move the cursor, click etc you can use aka.mouse in Max: http://
http://www.iamas.ac.jp/~aka/max/#aka_mouse

This may be an easier solution for you if you already know Max.

Best,

Chris

On 21 Jun 2007, at 12:57, freeka wrote:

>
> hello,
> i’m searching the commands to use with the shell object to move the
> cursor inside ableton live…
> i mean to do keystroke "direction" ( up down right left ) and
> keystroke "enter"
> i googled osascript but i didn’t found or didn’t understood :o ..
>
> any idea?
>
>
> zank you
>
> freeka

………………………………………………………………

Christopher McClelland
Sonic Arts Research Centre
Queens University Belfast
BT7 1NN
Email: c.mcclelland@qub.ac.uk


June 21, 2007 | 2:16 pm

uh excuse me , my explications are not totally good,
in fact this is not the mouse cursor that i wanna move..
In live ableton when you are on sampler mode you have like a grid with your samples, and you can move a selection with direction keystroke and trig/stop the sample with the "enter" keystroke.

my interest is to move that selection in live with a gamepad or midi interface ..
so i know i can do it with max and hi, i just need to know how to scrip it to keystroke live : )

thanks

freeka


June 21, 2007 | 3:07 pm

You may want to explore the newly release (unoffical) Live API:

http://www.liveapi.org

Dan

At 8:16 AM -0600 6/21/07, freeka wrote:
>uh excuse me , my explications are not totally good,
>in fact this is not the mouse cursor that i wanna move..
>In live ableton when you are on sampler mode you have like a grid
>with your samples, and you can move a selection with direction
>keystroke and trig/stop the sample with the "enter" keystroke.
>
>my interest is to move that selection in live with a gamepad or midi
>interface ..
>so i know i can do it with max and hi, i just need to know how to
>scrip it to keystroke live : )
>
>
>thanks
>
>
>freeka


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com


June 21, 2007 | 3:10 pm

…and you’re asking about doing something in Live
*here* because….


June 21, 2007 | 5:21 pm

hey mr Taylor
At the end of chain, the last action is in live but i’m talking about max, shell and osascript…
how to send to an other application, using shell, the message keystroke "up / down /left / right/ enter"

mmmm

freeka


June 21, 2007 | 6:40 pm

Cycling hasn’t exactly distanced themselves from Ableton.

b

On Jun 21, 2007, at 8:10 AM, Gregory Taylor wrote:

>
> …and you’re asking about doing something in Live
> *here* because….
>
> –
> knowledge is not enough/science is not enough/Love is dreaming this
> equation

barry threw
composition : sound : programming
http://www.barrythrew.com
bthrew(at)gmail(dot)com
857-544-3967

And I know not if, save in this, such gift be allowed to man,
That out of three sounds he frame, not a fourth sound, but a star.
-Robert Browning


June 21, 2007 | 8:16 pm

Quote: freeka wrote on Thu, 21 June 2007 13:57
—————————————————-
> I’m searching the commands to use with the shell object to move
> the cursor inside ableton live…
> i mean to do keystroke "direction" ( up down right left ) and
> keystroke "enter"
> i googled osascript but i didn’t found or didn’t understood
—————————————————-

Hi,

Spotlight your HD for a script called "Key Down-Up.applescript" and change this script for your needs.
Once done, adapt its contents for ‘osascript’.

PG


June 22, 2007 | 1:59 am

Quote: freeka wrote on Thu, 21 June 2007 13:57
> —————————————————-
> > I’m searching the commands to use with the shell object to
> > move the cursor inside ableton live…
> > i mean to do keystroke "direction" ( up down right left ) and
> > keystroke "enter"
> > i googled osascript but i didn’t found or didn’t understood

—————————————————-
> Spotlight your HD for a script called "Key Down-Up.applescript"
> and change this script for your needs.
> Once done, adapt its contents for ‘osascript’.
—————————————————-

> yes its ok but i still don’t find the command to "call" the
> direction key…

For example:
tell app "TextEdit" to activate
tell app "System Events"
keystroke (ASCII character 28) — left arrow key
end tell

Or:

tell app "TextEdit" to activate
tell app "System Events" to keystroke (ASCII character 28)

> I seen somewhere direction need to use ascii character

Yes, or the key codes:

keystroke (ASCII character 28)–left
key code 123 — left arrow Key

keystroke (ASCII character 29)–right
key code 124 — right arrow Key

keystroke (ASCII character 30)–up
key code 126 — up arrow Key

keystroke (ASCII character 31)–down
key code 125 — down arrow Key

I suggest to use "Accessibility Inspector" if you have Xcode installed:

If not, you can download "UIElementInspector":

< http://developer.apple.com/samplecode/UIElementInspector/index.html>

Or better, "UI Browser" by Prefab:
<
http://prefabsoftware.com/uibrowser>

HTH,
Philippe


June 23, 2007 | 3:12 am

Quote: freeka wrote on Thu, 21 June 2007 13:57
—————————————————-
Hi freeka,

> the patch you gave me works perfect!

Nice! ;-)

> i don have screenshot but to have an idea go to max/msp
> jit.cellblock.help
> select a cell with your mouse and then use direction keys to
> change your cell (the hilight one)
> this is what i wanna do but inside live using a gamepad via hi
> object in max.

> make it sense??

Yes, definitely. I don’t have yet a working patcher for this purpose but I’m going to build one as your needs meet my own needs!
And it’s what I understood when I read your posts: your script will need the {x, y} coordinates of the window bounds and each included UI elements.

> anyway the patch you gave me seems to work perfect :)

Normally, all we can do from within a script editor such "Script Editor", "Smile", "Script Debugger" or even "Xcode" can be performed from within Max through the "System Events", including the use of scripting additions (aka osax or osaxen).
The main problem is about statement formatting as message box in Max, like for the script below you can copy-paste into a "Script Editor" script window and run:

No danger for Max ;-)

Enjoy and see you soon!
Philippe

==============No Break==============

set the clipboard to "" as text –> empty the clipboard

activate application "MaxMSP" — only if you need to put MaxMSP as the foreground app. Optional.

– Create a new Max text window. Do it once and then inhibit this block:
tell application "System Events" to tell process "MaxMSP"
click menu item "Text" of menu 1 of menu item "New" of menu 1 of menu bar item "File" of menu bar 1
click menu item "12" of menu 1 of menu bar item "Font" of menu bar 1
end tell

tell application "System Events"
key down option
keystroke "e"
key up option
keystroke "e"
keystroke "e" using option down
keystroke "e"
key down shift
keystroke "p"
key up shift
key down option
keystroke "p"
key up option
key down {shift, option}
keystroke "p"
key up {shift, option}
keystroke "p" using {shift down, option down}
keystroke return

– stroke your keys ;-)
delay 2
keystroke (ASCII character 28) — left arrow key
key code 123 — left arrow Key
delay 2
keystroke (ASCII character 29) — right arrow key
key code 124 — right arrow Key
delay 2
keystroke (ASCII character 30) — up arrow key
key code 126 — up arrow Key
delay 2
keystroke (ASCII character 31) — down arrow key
key code 125 — down arrow Key
end tell
====================================

Here a Max patcher with AppleScript dialogs that shows how to escape double-quote and comma characters used by Max as tokens:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 180 278 212 196617 Launch an AppleScript script from a ‘textedit’;
#P button 180 295 24 9;
#P newex 180 412 53 196617 route text;
#P window setfont "Sans Serif" 10.;
#P user textedit 180 326 392 408 6586368 3 10 ‘tell application |MaxMSP| to display dialog |AppleScript in Max?| buttons {|Yo|} default button 1 with icon 1′;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P message 104 218 257 196617 ‘beep 2′ -e ‘tell application |MaxMSP| to display dialog |AppleScript in Max? really?| buttons {|Cancel|? |Later|? |Right now|} default button |Right now| with icon note’;
#P window linecount 1;
#P message 46 89 292 196617 ‘tell application |MaxMSP| to display dialog |Bing| with icon 2′;
#P message 24 48 314 196617 ‘tell application |MaxMSP| to display dialog |Glurps!| with icon 0′;
#P window linecount 2;
#P message 90 179 308 196617 ‘tell application |MaxMSP| to display dialog |AppleScript in Max… ?| buttons {|Yes|} default button 1 with icon 1′;
#P window linecount 1;
#P newex 8 476 61 196617 print Result;
#P message 59 111 437 196617 ‘tell application |MaxMSP| to display dialog |Enter search term:| default answer || with icon note’;
#P window linecount 2;
#P message 75 138 380 196617 ‘tell application |MaxMSP| to display dialog |Enter your password:| default answer || buttons |Connect| default button 1 with icon 1′;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 356 65 135 196620 icon caution or icon 2;
#P comment 356 46 135 196620 icon note or icon 1;
#P window setfont "Sans Serif" 9.;
#P message 36 68 302 196617 ‘tell application |MaxMSP| to display dialog |Nice Max| with icon 1′;
#P message 8 23 276 196617 ‘tell application |MaxMSP| to display dialog |Blah Blah Blah|’;
#N vpatcher 537 151 884 400;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P comment 197 86 126 196617 165 is the (alt-@) bullet ?;
#P window linecount 2;
#P comment 7 81 123 196617 124 is the (alt-shift-L) vertical slash character |;
#P window linecount 1;
#P comment 27 113 105 196617 34 is the double-quote;
#P newex 134 43 98 196617 prepend osascript -e;
#P newex 159 111 17 196617 44;
#P newex 134 111 17 196617 34;
#P newex 134 84 60 196617 sel 124 165;
#P newex 134 166 34 196617 itoa;
#P newex 134 147 34 196617 thresh;
#P newex 134 62 26 196617 spell;
#P newex 134 185 34 196617 shell;
#P comment 192 113 124 196617 44 is the comma tokenizer;
#P outlet 134 204 13 0;
#P inlet 134 28 13 0;
#P connect 0 0 10 0;
#P connect 10 0 4 0;
#P connect 4 0 7 0;
#P connect 7 0 8 0;
#P fasten 7 2 5 0 189 130;
#P connect 9 0 5 0;
#P connect 8 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 1 0;
#P connect 7 1 9 0;
#P pop;
#P newobj 8 447 84 196617 p tokensEscaping;
#B color 5;
#P window setfont "Sans Serif" 12.;
#P comment 356 27 134 196620 icon stop or icon 0;
#P window setfont "Sans Serif" 9.;
#P comment 365 232 68 196617 beep , beep :-);
#P user panel 168 272 236 166;
#X brgb 255 247 207;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P background;
#P user panel 350 21 146 67;
#X brgb 255 247 207;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P background;
#P connect 16 0 17 0;
#P connect 18 0 16 0;
#P connect 4 0 11 0;
#P fasten 17 0 4 0 185 437 13 437;
#P connect 15 0 4 0;
#P connect 12 0 4 0;
#P connect 9 0 4 0;
#P connect 10 0 4 0;
#P connect 14 0 4 0;
#P connect 6 0 4 0;
#P connect 13 0 4 0;
#P connect 5 0 4 0;
#P window clipboard copycount 20;


June 23, 2007 | 3:21 am

Sorry, part of the patcher is not correctly displayed.
Here it is as attachment, "AS_Dialogs.txt".

Bye,
PG


June 23, 2007 | 2:43 pm

Thanks you Philippe :)

freeka


March 11, 2008 | 11:05 pm

a little OT, but is there anything similar to aka.mouse for windows, or can someone post the code here, please? Thanks for reading ;)


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