Applescript trouble with setting default location to choose file

Discussion in 'Mac Programming' started by TexasStation, Sep 4, 2013.

  1. macrumors newbie

    Joined:
    Oct 27, 2011
    Location:
    North Texas
    #1
    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
     
  2. macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
    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):

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

    Joined:
    Oct 27, 2011
    Location:
    North Texas
    #3
    That totally did the trick. The textbook wasn't very clear on that little detail.
    Thanks so much!
     

Share This Page