find path of the wallpaper image in Sonoma

REFERENCE old thread

Find path of the wallpaper image - Apple Community

previous to SONOMA you had a few options to locate the currently displayed desktop wallpaper. you can change the DOCK preference to enable the option to display the wallpaper path on the desktop

[defaults write com.apple.dock desktop-picture-show-debug-text -bool TRUE;killall Dock]

but this does not seem to be working anymore.

you were also able to run a AppleScript to locate and display the wallpaper file. this was done by querying the desktoppicture.db. but it does not appear that SONOMA utilizes this file anymore.

-- Usage: osascript find_wall_pic n
--        n = 1 or 2 (monitor ID)
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

on run argv
if (count of argv) < 1 then
set screenId to 1
else
set screenId to item 1 of argv as integer
end if
if screenId ≤ 1 then
set screenId to 1 -- 1st monior index
else
set screenId to 18 -- 2nd monitor index
end if

set posixaliaspath to (do shell script "/usr/bin/sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"select d1.value || '/' || d2.value from preferences pf1 join data d1 on pf1.data_id=d1.rowid join preferences pf2 on pf1.picture_id=pf2.picture_id join data d2 on pf2.data_id=d2.rowid where pf1.key=10 and pf2.key=16 and pf1.picture_id=" & screenId & "\"") as string

set homepath to (do shell script "echo $HOME")
-- replace "~" in the path to actual $HOME dir
set posixaliaspath to replace_chars(posixaliaspath, "~", homepath)

set aliaspath to (POSIX file posixaliaspath) as string
set posixpath to POSIX path of aliaspath
set imgfile to POSIX file posixpath
-- tell application "Finder" to reveal imgfile 
tell application "Finder"
activate
reveal imgfile
end tell
end run

I am looking for a solution similar to the AppleScript above, that can be run on demand to locate the file active on the desktop at that time. any ideas??

find path of the wallpaper image in Sonoma
 
 
Q