- Is it possible at all to generate a macro which can pull up EXIF data on the current wallpaper?
My wallpapers are my favorites in Apple Photos, and it'd be great if I could hit a defined function key and find out the location and date the photo was taken.
90% of the time I know the location but......
- Secondly is it possible to generate a macro which will rotate the wallpaper to the next image in the sequence?
Thanks as always for your thoughts.
If it helps this page shows how to get the location of the file being used and write it on top of the desktop picture in use:
And this will reportedly extract EXIF data (but doesn't work):
https://macosxautomation.com/applescript/imageevents/09.html
So somehow I need to fix the second script, merge it with the first.... and then display the data?
In fact the first script would work if I could open the photo in the Photos app instead of in Finder? I've tried replacing 'Finder' with 'Photo' or 'Photos' to no avail.
The ExifTool app can get the information I need. This will give all the EXIF data:
on open the_files
set exiftool_path to "/usr/local/bin/"
set exiftool_args to "-g1 -S"
repeat with the_file in the_files
set exiftool_args to exiftool_args & " " & quote & POSIX path of the_file & quote
end repeat
set the_md to do shell script exiftool_path & "exiftool " & exiftool_args
set textList to {}
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to (return)
set textList to text items of the_md
set AppleScript's text item delimiters to tid
choose from list textList with title "List Exif Metadata" with prompt "ExifTool Metadata:" OK button name "OK" cancel button name "Cancel" with multiple selections allowed and empty selection allowed
end open
on run
set chosen_file to choose file with multiple selections allowed
open chosen_file
end run
But it won't run as an Apple Script within KM?
Any ideas how I can get this running in KM?
or...... The ExifTool author tells me that:
xiftool -p "${gpslatitude#;$*=3.14159/180} ${gpslongitude#;$*=3.14159/180}" FILE
Will give the location of the file in radians, if I could pass those coords to the maps App that'd be just as good.
So if that could be linked in with:
property exiftoolPath : "/usr/local/bin/exiftool"
-- get current Pictures folder
tell application "System Events" to set pFldr to pictures folder of current desktop
-- get relative posix path of picture (in the cash)
set posixPath to pFldr & "/" & paragraph 1 of (do shell script "ls -tu " & quoted form of pFldr)
-- get full Posix path of current desktop picture
tell application "Finder" to set pictureFileAsAlias to posixPath as POSIX file as alias
set currentPicturePOSIXPath to POSIX path of pictureFileAsAlias
-- Get GPS data (location and date)
set DateTimeOriginal to (do shell script exiftoolPath & " -s3 -DateTimeOriginal " & quoted form of currentPicturePOSIXPath)
set GPSLatitude to (do shell script exiftoolPath & " -s3 -GPSLatitude " & quoted form of currentPicturePOSIXPath)
set GPSLongitude to (do shell script exiftoolPath & " -s3 -GPSLongitude " & quoted form of currentPicturePOSIXPath)
return {DateTimeOriginal, GPSLatitude, GPSLongitude}
I'd be so nearly there...