Re: Script to save webloc
Re: Script to save webloc
- Subject: Re: Script to save webloc
- From: Fuller Luther <email@hidden>
- Date: Fri, 09 Jan 2009 15:23:33 -0600
On Jan 9, 2009, at 3:03 PM, Scott Haneda wrote:
The second item I can not solve, is duplicate file names. In my
solution, I do shell script and echo a value into a file name with
redirection ala ">". If the html file name is the same as another
one, the old one will get wiped.
I have a number of AppleScripted applications that copy files to
another folder with an almost certain chance of duplicate file names.
I simply append the original file name with 'space & suffixNr', where
suffixNr is an integer. You search for duplicates in a repeat loop
until you find a name not in use, then use that name. It will cause
problems only if it starts having to use a large value for suffixNr.
Unlikely in my scripts, but your results may vary.
BUT ... There's another little problem that will cause problems if you
don't handle it correctly. You need to append 'space & suffixNr' to
the file name after removing the extension, then reattach the
extension. Remember: the 'name' of an item is the full name including
the extension, while 'name extension' is what follows the last "." in
the name, if it exists. (Don't use 'displayed name', you don't know
where that thing has been.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden