Re: (no subject)
Re: (no subject)
- Subject: Re: (no subject)
- From: Emmanuel <email@hidden>
- Date: Mon, 22 Jan 2001 23:40:11 +0100
At 13:19 +0100 22/01/01, Dan wrote:
>
A series of applescipts that will add (for instance) .cwk to ClarisWorks
>
files when you drop them into a folder called say add CWK to ClarisWorks
>
Documents, etc, etc...
>
>
or...
>
>
A single script that will interrogate the file, find out it's creator and
>
from a set of variables I have inputted in, eg if creator = ClarisWorks,
>
then add .cwk, if creator = MS Word, then add .doc, etc, etc. Add the
>
appropriate file name suffix to the file. Thankfully this is mainly for
>
the ICT dept, and we generally use as small a filename as possible.
Both programs could rather easily be scripted with just pure AppleScript.
Personnaly, I'd prefer the second one, which would go approximately by the
following pseudo-code (for more details, see in particular Finder's
dictionary, and the Standard Additions' dictionary).
------------------ pseudo-code ! don't even try to run !
-- make a list of the files
set theFileList to list folder (alias theSourceFolder)
-- for each file ...
repeat with theFile in theFileList
-- get its creator
set theCreator to file creator of (info for (alias (theSourceFolder &
theFile)))
-- append suffix
if theCreator is "BOBO" then -- ClarisBerks
tell application "Finder"
set name of alias (theSourceFolder & theFile) to (theFile & ".cwk")
end
end
------------------------------------------------
Of course, in real life, you would test for any already existing file with
the said name, and you would not try making names longer than 31 characters.
HTH
Emmanuel