Search code examples
applescriptiphoto

How to set longitude to negative in Applescript, in iPhoto?


I have thousands of photos in iPhoto (due to an import from a bad data source) with bad geodata, where all the longitudes lost their minus signs.

In every case, I just want to put a minus sign on the longitude.

How can I, for every photo, set longitude = -longitude?


Solution

  • This script set the longitude to negative.

    tell application "iPhoto"
        set tc to count photos
        repeat with i from 1 to tc
            try
                tell photo i to if longitude > 0 then set longitude to -(longitude)
            end try
        end repeat
    end tell