Froggo Posted April 7, 2013 Share Posted April 7, 2013 Hi there, I have absolutely no clue in scripts! I would like to request the awesome people on these forums to help me create a workflow command to change (randomly) my desktop background with a hotkey/keyword. Not sure if this is possible.. please help! Thanks. Link to comment
jdfwarrior Posted April 8, 2013 Share Posted April 8, 2013 Hi there, I have absolutely no clue in scripts! I would like to request the awesome people on these forums to help me create a workflow command to change (randomly) my desktop background with a hotkey/keyword. Not sure if this is possible.. please help! Thanks. Is the random selection a requirement? I already have a workflow created that will allow you to select a jpg or png and set it as the current wallpaper Link to comment
Froggo Posted April 8, 2013 Author Share Posted April 8, 2013 Is the random selection a requirement? I already have a workflow created that will allow you to select a jpg or png and set it as the current wallpaper Yes that would be ideal. You know the option in system preferences to change your desktop background every few minutes etc? I would like to somehow access that option with a hotkey/keyword in Alfred. So for example if i input the keyword, my background will randomly change (selecting an already saved image in system preferences) if that makes any sense. Link to comment
Subject22 Posted April 8, 2013 Share Posted April 8, 2013 (edited) I use the killall Dock Terminal command to do precisely that all the time, and coincidentally I made a workflow to automate the process a few hours ago Warning: Terminating the Dock process may interfere with other things running on your computer, so use at your own risk. I've never had a problem with it though Download: Reboot Dock Keyword: dock Edited April 8, 2013 by Subject22 Link to comment
RodgerWW Posted April 10, 2013 Share Posted April 10, 2013 This is perhaps easier with a simple applescript and does not require rebooting the dock. Make a new workflow in Alfred 2 using the Templates/Essentials/Keyword to Script Define the stuff you want in the keyword ... you can delete the Keyword box after. In the run script select Language: /usr/bin/osascript In the script area paste the following: property theSwitch : 0 if theSwitch = 0 then tell application "System Events" tell current desktop set change interval to 1801.0 end tell end tell set theSwitch to 1 else tell application "System Events" tell current desktop set change interval to 1800.0 end tell end tell set theSwitch to 0 end if Save, then at the top right click on the "+" to add Trigger/Hotkey. Assign whatever hotkey you want and click save. Then, drag the connector of the hotkey over to the Run Script. So now, whenever I don't want to see the currently displayed desktop [with Change picture: Every 30 minutes selected in Desktop & Screensaver], I just hit my hotkey and it just advances to the next random image. Original script found at Mac OS X Hints Link to comment
Subject22 Posted April 10, 2013 Share Posted April 10, 2013 (edited) That script's nifty! But I believe you'd have to manually adjust the number of seconds (1800.0, in that example) to match your own settings. Below is a much more compact script adapted from one of the comments on the OS X Hints page that you linked to. It achieves the desired effect by simply setting the wallpaper change interval to itself. tell application "System Events" tell current desktop set initInterval to get change interval -- Get current interval setting set change interval to initInterval -- Reset interval setting end tell end tell And here's the finished Workflow :-) Download: Skip WallpaperKeyword: skip EDIT: This is all assuming that you've got "Change Picture" enabled in System Preferences > Desktop & Screensaver > Desktop. If you've got your wallpaper set to a static image and want something to change it to another static image then the solution would be a little more involved. Edited July 12, 2014 by Subject22 Link to comment
Don Dahl Posted July 12, 2014 Share Posted July 12, 2014 (edited) That script's nifty! But I believe you'd have to manually adjust the number of seconds (1800.0, in that example) to match your own settings. Below is a much more compact script adapted from one of the comments on the OS X Hints page that you linked to. It achieves the desired effect by simply setting the wallpaper change interval to itself. tell application "System Events" tell current desktop set initInterval to get change interval -- Get current interval setting set change interval to initInterval -- Reset interval setting end tell end tell And here's the finished Workflow :-) Download: Skip Wallpaper Keyword: skip EDIT: This is all assuming that you've got "Change Picture" enabled in System Preferences > Desktop & Screensaver > Desktop. If you've got your wallpaper set to a static image and want something to change it to another static image then the solution would be a little more involved. Subject22 can you supply a new link for this workflow please? Thanks in advance (mainly because i like the icon you've added - i dunno how to add that myself ;D Edited July 12, 2014 by Arthur Link to comment
Subject22 Posted July 12, 2014 Share Posted July 12, 2014 (edited) No worries! I've fixed the link. You can add icons by double clicking on a workflow in Alfred Preferences and dragging an image to the icon slot Edited July 12, 2014 by Subject22 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now