Refresh Folder Content

Hello, I’m using Google Chrome as my default web browsers. When i download a files to my “Downloads” folder, the files dont show up in my dock stack correctly. I either have to kill the dock or remove a different file from the folder and then the previous download file will show in the stack. i was wondering if i could use applescript to refresh the folder content every time the a file is add to the folder…Thanks

Model: MacBook Pro
AppleScript: 2.1.2
Browser: Google Chrome 12
Operating System: Mac OS X (10.6)

You may attach this folder actions script to your Download folder

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		update Finder window (get name of this_folder)
	end tell
end adding folder items to

Yvan KOENIG (VALLAURIS, France) mardi 28 juin 2011 19:47:05

Thanks, but it didn’t work. If i open the folder in finder, i can see the files in there. But there not in the stack im my dock…

Restarting the Dock might do it:

do shell script "killall Dock"

Thanks alastor933, but I’ve been using that script for a couple months now. Tried of seeing my dock pop in and out all the time…LOL

Sure, I forgot that the dock stack isn’t a Finder Window.
Maybe you may use this workaround :
remove the Download icon from the dock and install an alias of the folder on the Desktop.
But even in this case, you will not get an instantaneous result.
I don’t know if it’s because the Finder is highly busy or if it’s because it is lazy but there are often a few seconds between a file addition in a folder and the display of the results of the triggered folder actions script.
I see that several times a day when I take screenshots which are renamed by such a script.
I do that because the screenshots numbering use the format dd-mm-yyyy when I want the format yyyy-mm-dd which is the only valid one when we must sort lists of files.

Yvan KOENIG (VALLAURIS, France) mardi 28 juin 2011 22:05:40

So i apply the script to the download folder and remove the download stack from the dock. Then put an Alias of the download folder on my desktop.