MACSCRPT Archives

October 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"John A.M. Darnell" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 24 Oct 2006 14:42:20 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (55 lines)
Hello everyone:

   I am attempting to build a droplet from a successfully running applet. 
The applet looks like this:

set FolderToFix to choose folder

tell application "Finder"
        set FileList to files in FolderToFix
 
        repeat with x in FileList 
                set creator type of x to "CARO"
                set file type of x to "PDF " 
        end repeat
 
end tell

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. 

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?

ATOM RSS1 RSS2