• 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: Searching for a folder in Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching for a folder in Applescript


  • Subject: Re: Searching for a folder in Applescript
  • From: "Marc K. Myers" <email@hidden>
  • Date: Thu, 4 Sep 2003 15:44:05 -0400

Date: Thu, 04 Sep 2003 09:33:51 -0700
Subject: Searching for a folder in Applescript.
From: Vic Piercy <email@hidden>
To: <email@hidden>

I need to write a script that will be placed in the Login items that runs
every time a user logs in. It will create a folder with the current date in
the users Home folder. I have the script ready but I cant figure out how to
have it check for the folder in case of a reboot in the same day the script
will say 3There is a folder by that name already please choose a new name2.
In a nutshell, I need it to check for the folder first if it is there then
the script will end. If it is not there then it will create a new folder
with the current date. So each day when I log in it will automatically
create a today's date folder in the Home folder.'

This will create the folder in the current user's home directory. The folder name/date is in the format "2003 09 04" so the folders will appear in the directory in sequential order by date.

set theDate to (do shell script "date \"+%Y %m %d\"")
set thePath to (path to "root" from user domain)

try
tell application "Finder"
make new folder at folder thePath with properties {name:theDate}
end tell
on error
set oldName to theDate
repeat
try
set newName to text returned of (display dialog "Folder " & "\"" & oldName & <line break>
"\"" & " already exists. Please choose a new name:" default answer oldName <line break>
buttons {"New Name"} default button 1)
set oldName to newName
tell application "Finder"
make new folder at folder thePath with properties {name:newName}
end tell
exit repeat
end try
end repeat
end try

Marc [09/04/03 3:43:25 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Microsoft Word 5.1 versus Word for Office X
  • Next by Date: Re: Do shell script question
  • Previous by thread: Re: Microsoft Word 5.1 versus Word for Office X
  • Next by thread: Scripting the ToolBar in OSX?
  • Index(es):
    • Date
    • Thread