Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Caleb531

macrumors 6502
Original poster
Oct 17, 2009
289
0
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?

try
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
 
Try this line instead:
Code:
set myWallpaper to choose file default location alias "Macintosh HD:Users:Squiddy22:Pictures:Wallpaper:"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.