Re: What is the limit on osascript command ?
Re: What is the limit on osascript command ?
- Subject: Re: What is the limit on osascript command ?
- From: Paul Taylor <email@hidden>
- Date: Thu, 10 Apr 2008 13:55:17 +0100
Hi ok I found (one of the problems) , I now write the script to a file
and then run osascript passing the file as the only argument. (It is
easier for me to write to an actual file than use the << EOSCRIPT
because I am
generating the script from another programmming language) and it failed
with error 1.
tell app "iTunes"
set new_playlist to (make user playlist with properties
{name:"Jaikoz:4/10/08 1:31 PM"})
add(POSIX file "/Users/paul/Music/iTunes/iTunes Music/Bebel
Gilberto/Unknown Album/Japanese Batucada.mp3") to new_playlist
add(POSIX file "/Users/paul/Music/iTunes/iTunes Music/*bee?*/A Hard Days
Night/When I Get Home.mp3") to new_playlist
repeat with nexttrack in (get every track of new_playlist)
refresh nexttrack
end repeat
end tell
I then ran it again using script editor, and it showed me the error it
couldnt find the folder *bee? *This was because it wasnt actually the
folder name it was beeǿ (unicodechar 01ff in case this isnt displayed
properly) and when
I created the file I just used the default encoding for converting my
characters to bytes and I assume the default encoding is not capable of
encoding 01ff properly.
So I corrected my program to write the characters using utf8 encoding,
now when I look at the file using* cat *in a Terminal window the line
looks like:
add(POSIX file "/Users/paul/Music/iTunes/iTunes Music/*beeǿ*/A Hard Days
Night/When I Get Home.mp3") to new_playlist
which is correct, but the program still fails and when I run or view it
in the Script editor, the lines looks like this (note << is one character)
a
add(POSIX file "/Users/paul/Music/iTunes/iTunes Music*/bee<<ǿ*/A Hard
Days Night/When I Get Home.mp3") to new_playlist
So the question is what encoding do I have to use for osascript to
correctly find the file referred to my the file path
paul
Mark J. Reed wrote:
Same result, but no tempfile is ever created. The shell just feeds
the data to osascript as its standard input stream.
This is, notably, different from the here-documents in later languages
such as Perl and PHP, which just construct strings, not phantom files,
and so would still call for the -e in a situatuion like this.
On 4/10/08, Paul Taylor <email@hidden> wrote:
Sorry I misread the fix , I just added the EOSCRIPT bit I didnt notice
-e parameters had disappeared. I see now the EOSCRIPT is just a away of
creating a temporary file and then invoking osascript with the temporary
file.
_______________________________________________
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
_______________________________________________
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