0

Windows 10 desktop is showing a slideshow of random images from a local folder. How can I find the filename of the current image?

2 Answers2

1

AFAIK, you cannot create a slideshow displaying filenames, with Windows' own slideshow. However, it's easy, using a free) third party tool, such as *ArtSage or IrfanView, to create a slideshow that displays filenames. Let it run full-screen in the background, and any other program can run in the foreground, covering part of the image.

Note that ArtSage eschews standard menus and relies on using F1 for its context (popup) menu. ArtSage makes it easy to create a slideshow, though it is not a general-purpose image editor.

ArtSage Context Menu

IrfanView is a general-purpose image editor with a plethora of additional capabilities, including slideshows. After installing IrfanView (or using the portable version):

IrfanView slideshow

  1. Create a slideshow by pressing W for the Slideshow dialog, and selecting files from the dialog.

  2. Click Add to add selected files, or Add all to add all files in that folder. Repeat selection from additional folders, if desired. Note that items in subfolders are not added; those folders must be selected manually.

  3. Click Save filename as TXT file in a convenient location.

  4. Set the parameters for the display of the next show:

    a. Select Show text, and use $D$F to show the full filename and path, or $F for just the filename.

    b. Select the order and delay between images.

    c. Set Loop slideshow to run continuously.

    d. Click Play slideshow to test it.

  5. Create a shortcut to IrfanView, and add the following command-line arguments at the end: slideshow=[image_list.txt], where the text file containing the paths and filenames from step 3. For example,

"C:\Program Files\IrfanView\i_view64.exe" /slideshow "C:\Slides\slideshow.txt"

Play the slideshow, full-screen, and it will run in the background, while you run other applications in the foreground to browse the web, read your mail, etc. BTW, to pause the IrfanView slideshow, or go back or forth, so you can copy the filename, use the Pause, or keys.

0

Check if the Overlay type is already defined

if (-not ("Overlay" -as [type])) {
    Add-Type -TypeDefinition @"
using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Linq;

public class Overlay : Form { private Label label; private FileSystemWatcher watcher;

public Overlay() {
    this.FormBorderStyle = FormBorderStyle.None;
    this.TopMost = true;
    this.BackColor = Color.Black;
    this.TransparencyKey = Color.Black;
    this.StartPosition = FormStartPosition.Manual;

    int screenWidth = Screen.PrimaryScreen.Bounds.Width;
    this.Location = new Point(screenWidth - 400, 50);
    this.Width = 400;
    this.Height = 50;

    label = new Label();
    label.Font = new Font("Arial", 14, FontStyle.Bold);
    label.ForeColor = Color.White;
    label.AutoSize = true;
    label.Location = new Point(10, 10);
    this.Controls.Add(label);

    this.HandleCreated += (sender, e) => InitWatcher();  // Ensures UI updates happen only after form is ready
}

private void InitWatcher() {
    watcher = new FileSystemWatcher(@"C:\Windows\Web\Wallpaper\Theme1");
    watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.FileName;
    watcher.Changed += (sender, e) => UpdateWallpaperLabel();
    watcher.Created += (sender, e) => UpdateWallpaperLabel();
    watcher.Renamed += (sender, e) => UpdateWallpaperLabel();
    watcher.EnableRaisingEvents = true;

    UpdateWallpaperLabel(); // Show initial wallpaper filename
}

private void UpdateWallpaperLabel() {
    string fileName = GetCurrentWallpaper();
    if (this.IsHandleCreated) {  // Ensures Invoke is only called when the form is ready
        this.Invoke((MethodInvoker)delegate {
            label.Text = fileName;
            this.Size = new Size(label.Width + 20, label.Height + 20);
        });
    }
}

private static string GetCurrentWallpaper() {
    string folderPath = @"C:\Windows\Web\Wallpaper\Theme1";

    try {
        var files = new DirectoryInfo(folderPath).GetFiles();
        if (files.Length > 0) {
            var latestFile = files.OrderByDescending(f => f.LastAccessTime).FirstOrDefault();
            return latestFile != null ? latestFile.Name : "Wallpaper Not Found";
        }
    } catch {
        return "Error";
    }

    return "Wallpaper Not Found";
}

public static void ShowOverlay() {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Overlay()); // Keeps the window open
}

} "@ -ReferencedAssemblies "System.Drawing", "System.Windows.Forms", "System.Core" }

Run the overlay in the same PowerShell session to keep it open

Vylix
  • 1,935