how to run an applescript with "shell" object?

Jul 12, 2008 at 11:32pm

how to run an applescript with "shell" object?

can anyone tell me how?

thank you so from madrid!!

#38857
Jul 13, 2008 at 8:35am

#135908
Jul 13, 2008 at 11:15am

hello, I try but nothing happenps!,

I just want to display an screen message when I do some tasks with max

something like this:

tell application “MaxMSP”
activate
tell application “AirClick”
simulate virtual key code 17
display message “Button 1″
tell application “TextEdit”
activate
end tell
end tell
end tell

how could I do it?

thanks!

#135909
Jul 13, 2008 at 11:40am

Try typing ‘man osascript’ in the terminal to see what arguments
osascript needs.

#135910
Jul 13, 2008 at 12:06pm

hello, this is the simple script I need to run… and it

#135911
Jul 13, 2008 at 1:40pm

did you try to paste that line directly in the terminal? Was there any
error message, or any kind of feedback?
you can also write a script to a file, and let osascript use it(also
try with the terminal first, then with max).

I can’t fully test this out since I don’t have the “SEC Helper” app,
but I suspect that the character ` before the word “using” could be a
problem here.

On Jul 13, 2008, at 2:06 PM, gamuso wrote:

>

#135912
Jul 13, 2008 at 2:36pm

hello, thanks for helping…

but I

#135913
Jul 13, 2008 at 4:18pm

try this: save script as “mybestscriptever.scpt” in the same folder
where your patch is saved, and then call it with:

osascript mybestscriptever.scpt

or if you’re using the -e approach, you’re probably entering the world
of symbolic pain. simple example would be message box with the:

osascript -e’tell application “Finder”‘ -e activate -e end tell

> so, HOW HAVE I GOT TO WRITE IT TO MAKE IT WORK ON [SHELL]?

it’s really very very simple: just study carefully the way max handles
symbols, osascript manual, actionscript, shell(s), google for error
messages, search max forum and eventually you’ll figure it out.

#135914
Jul 13, 2008 at 8:16pm

well, since I wrote ‘actionscript’ instead of applescript(and because
information about escapes and symbols is dispersed throughout the
docs&forum), I’ll give you a hint:

whole osascript line should be one symbol, meaning you should put all
of it in quotes.

but since there are already quotes in your call (“SEC Helper”), and
they have special meaning in max, you’ll have to escape them with ,
meaning: insert before ” to get “, but not before first and last
double quotes(which define max symbol).

I’ve just installed sec helper thing, typed correctly formated
message, and it worked, so you know now it’s possible.

If this is too urgent for you, and you don’t want to know at this
point how symbols in max work, look here what to type into the message
box to make it work:

http://jit.playground.googlepages.com/sechelp.txt

#135915
Jul 13, 2008 at 9:13pm

#135916
Jul 14, 2008 at 2:59pm

ey, thanks to you all,

this info is helpfull for me!

thankyou so

#135917
Jul 15, 2008 at 5:34pm

my applescript is:

tell application “Live”
activate

tell application “System Events”
key down command
keystroke “w”
key up command
keystroke “d”
end tell
end tell

tell application “Live”
activate

set new_file to “Macintosh HD:Users:andrewrobertson:Work:Live:MyLiveSets:B-Keeper2008:B-KeeperTemplate2.als”
open file new_file
end tell

this works fine in script editor

however, when I start trying things like:

osascript -e ‘tell application “live” ‘ -e ‘activate’ -e ‘end tell’ -e ‘tell application “System Events”‘ -e ‘key down command’ -e ‘keystroke /”w/”‘ -e ‘key up command’ -e ‘keystroke /”d/”‘ -e ‘end tell’

with shell, it doesn;t work.

What’s the method with scpt – I haven’t got that working yet, and how do you deal with enter and apostrophes etc..?

Can anyone give a very clear answer for a simple script that will work whilst also using more than one line?

Cheers,
Andrew

#135918
Jul 15, 2008 at 5:57pm

Hi,

Okay…so within minutes I’m answering my own question (well, with some help from Enrique, talented colleague..) – maybe I should have tried this before ..but this may help others too

[osascript users/andrewrobertson/Work/MadMax/MaxPatches/Refresh.scpt]

[ ] is the message box

into shell runs the script

open users/andrewrobertson/Work/MadMax/MaxPatches/Refresh.scpt

will open it.

I think I made a slip-up with a dash or something.
Easiest way to check – put it right back at the root and move up from there…

This would seem a much better way to run applescript than the -e ‘ /” etc

#135919

You must be logged in to reply to this topic.