![]() |
Wayne,
Change $pic_dir. It's :- $pic_dir = "Boot Drive:Users:Wayne:Movies:WaikikiBeach"; replacing 'Boot Drive' with the name of your OS X boot volume. Then change '$pic_path = "$pic_dir/$new_pic"; ' by changing the '/' to ':' and you should be hunkey dorey. AppleScript requires an Apple colon separated file path and while it has "as POSIX file" to translate the Apple path to a Unix path it doesn't have "as Apple file"(or similar) to translate back the other way. Tony |
Tony, got it. I feel a bit stupid as I knew Applescript requires : , but it did not click with me for this problem. What I did not realize, though, is that the path would be case sensitive. After fixing both problems, it works fine from the shell. I've added it to my crontab, and don't expect any problems. I will most likely need to adjust the syncronization as the pictures are a bit off, but that should be fairly easy. Following is the new code for anyone interested:
#!/usr/bin/perl # This is freeware, do whatever you want with it apart from passing it # off as your own work. # Use it at your own risk. It has been tested on Mac OSX Public Beta. # Rob Hartill, 19/March/2001 # changes to fix file handling and update for OS X release # by Tony Williams 5/July/2001 # changes to support time coded pictures # by Tony Williams # changes to use osascript to avoid killing finder to set new pic # by Tony Williams 26/April/2002 $pic_dir = "Boot Disk:Users:username:picturedir"; # change for local dir $prefs = `defaults read com.apple.desktop`; # read existing finder prefs $prefix = "picture_prefix_name"; # get time @time_bits = localtime(time); $num = ($time_bits[2] * 12) + (int($time_bits[1]/5)); # change for 12 noon start $num = ($num + 144) % 144; $new_pic = sprintf("%s%03d.jpg", $prefix, $num); $pic_path = "$pic_dir:$new_pic"; # tell the Finder $command = "osascript -e 'tell application \"Finder\" to set the desktop picture to \"$pic_path\"'"; system ($command); #ENDS Thank you, Wayne |
| All times are GMT -5. The time now is 06:24 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.