Script to change wallpaper

2»

Comments

  • Reply 21 of 28
    nathan22tnathan22t Posts: 317member
    I figured out a fairly simple way to do this with Automator. It required downloading... Useful Image Workflows [1] for the ?Set the Desktop Picture? action... and then the Limit Number of Items [2] action, which adds the randomness. The other (first two) actions are built into Automator.



    So the workflow simply goes...

    (1) Get Specific Finder Items [add folder with desktop pictures]

    (2) Get Folder Contents

    (3) Limit Number of Items [limit to one random item]

    (4) Set the Desktop Picture



    Save it as an Application. Give it a fresh icon, and add it to the dock. Click on it once to get a new desktop picture. I'm not willing to restart my computer, but if the Desktop is a different picture upon restart, I would suggest that you try to prevent this by going into the Desktop & Screen Saver section in System Preferences and Choosing the same folder that you did for step (1) above.



    [1] http://www.apple.com/downloads/macos...workflows.html

    [2] http://www.apple.com/downloads/macos...erofitems.html
  • Reply 22 of 28
    lundylundy Posts: 4,466member
    Does it have a way to seed the random number generator?





    Quote:

    So the workflow simply goes...

    (1) Get Specific Finder Items [add folder with desktop pictures]

    (2) Get Folder Contents

    (3) Limit Number of Items [limit to one random item]

    (4) Set the Desktop Picture



  • Reply 23 of 28
    nathan22tnathan22t Posts: 317member
    Quote:

    Originally posted by lundy

    Does it have a way to seed the random number generator?



    No, and I am not sure how the author of the "Limit Number of Items" is selecting random items in his Automator action. However, when testing my solution/workflow described above... I have been unable to create scenarios where I encountered kLy's problem of the "exact same random sequence" being used every-time. When using my solution, it feels random enough, and no pattern(s) seems to emerge.
  • Reply 24 of 28
    klykly Posts: 21member
    Hey



    Will give this a try and let you know how it works.



    Thanks guys!
  • Reply 25 of 28
    klykly Posts: 21member
    Works great, thanks I'll let you know if it doesn't persist over reboots, uses the same random seed, or other quirks like that
  • Reply 26 of 28
    klykly Posts: 21member
    Hey



    It seems that you're right, the random item does get seeded by one random thing or another automatically. However, the wallpaper change still doesn't persist across sessions It seems the core problem to any of these solutions is that os x remembers the wallpaper that the user set manually, not the one that was actually on display at logout, and that's the one it loads on login It seems that the only way would be to not only change the wallpaper but also whatever setting points to it. I have no idea where such a setting would be stored. I spotlighted my preferences folder for "jpg" but it didn't turn up anything
  • Reply 27 of 28
    lundylundy Posts: 4,466member
    Didn't the idea of making a defaults file as I suggested work? It's so trivial with OS X's Defaults framework that it seems to be the answer.

    Quote:

    Originally posted by kLy

    Hey



    It seems that you're right, the random item does get seeded by one random thing or another automatically. However, the wallpaper change still doesn't persist across sessions It seems the core problem to any of these solutions is that os x remembers the wallpaper that the user set manually, not the one that was actually on display at logout, and that's the one it loads on login It seems that the only way would be to not only change the wallpaper but also whatever setting points to it. I have no idea where such a setting would be stored. I spotlighted my preferences folder for "jpg" but it didn't turn up anything




  • Reply 28 of 28
    klykly Posts: 21member
    Quote:

    Originally posted by lundy

    Didn't the idea of making a defaults file as I suggested work? It's so trivial with OS X's Defaults framework that it seems to be the answer.



    Yes, that did work, but as I said it still loaded the old wallpaper on login, then after the login script bounces around for a while in the dock (and all my other login apps load), the wallpaper changes to the one that was set. This seems like a rather hacked solution to undo something that os x should have done right in the first place.
Sign In or Register to comment.