How can I change a users profile picture in OS X using AppleScript

1.1k Views Asked by At

I have written an AppleScript to grab a users Facebook profile picture (using Curl) store it on their machine and set it as their User Picture in OS X. This picture: enter image description here

I am having trouble setting the picture, I've tried

tell application "System Events"
    set the picture path of current user to alias downloadedpath
end tell

But am having no luck! I am defining the path using colons, an example value of downloadedpath would be "Macintosh HD:Users:jacoblukewood:Desktop:profile.jpg"

How would I use this, I plan to use this on 10.8 and 10.9.

1

There are 1 best solutions below

2
On

My guess is because you are using Old:Mac:Format for your path, instead of the industry standard path/to/foo (POSIX). Is there any particular reason that you are using Ye Olde Mac Format?