Re: How write to a file in an invisible folder ?
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