Use of 'path to ... folder creation
Use of 'path to ... folder creation
- Subject: Use of 'path to ... folder creation
- From: Dennis Jones <email@hidden>
- Date: Fri, 6 May 2005 12:55:14 -0700
Can someone give me an example of how to specify a folder to use and
create the folder if it does not exist.
My script uses ~/my-home/tmp to store a temporary file. I need the
script to create the tmp folder if it does not exist. From reading the
'path to' dictionary entry, it looks to me as if it could take care of
this for me.
--code snippit--
on printResults(searchString, wordList)
set homeFolder to path to home folder as string
set tmpFolder to (((homeFolder) as string) & "tmp:") as string
-- would like to create folder 'tmp' if it does not exist.
set lpFile to (tmpFolder & "lp.txt") as string
set fileRef to open for access file lpFile with write permission
write ("Result of search for: " & searchString & return & return &
wordList) as string to fileRef
close access fileRef
display dialog "Printing" buttons {"OK"} default button 1
do shell script "lp ~/tmp/lp.txt"
do shell script "rm ~/tmp/lp.txt"
end printResults
-- dictionary entry --
path to: Returns full path name to the folder or application specified
path to application support/applications folder/desktop/desktop
pictures folder/documents folder/favorites folder/Folder Action
scripts/fonts/frontmost application/help/home folder/internet
plugins/keychain folder/library folder/modem scripts/movies folder/...
-- the folder or application to return
[from system domain/local domain/network domain/user domain/Classic
domain] -- where to look for the indicated folder
[as type class] -- the type to return: alias or string (default is alias)
[folder creation boolean] -- Create the folder if it doesn't
exist? (default is true)
Result: alias -- the path name to the folder or application specified
--
Dennis Jones
email@hidden
_______________________________________________
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