Update Folder Now (was: Re: Script not setting finder label?)
Update Folder Now (was: Re: Script not setting finder label?)
- Subject: Update Folder Now (was: Re: Script not setting finder label?)
- From: Emile Schwarz <email@hidden>
- Date: Tue, 19 Oct 2004 10:20:32 +0200
Hi Aaron at al.,
my first answer was written under time stress and I wasn't happy with it.
So, now I took some minutes to verify it and I have a better answer for you:
tell application "Finder"
copy (choose folder) to zeFolder
update zeFolder with necessity
tell current application
activate
end tell
end tell
or shorter:
tell application "Finder"
update (choose folder) with necessity
tell current application
activate
end tell
end tell
you can even make it a sub and use it with an alias as parameter:
-- this is your main AppleScript
tell application "Finder"
-- Get a Folder to refresh its contents
copy (choose folder) to zeFolder
-- Call the method do to it
doRefreshNow(zeFolder) of me
-- Go back here
tell current application
activate
end tell
end tell
-- This is the method.
-- warning: I didn't make a check to know if the passed object
-- is really a reference to a folder
-- [bug can arise here if you forget that in your main AppleScript]
on doRefreshNow(zeFolder)
-- This have to be here
tell application "Finder"
-- Tell the Finder to update now the passed folder
update zeFolder with necessity
end tell
end doRefreshNow
for the description of 'doRefreshNow(zeFolder) of me' (why must you add 'of me'
at the end of the line), check page 285 of the AppleScript Language Guide (for
AppleScript 1.3.7; 1994 pdf). If you do not have this manual, check in the Apple
web site (don't have the url, sorry).
You can also get the AppleScript Finder Guide at:
<http://manuals.info.apple.com/Apple_Support_Area/Manuals/servers/AppleScriptFinderGuide.PDF>
Aaron Rosenblum wrote:
> What do you mean by "Force Finder Update Now", is this in the Finder AS
dictionary? Sorry, I am not familiar with that command.
>
> Aaron
>
>> Force it to "Update Now" (Now is False by default, thus this mail).
>>
>> HTH?
>>
>> Emile
-- email@hidden --
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden