Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Desktop Picture Script

Desktop Picture Script
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Location: Across from the wallpaper store.
Status: Offline
Reply With Quote
Apr 28, 2002, 10:29 PM
 
I am not "new" to AppleScript, but I am somewhat of a novice (in terms of skill level). I usually steal or record my script code, but I cannot figure out how to write a script to change my Desktop Picture in OS X.

Can ANYONE help me?

Thanks in advance,

sMacintush™

[ 04-29-2002: Message edited by: smacintush ]
"Altruism is killing America. We who want to save America must repudiate this killer, root and branch. We must understand and explain to others that the acceptance of altruism necessitates the violation of individual rights... and that the arguments for altruism are baseless..."
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Apr 28, 2002, 11:35 PM
 
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
tell application <font color = red>"Finder"</font> to set the desktop picture to <font color = red>"Frunse:Users:sebictures:Hirn.tif"</font>
</font>[/code]

where "Frunse..." is the path to a picture on my hd. i left it in there to show the kind of colon separated path it requires.

use
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
osascript -e 'tell application <font color = red>"Finder"</font> to set the desktop picture to <font color = red>"Frunse:Users:sebictures:Hirn.tif"</font>'
</font>[/code]
if you want to embed it in a shell script or an nstask.
     
Addicted to MacNN
Join Date: Sep 2000
Location: Across from the wallpaper store.
Status: Offline
Reply With Quote
Apr 29, 2002, 12:12 AM
 
Thank You! You are the man! I was doing it right except I had the path format wrong.
"Altruism is killing America. We who want to save America must repudiate this killer, root and branch. We must understand and explain to others that the acceptance of altruism necessitates the violation of individual rights... and that the arguments for altruism are baseless..."
     
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 30, 2002, 06:12 AM
 
this is a perl script i have running at startup:

#!/usr/bin/perl
$dir = "/Users/toyboy/pics/";
opendir(dir, $dir);
@pics = grep { /.jpg/ && !/default.jpg/ } readdir(dir);
system("cp $dir/$pics[rand(int(@pics))] $dir/default.jpg");

Grabs a random jpg file from that dir.
default.jpg is the system background pic
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:51 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2