• 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: How write to a file in an invisible folder ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How write to a file in an invisible folder ?


  • Subject: Re: How write to a file in an invisible folder ?
  • From: Graff <email@hidden>
  • Date: Mon, 20 Sep 2004 20:35:53 -0400

On Sep 20, 2004, at 7:43 PM, Malcolm Fitzgerald wrote:

email@hidden wrote:

View and try the following code -

set fileToCreate to "/ticker/TestFile.txt"
do shell script ("touch " & fileToCreate)
set filePath to POSIX path of file fileToCreate -- Convert UNIX path to Mac path format.
--> "/:.ticker:TestFile.txt"


What is that slash doing there?

I believe that's because the usage is incorrect. What you really should use is the "POSIX file" command , not the "POSIX path" command:
----
set fileToCreate to "/ticker/TestFile.txt"
do shell script ("touch " & fileToCreate)
set filePath to (POSIX file fileToCreate) as string -- Convert UNIX path to Mac path format.
--> "rootDiskName:ticker:TestFile.txt"
----


POSIX file takes in a string containing a POSIX-formatted path to a file and returns an AppleScript file object, which you can then coerce to a string.

POSIX path takes in a string containing Finder-formatted path and returns a string containing POSX-formatted path. It's often good idea to use the command "quoted form of" to properly quote the POSIX-formatted path so that stuff like spaces doesn't mess up a shell tool:
----
set fileToCreate to "/ticker/Test File.txt"
do shell script ("touch " & quoted form of fileToCreate)
----


- Ken


_______________________________________________ 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
References: 
 >Re: How write to a file in an invisible folder ? (From: email@hidden)
 >Re: How write to a file in an invisible folder ? (From: Malcolm Fitzgerald <email@hidden>)

  • Prev by Date: NSReceiverEvaluationScripError: 4
  • Next by Date: Re: NSReceiverEvaluationScripError: 4
  • Previous by thread: Re: How write to a file in an invisible folder ?
  • Next by thread: Re: How write to a file in an invisible folder ?
  • Index(es):
    • Date
    • Thread