• 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 23:11:59 +0100
  • Thread-topic: Paths & quoted form & do shell script

on 9/10/05 21:07, Gary (Lists) at email@hidden wrote:

> Given your skills and formidable big brain, you've probably ruled that out
> already, but in case not...

How did you know I had a large mate called brian?   :)

I've solved the problem now - and can report that it's a problem that I
caused in the first place :(

This works:

    set myData to choose file
    set myData to POSIX path of myData as string
    set posixT to path to temporary items
    set f to open for access file ((posixT as string) & "mytemp99") with
write permission
    write myData to f
    close access f

    set tFile to (path to temporary items as string) & "mytemp99"
    set thePath to paragraph 1 of (read file tFile) as Unicode text
    do shell script "/usr/bin/grep -i open " & quoted form of thePath


However, if you *ever* fail to coerce the POSIX path from the second line to
a string before writing to the file your script gets hosed *forever*!

I edited the script over and over again. I coerced Unicode text to a string,
but it made no difference because (I'm guessing) the string would not fully
overwrite the Unicode text that I'd mistakenly saved at one point during
writing and testing the script.

Hope that helps somebody who has fallen into the same trap - the safest
thing to do is rename the temp file and move on...

--
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: Christopher Nebel <email@hidden>
References: 
 >Re: Paths & quoted form & do shell script (From: "Gary (Lists)" <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