Forums > MaxMSP

help with applescript to shell osascript

March 18, 2010 | 2:15 pm

Hi,
I’m trying to "translate" this applescript to the osascript syntax to execute the code from the shell object.

tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Subject text", content:"Content text", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"email address"}
send
end tell
end tell

I can’t figure the right syntax to make it work in osascript syntax.
I have read the other forum threats about it, but i can’t figure it out.
could someone tell me the exact message (with all the e- " ‘ …) i should send to the shell object with that applescript code?
I’ll use a text or coll object to generate e-mails…
Many thanks!
F

note: i already know about the net.mail.send object …


March 21, 2010 | 12:35 pm

In this thread I posted a javascript which you can use to format applescript code in [textedit] for the [shell] object. If you don’t need the user to modify the script you can run an external applescript from [shell] using the file path.

lh


March 22, 2010 | 3:57 pm

Hi Luk,
thanks for your help.
I already try your javascript before posting this topic, but i couldn’t make it work …
i have almost zero knowledge of js. But what i do to try your js is:
[textedit] – [js whatever.js]- [shell]
in my max preferences path’s i put a whatever.js file with your code inside.
when i bang my applescript in the textedit, i don’t get any error message in the max window and shell output bangs but nothing happens in the mail app.
When i run my applescript from an applescript editor it works fine … i run it and a mail is sent by mail.app
I’m doing it allright?
thank you v.m for your time,
F

robot.exnihilo@gmail.com


March 23, 2010 | 4:43 pm

As my conclusion for low level programmers like my self:
in my little experience it looks difficult to deal with osascript syntax if the applescript gets a little bit complex..
so finally i just use shell to run applescript as applications.
it’s much more easy and i manage to do all i needed.
To use data between applications (ex: max and mail) i just write it and read it throw text files.
F


March 3, 2013 | 7:32 pm

I couldn’t get even the osscript command to execute a .scpt file, but what I did find out was a way to execute applications in max. So basically what you can do is write your applescript, save it as a .scpt file, double click it to open the AppleScript Editor, click save as, and make sure under the "file format" option you choose "application". Then, in max, create a message object, and in it type:

;
max launchbrowser file:////Users/username/Desktop/foldername/quitter.app

where obviously you would replace the filepath with your own file path. If you need the file path to your script, just open Terminal, and drag the script into the finder window to output it’s location. Then just copy that path into the message box.



ubu
December 3, 2013 | 2:31 am

Hi, just found this topic.

Could anyone please tell me the the command I have to send to the shell object to run my applescript? – Can’t get it to work ..


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