Re: Paths & quoted form & do shell script
Re: Paths & quoted form & do shell script
- Subject: Re: Paths & quoted form & do shell script
- From: Matt Neuburg <email@hidden>
- Date: Sun, 09 Oct 2005 09:11:57 -0700
- Thread-topic: Paths & quoted form & do shell script
On Sun, 09 Oct 2005 02:01:24 -0700, Paul Berkowitz <email@hidden>
said:
>On 10/9/05 1:51 AM, "Martin Orpen" <email@hidden> wrote:
>
>> on 9/10/05 02:39, Mark J. Reed at email@hidden wrote:
>>
>>> Well, this script works for me:
>>>
>>> set thePath to "/Users/martinorpen/Documents/Photoshop Edit Log.txt"
>>> do shell script "/usr/bin/grep -i saved " & quoted form of thePath
>>>
>>> Maybe the path in the text file is weird? It doesn't include quote
>>> marks in the file, does it?
>>
>> They are identical to the human eye, identical in class, but not identical
>> to AS:
>>
>> set theFlag to false
>> set tFile to (path to temporary items as string) & "PSLogTest.txt"
>> set thePath to paragraph 1 of (read file tFile)
>> log thePath
>> set otherPath to "/Users/martinorpen/Documents/Photoshop Edit Log.txt"
>> log otherPath
>> if thePath is equal to otherPath then
>> set theFlag to true
>> end if
>> log theFlag
>>
>> What I see in the Event Log is:
>>
>> (*/Users/martinorpen/Documents/Photoshop Edit Log.txt*)
>> (*/Users/martinorpen/Documents/Photoshop Edit Log.txt*)
>> (*false*)
>>
>>
>> But, I've just realised that the strings aren't identical to Entourage
>> either - look what I get when I paste:
>>
>> (*/Users/martinorpen/Documents/Photoshop Edit Log.txt*)
>> (*/Users/martinorpen/Documents/Photoshop Edit Log.txt*)
>> (*false*)
>>
>> Or Text Edit:
>>
>> (**)
>> (*/Users/martinorpen/Documents/Photoshop Edit Log.txt*)
>> (*false*)
>>
>> What the bloody hell is going on?
>>
>> (The original text file was written using "open file for access/write to
>> file/close file")
>
>I suggest you ask for the class of each path. Also try reading the file as
>Unicode text, then compare.
Yes, I just ran into something similar myself. Because of the way I was
collecting the pathname (POSIX path of (path to temporary items)) and
passing it around, it had null characters in it that I didn't know about
(because it was UTF16). This made no different to AppleScript, but I was
passing this on to the command line by way of a completely different program
(Frontier, if you must know), and this broke. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden