OS X - drag file onto executable to launch with file as first argument?
I have Mono application which takes a file as the only argument. For example if I invoked the application 开发者_如何学Pythonwith a file named "MyFile.txt" it would be done like so:
Mono app.exe MyFile.txt
In Windows I can simply drag a file onto an executable to run it with that file as an argument. Can I do the same thing in OS X?
You cant simply drag one file onto another by default, so there must be another way of doing it?
One approach would be to use Automator to make an application, which will treat any files dropped on it as an input. A "Run Shell Script" action will let you run the mono app.exe
on the files.
I'm not at my Mac right now, but I don't believe you can drag a file onto your app because the exe would not be considered by OS X to be an application.
Instead you would wrap the exe into a Mac .app that bundled/called Mono. I assume you can do this with MonoMac.
精彩评论