Re: Program arguments
Re: Program arguments
- Subject: Re: Program arguments
- From: Bill Briggs <email@hidden>
- Date: Mon, 21 May 2007 13:03:24 -0300
At 8:51 AM -0700 5/21/07, Mike Dougherty wrote:
>On May 21, 2007, at 8:28 AM, Bill Briggs wrote:
>
>>Knowing something about the application would be good, but in the absence of that, you might have to pipe the arguments in, as you do in an application like bc.
>>
>>If you want to pass anything from stdin to bc (as opposed to interactive mode) you need to write it like this.
>>
>>echo "last=0;for(x=1;x<100;x++) print (last + (1/(x^2))), \" \n\"" | bc
>>
>>and bc takes the input and your result appears in stdout. I suspect that piping the arguments would work, but as I say, not knowing what the application wants makes it difficult to say for sure. Note that the above expression would have to be put in a "do shell script" statement and the appropriate characters escaped for AppleScript.
>>
>>But the simple use of "options", as suggested by Tobias, may work. We're in the dark a bit here.
>>
>>- web
>
>Thanks for your responses, I appreciate the help.
>
>What would you like to know about the application? I'm not sure what more information I can give you that would help you.
>
>I've tried the "do shell script ''", but that leaves the Script window open while the application is running. Not very elegant, and I doubt my client is going to want that for his customers.
Well, that should be easy to stop. If you put an ampersand (&) at the end of your "do shell script" string, this will spawn a sub-shell to run the command in the background and return a 0 from the shell to the script, so that should allow the script to terminate properly while the process or application you spawned continues merrily along.
>Also, calling the application as a shell script requires the AppleScript to know the absolute path of the application before shipping the script. Since this application, and its associated AppleScripts will be distributed to users, who may put the application anywhere on their hard drive, I don't think a shell script solution will work.
If you are delivering this script as an application, then get the customer to locate the application for the script on first run and store that location in a property. On subsequent runs it should "know" where the application is and run the shell script. If someone moved it, have them locate again.
Apart from that you could use "find" in the shell to locate it. Find is darn fast, and if you can restrict the search area to the applications folder and not have to search the entire machine you'll find the application quickly.
- web
_______________________________________________
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