How do I open an application from Max?
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.
max launchbrowser $1
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).
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..
Roll your own in Java perhaps (using Runtime.exec)?
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.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 924.3oc2X10SaCCEF95hD+G7h3hMoNH1NoMgcEZzMMI9XhsKlz.gbRLsdKwt JwcPGZ+2miMEJvf5z4RX6l51icse8iO93i8kquVGuDwEzJOv1fuB5z4RkkNZ a0V5LyPGuBxEo4jJcC8JnUUjgTutWUojdgTWwaNt7XtpofbxDd5njRw4UzRv FvqaZNiSSES351ilYULQlSkxoioFg34ANYVcmI3RNoPWi2NkLR90cFKSaTj7 sWi8lu8UrepaODso+L67IELtZTpt0HOlHSGw3COsjlJMCNJLP8u.gvd0EPLr t.q5oazjpuLRV2YPs0es9Z0kphtVCxTQQAUwh6AxwkhDRR9T.MiIAxQTPFqV gLAGb9HZIUaqJsjMVBXUfJxOnY.o.7RBOCjRxyU+7rRQwKdUs0ohIk.NklUs 4edkHngztg3F9H3tOTiabu9ZbGV2GfdOBt8cOt+zf8F71OC93QG99i1YeuFB Cj6fANFWO86GNmqGxuMXw69vdCZHHPwtCDnvna.QLpE3fIDFfLjv3MED8cGH Bh0yc8+ckBhjIRo3lY58BImP3CmKr77S2ddMdZACLQWi8qKBhl8o6iwxomqD 48WekhpoEIhbO2cHDJzka.zjAC06.BiWzB+xCnG7z7MPyexsCvSfKOjViGjY GQfNPI7I0+YLI86fyX4Tf5v5gkjBWRJj6IUO8IKPebK3Is61ac5omt+NeYqc Gr+gGrkIwkpsLwXqywQTtYBQ5RDBcIBwl3SFRdUnqmTusLZNYp0AmsDQ9tGQ A5r3vqvvUODgJU8NEr6gGL3Q7h5tDdRPmlViFS3HSZd8VDlPteuXZNkT1UEY uK37RVMxrbyY2EA2FC1HG5+YxSBGDZtLQzS+VT8WdTWO8tTUIq9RWMDVNLkR LzjzExb14BcBw+Kj6Ezg2BKv2DguevpN2qGBPhwTdlZlJFpSwvB2plxqH2iq .cPsnnUWPsk+NJwdKwzx7hDvq2f7+mW.x4WXAh6+70K.5sDSKycKf9skWvJH XI18WTEZNxs4AKMsS+bj28Yn0iVcE2AaUhIkoyl7ydABvbiXFsRx3j5mKc9V gtcqFwxxn5Fb8rtfkMVnNd9Jk.N4gWMsWbg1Ht5jgZCwEXE4BaGwgrRbAsh3 fHq84fO4hCG9bdCgMZC2Rtb9VANX63xEak37aOwAWj352NZKxpPvwsi3rZQs UjlU9asyAW1sh1RA3rZIE+WqsZCphey0eUgN -----------end_max5_patcher-----------
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..
EDIT: sorry i was wrong with the batch files, max CAN execute them with launchbrowser, there you go, even easier than vbs :)
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!
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 http://cycling74.com/forums/topic.php?id=31813
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. ;)
Forums > MaxMSP