seaword
asked on
apple script daily change desktop background
I am looking to have the following...
*Applescript change my desktop background
*Have the change done daily (per week)
I tend to look at my screens too long sometimes.
I would just have 7 colors jpgs for the script to run from.
I am not a Apple Script guy... just php.
So I am looking at ways to do this automated on startup.
Thanks!
*Applescript change my desktop background
*Have the change done daily (per week)
I tend to look at my screens too long sometimes.
I would just have 7 colors jpgs for the script to run from.
I am not a Apple Script guy... just php.
So I am looking at ways to do this automated on startup.
Thanks!
ASKER
Thanks, i just want to keep it all in action script though....
I use a different day management software for my work.
I was hoping that you might know of an " IF THEN" statement for applescript.
That way the script could just check the OS date and time.
SO I would have conditionals for the time and days.
That way I could edit the file myself.
I use a different day management software for my work.
I was hoping that you might know of an " IF THEN" statement for applescript.
That way the script could just check the OS date and time.
SO I would have conditionals for the time and days.
That way I could edit the file myself.
Having an applescript looping all day is not an ideal solution. With ical you can schedule the script to run at a certain time of the day and repeat when ever and as often as you like.
Another idea might be to run the shell script below from a cron job.
You can read more about setting up a cron job here:
http://www.macosxhints.com/article.php?story=2001020700163714
Another idea might be to run the shell script below from a cron job.
You can read more about setting up a cron job here:
http://www.macosxhints.com/article.php?story=2001020700163714
#!/bin/sh -
#
# cron job to run applescript
osascript /path/to/script
ASKER
The script would only be run once at startup.
i guess a cron job would work as well...
can you give an example of how I could do an IF THEN conditional in applescript?
i guess a cron job would work as well...
can you give an example of how I could do an IF THEN conditional in applescript?
I should have thought of this earlier, you can run a script at login. Just add the script below to the login items for your user account.
You can edit theHours and theMinutes variables to suit your timing requirements. (currently set to 1:30am)
You can edit theHours and theMinutes variables to suit your timing requirements. (currently set to 1:30am)
-- Applescript to randomly change Desktop image once a day
-- Does not check if file is an image
property lastTimeRun : ""
set pathToImages to "Library:Desktop Pictures:Nature"
set theHours to 1 -- must be less then 24
set theMinutes to 30 -- must be less than 60
tell application "Finder"
set theDate to current date
-- Check if the script has already been run today
set today to date string of theDate
if lastTimeRun is not today then
--Check to see if it is time to run the script today
set currentHours to (hours of (theDate))
set currentMinutes to (minutes of (theDate))
if (currentMinutes e theMinutes) and (currentHours e theHours) then
set lastTimeRun to today
if folder pathToImages of startup disk exists then
try
set desktop picture to some file in folder pathToImages of startup disk
on error
return 0
end try
end if
end if
end if
end tell
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for taking time to help me.
I actually looked into 10.5.6 and the improvements they made to scripting.
The bridge (python / C / JS / ruby) is huge.
Thank again.
I actually looked into 10.5.6 and the improvements they made to scripting.
The bridge (python / C / JS / ruby) is huge.
Thank again.
Open in new window