View Full Version : Easy Applescript question. I think.
amberashby
Oct 25, 2004, 01:30 PM
I've never used Applescript before, but I'm wondering if it could be used to perform this simple task. I would like to have an Applescript that would change my desktop background. Is this possible via Applescript?
Thanks.
SilentPanda
Oct 25, 2004, 02:11 PM
I suppose possible... but OS X already has this functionality built in unless you need something more specific... just look under "Desktop" in your System Preferences. You can have it randomly select a desktop background for you in varying intervals.
amberashby
Oct 25, 2004, 03:09 PM
Not looking for a random desktop, but a way to change to a certain specified desktop without having to go to preferences every time.
emw
Oct 25, 2004, 03:38 PM
Not looking for a random desktop, but a way to change to a certain specified desktop without having to go to preferences every time.
Do this:
tell application "Finder"
set desktop picture to "<HD>:<Directory>:<image>"
end tell
HD = Name of your Hard Drive
Directory = Directory path of image (i.e., Users:User1:Pictures)
Image = image name
Edit: If you wanted to be more complex, you could have it ask which desktop you wanted as well.
scan300
Oct 25, 2004, 09:35 PM
Do this:
tell application "Finder"
set desktop picture to "<HD>:<Directory>:<image>"
end tell
To make the above script so you can drag and drop an image, use the following code and save it as an application. It will become a droplet.
on open (myRef)
tell application "Finder"
set myPicture to myRef as alias
set desktop picture to myPicture
end tell
end open
Note: these applescripts only work if you have 'Automatically change picture' set to off in the desktop preference pane.
If you want to make an application that you can browse for an image use the following code:
tell application "Finder"
choose file
set myPicture to result
set desktop picture to myPicture
end tell
amberashby
Oct 25, 2004, 09:58 PM
This is perfect. Thanks everyone.
5thplayer
Sep 14, 2008, 10:55 PM
i have the following code
tell application "Finder"
set desktop picture to "<bob>:<Users:administrator:Pictures>:<Earth Horizon.jpg>"
end tell
but it keeps telling me that it it "cant make **** into a file type"
can anyone tell me what im doing wrong?
i was also wondering, how can i get the script to run for more than 1 user as in i logged in as the administrator and i want it to change the desktop picture for all users
im using 10.5.4 in applescript on a intel mac
thanks
5thplayer:confused::confused::confused::confused:
scan300
Sep 15, 2008, 05:21 PM
i have the following code
tell application "Finder"
set desktop picture to "<bob>:<Users:administrator:Pictures>:<Earth Horizon.jpg>"
end tell
but it keeps telling me that it it "cant make **** into a file type"
You don't need the < and > characters in your path.
it should be set desktop picture to "bob:Users:administrator:Pictures:Earth Horizon.jpg"
You can't change the picture for all users without logging in to each user and running the script. You can however get all users to set their desktop picture to an image located in the shared folder. Volume:Users:Shared: Then just replace the image when you want, keeping the filename the same (only the image changes). Each user account will have the new desktop image displayed when they log in. (No need for applescript here)
5thplayer
Sep 15, 2008, 06:27 PM
thanks scan300 ill try your suggestion, i work in a school so i wanted to see if there was an easy way to do this in a fast way,
thanks
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.