Created
November 8, 2020 20:06
-
-
Save zmarffy/b0452b3159f648a0c245a8a95ae6b216 to your computer and use it in GitHub Desktop.
Change Date Added field for a track in macOS Catalina's Music library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set d to text returned of (display dialog "Enter a date in %m%d%Y format (example: 01122020 for January 12, 2020)" default answer "" buttons {"Cancel", "Continue"} default button "Continue") | |
set trackFileList to {} | |
tell application "Music" | |
repeat with t in selection | |
set trackInfo to {} | |
copy POSIX path of (get location of t) to the end of trackInfo | |
copy (get played count of t) to the end of trackInfo | |
copy trackInfo to the end of trackFileList | |
end repeat | |
delete selection | |
end tell | |
do shell script "date -f %m%d%Y " & quoted form of d with administrator privileges | |
tell application "Music" | |
repeat with t in trackFileList | |
set addedTrack to add item 1 of t | |
set played count of addedTrack to item 2 of t | |
end repeat | |
end tell | |
do shell script "sntp -sS time.apple.com" with administrator privileges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment