Re: Program arguments
Re: Program arguments
- Subject: Re: Program arguments
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 22 May 2007 12:27:28 -0400
On 5/22/07, Mike Dougherty <email@hidden> wrote:
Well, it is an app. that the user can double-click on to start. But there's
no reason why I can't also call it from the command line. Under normal
circumstances the user can double click "Foobar.app" to start the app. But
occasionally they would like to get "Alternate Behavior 1". Which calls
"Foobar.app" with the argument "alternate1".
Can you modify Foobar.app to look elsewhere for the alternate behavior
request? Like in a file or environment variable?
Command line arguments are, in general, something of a novelty in the
Mac world. Pre-X versions of the OS didn't support them, and programs
that wanted them (like MacPerl) had to fake it somehow. With OS X,
both the UNIX CLI environment and the Mac GUI environment function
very well, but the interfaces between them are still a little rough in
some places, and this is one of them.
It's true that the Info.plist file is static; you could dynamically
modify it, but that's scary. What I've seen done in other ports is
the addition of code to pull arguments from an "arguments.txt" file in
the Resources subdir, where that file has nothing in it but the
arguments themselves in shell syntax, and would therefore be less
scary to modify on the fly.
I thought using an AppleScript for this would have been a good choice
to make alternate behaviors also double-clickable.
Certainly if the app were scriptable and responded to AppleEvents to
set its behavior, an AppleScript launcher would work.
The more Mac-ish way would be to have documents associated with the
application that determine the behavior; then instead of
double-clicking on the app itself, you would double-click on the doc
that goes with the behavior you want. You can force this from the
command line with something like
open -a /Applications/MyApp.app ~/AlternateBehavior1.myapp
Coming from a Unix/Linux world this is a completely different paradigm, as I
am used to being able to pass flags and arguments to programs (GUI and
command-line) to customize their behavior. So I hope you'll pardon me if I
am asking what might seem like obvious-to-the-mac-developer questions.
There's certainly no pardon required, and I apologize if something in
my tone implied otherwise. I'm not much of a Mac developer either,
apart from what I've done in AppleScript.
In my humble and barely-informed opinion, you'll have better luck
exploring alternatives to command-line options. You could fairly
easily develop a cross-platform stored-configuration paradigm based on
saving the config in a file... but we're getting into territory that
has not much to do with AppleScript, and you might get more help from
one of the more hardcore Apple developer forums.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden