How to script folder background picture on folder open?

I’ve got a folder I want to send out to my whole group. I’ve created a custom background image (tif)
for the folder that gives basic instructions for how to complete a task. It has placeholders for various folders and the like. Works great on my computer.

But, when I archive it and email it to others, it reverts to the default white folder background on their computer. I’ve searched but can’t find a way to get the folder to keep the settings I give it once it leaves my computer. So, the next best thing I can think of is to have a script triggered when the folder is opened that sets the background of the folder to the tif image - included in the folder of course - I want as the background. For the life of me I can’t figure out how to do this. Any suggestions? I aslo have some other minor attributres I’d like to change at the same time - folder font size, folder icon size - but the background is the one I really need.

Model: ibook
AppleScript: 1.10
Browser: Firefox 1.0.4
Operating System: Mac OS X (10.4)

To set the background of the front window try:

tell application "Finder"
	set background picture of icon view options of front window to [path_to_image] as alias
end tell

where [path_to_image] is your valid image path. you could add this to an “on opening folder” script.

See the Finder dictionary > Window Classes > Finder Window > Icon View Options for other preferences, like font size.

Best wishes

John M

Thank you for the help. I can’t quite get it to work. So far, this is the scrpit I have:


on opening folder MI_Web_Kit
tell application “Finder”
set background picture of icon view options of front window to [MI_Web_Kit/resource/MI_Web_Kit_Background] as alias
end tell
end opening folder


I have that script saved in the folder I wish to distribute. I then went to the add "Attach folder action"for that particular folder “MI Web Kit.” I added the above sciprt as the action. Its obvious that I don’t have something quite right with the script as after I compile it and run it, nothing happens.

My thoughts:

  1. I should have left “this_folder” instead of changing it to “MI_Web_Kit” - the actual folder name - on the first line. I first tried it with “this_folder” entered and it did not work.
  2. The file path I’m using for the document isn’t right. The file I want to be used as the background is located in MI Web Kit > [this next folder has ony a ‘space’ as a name so as to not be visible to users] > MI Web Kit Background.bmp. As you can probably tell “MI Web Kit Background.bmp” is the file I wish to become the background of the root folder “MI Web Kit.” Is this path not right. Yes, there are quite a few other paths before it, like My Computer > harddrive > users > my name > desktop > MI Web Kit. But since this script is actually located within “MI Web Kit” folder I didn’t think the extra path entried were neccesary. Also, if they are neccesary I don’t see how this will work on any other computer as the path will never be the same since I must include the actual path for each machine.

As I’m sure you can tell I’m very new to applescript. Do you see anything that I’m clearly doing wrong?

Update: I realize the file I wish to use is actually called “MI Web Kit Background.bmp” but applescript won’t compile if I have the “.bmp” on the end. So that’s why I don’t include that in the script.

Hi,

For the file path you need to show the full path from the drive to the image. You also need this in quotes “” instead of square brackets (the square brackets were meant to show the text needed changing). Try the script I posted last time with just changing the image path and get this to work before moving on to try the folder action part.

I have little experience of folder actions, but I suspect you would not be able send a folder with a folder action and for it to work on the recipients machine.

You’ll also have to know where the folder is on the recipient’s hard drive.

Best wishes

John M