AppleScript "choose file" Keeps Remembering Last Visited

Discussion in 'Mac Programming' started by Caleb531, Nov 11, 2009.

  1. Caleb531 macrumors 6502


    Oct 17, 2009
    Today, I encountered a bug in AppleScript. Below is a script I use to choose a wallpaper from my Wallpaper folder and set it as my wallpaper. I have another script like this for uninstalling apps, which sets the 'choose file' in my Applications folder. When I run that script and then this one, the location is not in my Wallpaper folder like it should.

    Long story short, when I use 'choose file' in the Script Editor, the Finder dialog does not go to the folder I specified, but to the last folder I visited there. is there any way I might fix this?

    tell application "Finder"
    set myWallpaper to choose file of folder "Macintosh HD:Users:Squiddy22:pictures:Wallpaper:"
    set desktop picture to myWallpaper
    end tell
    end try
  2. kainjow Moderator emeritus


    Jun 15, 2000
    Try this line instead:
    set myWallpaper to choose file default location alias "Macintosh HD:Users:Squiddy22:Pictures:Wallpaper:"
  3. Caleb531 thread starter macrumors 6502


    Oct 17, 2009

Share This Page