How do I open an application from Max?

CowboyTakeTwo's icon

OS X 10.5.8

I've tried both [aka.shell] and [shell] by bill orcutt, running the command "open -a /Applications/Preview". Nothing happens. Thanks for any help.

Nevermind, figured out I need the .app extension.

pid's icon

;
max launchbrowser $1

xidance's icon

and how appending a filename, e.g. to open a file in an external audio editor?

trying "C:/Program Files/cooledit/coolpro2.exe D:/samples/kick1.wav" works from XP command line, but it doesn´t work with launchbrowser (results in file not found-error message).

11OLSEN's icon

yes if the launchbrowser message would accept command line parameters a lot of hassle with shell externals and mxj would be gone. but there are ways..
i can not tell you much about MacOS but on windows you can execute .vbs (visual basic script) which can do very much, including "call another file with parameters".
what will look like this:

Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
CmdLine1 = """C:Program Files123.exe"""
CmdLine2 = "-w"
CmdLine3 = """C:test it.wav"""
CmdLine4 = """D:Mucketest it_2.wav"""
CmdLine = CmdLine1 & " " & CmdLine2 & " " & CmdLine3 & " " & CmdLine4
oShell.run CmdLine,1,True
Set oShell = Nothing

a vbscript can also delete itself after executing
what's cool about it: you can dynamically create and save scripts in a [text] object, execute them with launchbrowser
what's not so cool: a filename in a script saved with max can sometimes pass the wrong characters to windows because the utf8 encoding. in this case another vbs can convert the current vbs to ANSI characters before it's executed.
what i not know is if vbscripts might be disabled on a certain win-pc because of any security settings if not it is a way without external or mxj..
O.

big_pause's icon

Roll your own in Java perhaps (using Runtime.exec)?

xidance's icon

i never did java, sorry.

but that vsb thing worked out, mommalovin' thanks olsen!

though it will be easier to make good old dos batch, max doesn´t like those "" things.

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

`

11OLSEN's icon

max seems not to execute a batch file. [text] (not [textedit]) doesn't care so much about "" and There's no need to exit things. but in the messages to [text].

e.g. this: CmdLine1 = """C:Program Files123.exe"""
is this in a message: "CmdLine1 = """C:\Program Files\123.exe""""

Here's a snippet for the self deletion http://www.bytemycode.com/snippets/snippet/426/

but that's all not easy enough, i'm currently trying to build a little shell external or at least execution external for win. but as these are my first steps in C, i better not share it at the moment until i know what i'm doing..
O.

EDIT: sorry i was wrong with the batch files, max CAN execute them with launchbrowser, there you go, even easier than vbs :)
O.

xidance's icon

yes the patch i´ve posted works with using the batch (at least on xp and max5).

but thanks for the hint on using slashes!

11OLSEN's icon

this could still not work if you use a file/path with strange characters in the batch.
because win doesn't use utf8 encoding on it's filesystem but max converts it,i think.
as you see here i was struggeling with it https://cycling74.com/forums/how-can-i-save-the-inside-of-text-as-plain-ansi-not-utf-8-encoded

so if you come across this problem add the line "chcp 65001" at the beginning of your batch may help, BUT only on win7,
this command definitely does not work in a batch on xp. that's why i went with vbs
back then which can also convert to ANSI on both winversion.
this is out of interesst of most people? sorry this was spinning around in my head for weeks back then. ;)