You are not logged in.
Hello,
AppleScriptObjC app in Xcode...
I will change the image of the Login window.
This image is named lockscreen.png located in the /Library/Caches/Desktop Pictures/UUID_User (for example DA6D67A6-8E07-43D3-90E1-CE558271D864) folder.
For the actual user, no problem.
Applescript:
set adminShortName to short user name of (system info)
set uuiduser to do shell script "dscl . -read /Users/" & adminShortName & " GeneratedUID | awk '{print $2}'"
set newImageLogin to choose file default location ((path to desktop pictures folder from system domain) as alias)
set newImageLogin to (POSIX path of newImageLogin)
set newImagePath to "/Library/Caches/'Desktop Pictures'/" & uuiduser & "/lockscreen.png"
do shell script "rm -rf /Library/Caches/'Desktop Pictures'/" & uuiduser & "/lockscreen.png" with administrator privileges
do shell script "cp " & quoted form of newImageLogin & space & newImagePath
With many users, I don't know how make that for all users.
I can see the folder names of each user...
Applescript:
set listlockscreen to list folder (text 1 thru -2 of boot volume of (system info)) & ":Library:Caches:Desktop Pictures:"
... but after...?
iMac 27" 3,6 Ghz - MacBook Pro 14" M1 - MacOS Monterey
https://www.titanium-software.fr
Offline
AppleScriptObjC is not needed.
list folder accepts also POSIX paths so it's pretty easy to copy the pictures in a repeat loop.
It's not needed either to remove the file, cp overwrites an existing file.
Applescript:
set userUUIDs to list folder "/Library/Caches/Desktop Pictures"
set newImageLogin to POSIX path of (choose file default location path to desktop pictures folder from system domain)
repeat with uuiduser in userUUIDs
set newImagePath "/Library/Caches/Desktop Pictures/" & uuiduser & "/lockscreen.png"
do shell script "cp " & quoted form of newImageLogin & space & quoted form of newImagePath with administrator privileges
end repeat
regards
Stefan
Offline
Thanks a lot Stefan!!
It's necessary to delete the file before, because I lock the file (with the chflags command). cp cannot overwrite a locked file. ;-)
iMac 27" 3,6 Ghz - MacBook Pro 14" M1 - MacOS Monterey
https://www.titanium-software.fr
Offline