0

I will like to be able to set and start the macOS screensaver via the Finder's selection using Applescript. I will also like to be able to choose which screen saver pattern will be displayed. For example: Sliding Panels, Shifting Tiles, Reflections, Origami, etc...

I will also like the screen saver to be randomized (or as shown in System Preferences, "Shuffle slide order").

I have searched the Internet on how to do this and I have not had any luck on finding a solution.

Here is the initial code I came up with but I am having issues making the screen saver start with the selected images randomized:

tell application "Finder"
    set theSelection to selection as alias
end tell

set searchOne to "find " & theSelection's POSIX path's quoted form & " -iname '*.jpg'"
set theImages to paragraphs of (do shell script searchOne)

tell application id "com.apple.systemevents"
    set current screen saver to theImages
end tell

I am currently using macOS High Sierra. Any help is appreciated. Thanks!

4
  • Putting aside the applescript for a moment, unless 10.13 is radically different from its predecessor, this approach will not work. The screen saver works on a folder, not a list of images. To include a collection of images, deposit them (or copies) into a folder first. Once you've done that, then your true problems begin.
    – Mockman
    Commented Apr 5, 2020 at 6:23
  • Thank you. I did not know that. In this case I will need to try a different approach such as using the Preview application or Quick look.
    – David
    Commented Apr 5, 2020 at 12:58
  • Or alternatively, create a folder and populate it with a collection of images which you can change periodically (and automate that process). In the 'Source' drop down menu, you can select the folder. But automating that selection is something I'm not sure how to do.
    – Mockman
    Commented Apr 5, 2020 at 16:34
  • That is what I wanted to avoid since the images divided into a folder structure I do not want to change.
    – David
    Commented Apr 6, 2020 at 22:53

0

You must log in to answer this question.

Browse other questions tagged .