Background Changer V1.2

BACKGROUND CHANGER

see How to use Buttons and Scripts

V1.21
(commented out the start/stop slideshow (if on) when display sleeps - as those occasions when slideshow is set to a long duration, say 24 hours, then the Periodic timer will keep resetting to 24 hours every time the display wakes from sleep. There is no way to pause the timer and resume it.)

  • Global opacity setting
  • new Event Trigger, Change backgreound when display wakes
  • Switched from hidden dialog timer to OnPeriodicTimer
  • Static or Dynamic lists
  • COPY argument
  • DELETE argument
  • OPEN & NEWTAB arguments
  • CLIP argument
  • SHOW_IN_VIEWER argument
  • SLIDESHOW_IN_VIEWER argument

Script and example menu button (paths will need changing):
Background Changer.opusscriptinstall (15.2 KB)
Backgrounds.dcf (9.0 KB)

V1.1
Script and example menu button (paths will need changing):
Background Changer.opusscriptinstall (11.5 KB)
Backgrounds.dcf (2.9 KB)

Usage

- This script is for changing the background using a shared image across all 7 UI elements.
  • This script will do nothing by default when installed - until it is configured in the script preferences.
There are two ways of using this script. Event trigger mode or Slideshow mode. Use one or the other, although there are no blocks on using both modes at the same time.

1️⃣ Event Trigger mode

Four events are available:

  • Folder Changes
  • Tab Switching
  • When Display wakes
  • Double-Clicking on a file or folder

Turn on one or more of them and set a Path to a folder that contains two or more images.

2️⃣ Slideshow mode

Activated using the command BackgroundChanger

Commands are used in buttons but can be called from other places.
see How to use Buttons and Scripts

The main commands are
  • Start/Stop the Slideshow
    BackgroundChanger

  • Start/Stop a Slideshow of a folder of images
    BackgroundChanger PATH="C:\My Latest Photo Shoot"

These are all the arguments that can be used:

Argument Type Values Description
PATH /K Path Path enclosed in quotes PATH="C:\My Latest Photo Shoot"
RESET /S - Resets the path to the default path set in script configuration
TIDYUP /S - Deletes all persistant variables
RECURSIVE /O true/false Overides the recursive path setting in script configuration. PATH="C:\My Latest Photo Shoot" RECURSIVE=true
COPY /S - copies current background image to the folder set in script config/prefs
DELETE /O - deletes current background image file and rebuilds the list
OPEN /O - opens folder of the background in current lister
NEWTAB /O - opens folder of the background in a new tab
CLIP /K fullpath, path, fullname, name, image copies path and/or name, or the image to clipboard
SHOW_IN_VIEWER /O - show current image in standalone viewer
SLIDESHOW_IN_VIEWER /O - slideshow of current image (and any images in same folder) in standalone viewer

Notes:
  • The Recursive overide is useful when the config/prefs recusive mode is off but you have a folder of folders that you would like to see all the images of (Photo shoot folders for instance)
  • The basic start/stop command will use the last path used (as set by using the command with the PATH argument). This behaviour can be changed in the script config/prefs.
  • Can be used in a dynamic button using FOLDERCONTENT, as shown in the video, see below for an example.
  • Random Mode 2 relies on reducing a seperate list of indexes of the images, this means if adding or removing images from the folder being used, that blank backgrounds might be displayed or new images not displayed - until the list is rebuilt, which happens either when the original list reduces to zero or the path is changed to another one and then back.
  • Script config/pref changes are applied when slideshow is on or off.
  • Static and Dynamic modes are for internal compilation of the image list. Dynamic mode reads the image folder(s) before every background change - this allows for adding/deleting/renaming images. Static mode reads the folder(s) one time and the background changes will not reflect any additions/deletions/renames of images in the folder(s).
  • Using the OnPeriodicTimer() method for slideshow duration means the script is not always running.
Example commands
  • TO START/STOP SLIDESHOW
    BackgroundChanger

  • TO START SLIDESHOW OF A FOLDER
    BackgroundChanger PATH="C:\My Latest Photo Shoot"

  • TO START SLIDESHOW OF A FOLDER - RECURSIVE OVERIDE
    BackgroundChanger PATH="C:\My Latest Photo Shoot" RECURSIVE=true
    or
    BackgroundChanger PATH="C:\My Latest Photo Shoot" RECURSIVE

  • THIS MIGHT BE USEFUL IF SCRIPT CONFIG RECURSIVE IS ALWAYS ON AND YOU DONT WANT A SPECIFIC FOLDER TO BE RECURSIVE
    BackgroundChanger PATH="C:\My Latest Photo Shoot" RECURSIVE=false

  • PUT THIS AS FIRST BUTTON INSIDE A MENU BUTTON WILL LIST ALL FOLDERS, CLICKING ONE WILL START THE SLIDESHOW

GO "C:\My Photos" FOLDERCONTENT=embeddedcmddirs,nofiles
[BackgroundChanger PATH={f!|noext}]
  • TO RESET THE PATH TO THE DEFAULT PATH
    BackgroundChanger RESET

  • TO DELETE PERSISTANT AND SESSION VARIABLES (IF YOU WANT TO DELETE OR DISABLE THE SCRIPT)
    BackgroundChanger TIDYUP

  • TO COPY THE CURRENT IMAGE TO PATH SET IN PREFS
    BackgroundChanger COPY

  • TO OPEN THE IMAGE IN CURRENT LISTER
    BackgroundChanger OPEN

  • TO OPEN THE IMAGE IN A NEW TAB
    BackgroundChanger NEWTAB

  • TO COPY THE CURRENT IMAGES 'FULL PATHNAME' TO CLIPBOARD
    BackgroundChanger CLIP=fullpath

  • TO COPY THE CURRENT IMAGES 'PATH ONLY' TO CLIPBOARD
    BackgroundChanger CLIP=path

  • TO COPY THE CURRENT IMAGES 'FULL NAME' TO CLIPBOARD
    BackgroundChanger CLIP=fullname

  • TO COPY THE CURRENT IMAGES 'NAME ONLY' TO CLIPBOARD
    BackgroundChanger CLIP=name

  • TO COPY THE CURRENT IMAGE TO CLIPBOARD
    BackgroundChanger CLIP=image

  • TO OPEN THE CURRENT IMAGE IN THE STANDALONE VIEWER
    BackgroundChanger SHOW_IN_VIEWER

  • TO OPEN THE CURRENT IMAGE IN THE STANDALONE VIEWER AS SLIDESHOW
    BackgroundChanger SLIDESHOW_IN_VIEWER

  • TO DELETE THE CURRENT BACKGROUND IMAGE FILE
    BackgroundChanger DELETE

⚠ Warning

Use at own risk.
This script can produce strange visual effects in the lister when -
scrolling and when fade transition is on and delay is short.

Uninstalling or Disabling

Before deleting or disabling the script, run the command
BackgroundChanger TIDYUP
Not neccessary but keeps things tidy :slight_smile:

Enjoy :slight_smile:

6 Likes

WOW - impressed! :ok_hand::ok_hand:

Although not of real usage for me at the moment

Version 1.1 posted above.
bugfix: default path double backslashes for JScript paths
bugfix: RESET path wasn't resetting index

What an interesting script you have made. :smiley:

Come up with an idea but maybe the script can already do it? (Haven't installed it yet):

When you select an image file, he changes the background to that image and when you deselect it becomes the default background. In this way, there will be a built-in image viewer in the lister. Maybe takes some CPU power when you select whether to run the script to see if it's an image.

Unfortunately, I can't program the script myself, but maybe someone can solve it.

Good idea, unfortunately there is no way to retrieve the default image name or the the options which have been set for it :frowning:

(some time later .....)
Thinking about it some more, there are also problems with no events being triggered when an item(s) is selected in a lister.

as for setting the currently selected image as the background I already have a button set up for that :slight_smile:
here you go : (update: try this one) Set Selected Image as Background.dcf (1.2 KB)

Opacity levels might need changing. Easy enough to duplicate the button and set up a 'default' background button.

Too bad there are no events when you select a file. Would be a nice feature otherwise to be able to use the background for a preview of images.
Maybe something for @Leo , @jon could add in the future?

Thanks for the button, will try it.

Dialog.WatchTab()

1 Like

Slick Script, now I have animated backgrounds. Opus is crazy!

You might want to consider switching to use the new OnPeriodicTimer event in 13.9.4. It lets your script get called at regular intervals without it having to sit in the background running all the time.

1 Like

Any example scripts of this OnPeriodicTimer?