• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Paths & quoted form & do shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paths & quoted form & do shell script


  • Subject: Re: Paths & quoted form & do shell script
  • From: Martin Orpen <email@hidden>
  • Date: Sun, 09 Oct 2005 18:25:09 +0100
  • Thread-topic: Paths & quoted form & do shell script

on 9/10/05 18:02, Paul Berkowitz at email@hidden wrote:

> I think Matt is probably right about the null characters. There are
> interesting coercions in AppleScript that ignore these in some conditions.
>
> What happens if you read as Unicode and then explicitly coerce to string:
>
>     set thePath to (paragraph 1 of (read file tFile as Unicode text)) as
> string

Nothing unfortunately. I tried that as soon as I found that a version of the
string pasted to the Terminal worked as expected, yet "do shell script"
didn't.

> There might still be a trailing or leading null character hanging bout but
> I'd hope that the explicit 'as string' coercion might remove all of them.
>
>>
>> If I write the file using the shell by doing:
>>
>>     echo "/path/to/whatever" > /path/to/the/file
>>
>> The script works as expected and I get what I wanted.
>
> Interesting. How were you writing to the file before?

I read the path, made sure it was a string, opened a file for write access,
wrote the path to the file and then closed it. The plain text file opens and
looks just as I'd expect - a single line of text showing the file path.

Embarrassingly, I've dug myself into this hole because I thought it would be
easier to hack a prefs file for an Xcode project rather than RTFM and learn
how to do it properly :(

That'll teach me...

--
Martin Orpen


 _______________________________________________
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

  • Follow-Ups:
    • Re: Paths & quoted form & do shell script
      • From: "Gary (Lists)" <email@hidden>
References: 
 >Re: Paths & quoted form & do shell script (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: recursion depth
  • Next by Date: Re: recursion depth
  • Previous by thread: Re: Paths & quoted form & do shell script
  • Next by thread: Re: Paths & quoted form & do shell script
  • Index(es):
    • Date
    • Thread