Content-Type: |
text/plain; charset="US-ASCII" |
Sender: |
|
Subject: |
|
From: |
|
Date: |
Tue, 24 Oct 2006 16:49:51 -0500 |
In-Reply-To: |
|
MIME-Version: |
1.0 |
Reply-To: |
|
Parts/Attachments: |
|
|
Mark:
Thanks for the info.
R,
John A.M. Darnell
Project Leader
Internal Software Development
Walsworth Publishing Company
John may also be reached at johnamdarnell (at) gmail dot com
Trivia question: The United Space Ship Enterprise's second captain was
James T. Kirk. Who was her first captain? Extra credit: What does the
"T" in Kirk's name stand for?
Mark Lively <[log in to unmask]>
Sent by: Macintosh Scripting Systems <[log in to unmask]>
10/24/2006 03:18 PM
Please respond to
Macintosh Scripting Systems <[log in to unmask]>
To
[log in to unmask]
cc
Subject
Re: Building a droplet from an applet
On Oct 24, 2006, at 3:42 PM, John A.M. Darnell wrote:
> It works great. The files, whose type and creator fields are blank
> because they were transferred via UNIX server from a Windows box to
> a Mac
> box are able to function as expected after I run this little task.
>
> If, however, I convert it to this:
>
> on open (FolderSpec)
> set FileList to files in FolderSpec
> repeat with x in FileList
> tell application "Finder"
> set creator type of x to "CARO"
> set file type of x to "PDF "
> end tell
>
> end repeat
> end open
>
> and then drop a folder full of files on it, nothing happens. If I
> inspect FolderSpec, it is the path to the folder dropped on the
> icon. If
> I query the size of the list before I attempt processing, I get 0.
> If I
> get rid of the "set FileList to files..." line, I get all sorts of
> errors
> when I attempt setting creator or file type.
>
> What's so radically different about these two approaches? One
> would think
> that they should operate pretty much the same.
>
Its what you start with.
The open gives you an alias list. You appear to come in with a
finder folder.
This is a tweaked version of yours
on open (FolderSpec)
if (count FolderSpec) = 1 then set FolderSpec to item1 of
FolderSpec
--get the first item may want to add rules to handle getting more
than one item
tell application "Finder" --moved up since AppleScript
doesn't
understand folders
set FileList to files in folder
FolderSpec
repeat with x in FileList
set creator type of x to
"CARO"
set file type of x to
"PDF "
end repeat
end tell
end open
open ({choose folder}) --useful for testing or double clicking
-----
my version with recursion, but still no flair
on RecursiveChangeRoutine(FolderSpec)
repeat with x in FolderSpec
log x
tell application "Finder"
set x to item x
if class of x = folder
then
my
RecursiveChangeRoutine(every item of x as alias list)
else -- may want to put
in an else if to handle things which
aren't files or folders....
set
creator type of x to "CARO"
set file
type of x to "PDF "
end if
end tell
end repeat
end RecursiveChangeRoutine
on open FolderSpec
RecursiveChangeRoutine(FolderSpec)
end open
open (choose folder)
-Mark
Bring me my velcro gloves, I'm in the mood for love!
Captain Pike
Tiberius
|
|
|