sequoia apple script to retrieve the name of the current wallpaper

I've used an apple script in previous versions of MacOs to retrieve the name of my current work space wallpaper. What worked before, of course, no longer works. I've got a script that is supposed to do the job, but it is only returning the name of the folder in which the current wallpaper file resides, not the image name.

Script:

tell application "Finder"

set theDesktopPicture to desktop picture as alias

set theWallpaperName to name of theDesktopPicture

display dialog "The current wallpaper filename is:" & return & theDesktopPicture & return & return & theWallpaperName with icon 1

end tell


If someone can tell me how to return the filename in the script, I'd appreciate it. It's really a pain to have to reinvent the wheel with every iteration of MacOs.


MacBook Pro 14″, macOS 15.7

Posted on Oct 31, 2025 10:12 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 1, 2025 5:50 AM

Try this:

use scripting additions

tell application "Finder"
	activate
	set wfilepath to POSIX path of (desktop picture as alias)
	set wfilename to name of (desktop picture as alias)
	display dialog "The current wallpaper filename is " & return & wfilepath & return & return & wfilename with icon 1
end tell
return


7 replies
Question marked as Top-ranking reply

Nov 1, 2025 5:50 AM in response to mareich

Try this:

use scripting additions

tell application "Finder"
	activate
	set wfilepath to POSIX path of (desktop picture as alias)
	set wfilename to name of (desktop picture as alias)
	display dialog "The current wallpaper filename is " & return & wfilepath & return & return & wfilename with icon 1
end tell
return


Oct 31, 2025 10:39 PM in response to mareich

This is a simpler script that will identify the proper folder for any wallpaper on any workspace, but not the image name. I would appreciate suggestions!


-- this script correctly retrieves the folder name of the wallpaper for the current workspace

-- 10/31/25

tell application "Finder"

set theDesktopPic to desktop picture as alias

set theName to POSIX path of theDesktopPic

display dialog "The current wallpaper filename is:" & return & theDesktopPic & return with icon 1

end tell

sequoia apple script to retrieve the name of the current wallpaper

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.