Resend: Re: Newbie plea
Resend: Re: Newbie plea
- Subject: Resend: Re: Newbie plea
- From: Michelle Steiner <email@hidden>
- Date: Thu, 16 Nov 2000 09:49:40 -0800
The previous message hit a bug in emailer that truncated the message.
Sorry.
On 11/16/00 5:24 AM, email@hidden <email@hidden> wrote
>
I have written a simple script which is attached to a folder on my desktop
>
When a file is dropped into the folder, the script changes the file type and
>
creator type to what I need.
>
>
The script works fine as long as the folder is open and I drag the file into
>
the window. If I drop the file onto the folder icon, it merely copies into
>
the folder with no changes. What am I missing?
You're not missing anything; folder actions work only on open folders.
However, there's an OSAX that lets folder actions work on closed folders
as well.
An alternative is to compile the script as a droplet. Here are two
examples:
This one toggles a SimpleText document between TEXT and ttro
on open {thefile}
if the file creator of (info for thefile) is "ttxt" then
tell application "Finder"
if the file type of thefile is "ttro" then
set the file type of thefile to "TEXT"
else
set the file type of thefile to "ttro"
end if
end tell
end if
end open
This next one changes the creator to the application of your choice. It
defaults to GKON, which is Graphic Converter. To change the application,
run the droplet, and it will ask you to choose which application to use;
this change is persistent, and will remain until you choose another
application. To change files, drop them onto the droplet.
property CreatorType : "GKON"
set theApplication to choose file with prompt ,
"Choose the application to be creator of the converted files.",
of type {"APPL"}
set the CreatorType to the file creator of (info for theApplication)
on open theItems
repeat with theItem in theItems
tell application "Finder"
set the creator type of file theItem to the CreatorType
end tell
end repeat
end open
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------