PDA

View Full Version : Applescript trouble with setting default location to choose file




TexasStation
Sep 4, 2013, 07:24 AM
Hi, got this code right from an Applescript textbook (written pre-10.5, however)
Here's the code, followed by the compile error...

activate
choose file of type "public.image"
default location (folder "Desktop Pictures" of folder "Library" of startup disk)
with prompt "Pick an image for the folder background:"
invisibles true

set the background picture of icon view options of front finder window to the result
end tell

Getting Syntax error - Expected end of line, etc. but found property, and it flags the word location in the code. It should basically bring up a dialog box to choose an image file in the Desktop Pictures folder then set as background image in the active Finder window.

I tried different things, but can't seem to get it to run.
Any ideas out there?
Thanks



Red Menace
Sep 4, 2013, 09:52 AM
I am guessing that your code snippet is in a Finder tell statement, but all of the parameters for a particular command need to be on a single line (or on lines separated by an option-return):

choose file of type "public.image" default location (path to desktop pictures folder) with prompt "Pick an image for the folder background:" with invisibles

TexasStation
Sep 4, 2013, 01:35 PM
That totally did the trick. The textbook wasn't very clear on that little detail.
Thanks so much!