|
|
osascript, shebang, and unicode arguments
Your life might get a bit easier with a "here document" construct. The following example runs applescript code for a directory browser from within a shell script, and returns the full posix path of the chosen directory:
osascript, shebang, and unicode arguments
He mentioned this, and his reason it was not adequate, about two paragraphs after the summary post.
osascript, shebang, and unicode arguments
You are right -- I missed it. Damn the NyQyl (TM) hangover.
But either I don't understand the objection, or else it is mistaken.
Here is another, slightly more complex example:
osa_display_dialog foo bar foobarThis gives three buttons, the third as the default, and returns the user's choice. I didn't escape anything...
osascript, shebang, and unicode arguments
Your first script works, your second does not. Here is what I am talking about. (I just figured-out how to use Polish characters on this site.) Suppose I have this directory:
~/Ł And I choose it with your first script:
See the c5 81 in the hexdump? That is the UTF-8 for "LATIN CAPITAL LETTER L WITH STROKE". Replacing "choose folder" with "choose file" in your script does the right thing for files too. But what is the point of a shell script that makes you choose the files one by one in a dialog box, I want them from the command line and besides the arguments need not be files, but simply strings.
Now I have a file DŁN.JPG and your second script has this output:
See the hex e2 89 88 c3 85, that is all messed-up, since my encoding is macroman. Also the text is munged in the dialog box itself. The hint offers a way for passing arguments to an AppleScript from the command line without arguments with international characters such as Ł getting munged.
osascript, shebang, and unicode arguments
The point is to use them as building blocks for more complicated GUI scripting. By themselves, they aren't worth much. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.15 seconds |
|