Applescript for Hiding Files?

Hi, I want to Hide a certain file type as soon as they are created. The file type in question is .asd files.

I had this all configured with Automator, Apple Scripts and Folder Actions, however I’m running into a few bugs and wonder if anyone can suggest better ways of doing it.

Here’s what I currently have.

I think a way round this would be to make an Apple Script to add Folder Actions to all sub-directories. It would be a one off script that I’d have to run, Unless I can get it automated somehow.

How would I code something like that?

Any help would be appreciated.

You can easily loop through subfolders/-files with a recursive handler.

on run
	set s to choose file with prompt "Choose the script file"
	set f to choose folder "Choose the top level directory"
	addActionToFolderAndSubfolders(f, s)
end run

on addActionToFolderAndSubfolders(startFolder, scriptPath)
	-- code for adding the folder item
	tell application "System Events" to attach action to startFolder using scriptPath
	tell application "Finder" to set allFolders to every folder of startFolder
	repeat with i in allFolders
		addActionToFolderAndSubfolders((i as alias), scriptPath)
	end repeat
end addActionToFolderAndSubfolders

Hope it helps,

Hi, thanks looks as if it would work, just a quick question do I need to change anything in this? Sorry I’m a big noob at all of this

nope, don’t think so. It will ask for a folder and the script file which you should have saved on the hard somewhere.

Thanks all worked perfect, took ages to render or whatever though, but thats probably having 1000s of folders.