Pathoffreedom 0 Posted January 22, 2016 Share Posted January 22, 2016 Hello, I often like to record to location of items and places. An easy way for me to do this is to take a note in that spot, and perhaps include a photo in it, and then have EN store the location. The problem I have is that EN converts the location data (long/lat) into a place name. The place name is of no use to me. What I want to retrieve later is the exact longitude and latitude data. So far, the only way I've found to retrieve this data is to export the note, and then open it in a text editor, find the <longitude> and <latitude> fields and copy the data from there. Surely there is an easier way. 1) Can I disable the conversion of location long/lat data into a place name? 2) If not, is there a simpler way to retrieve the long/lat data? Thanks... Link to comment
Level 5* JMichaelTX 4,108 Posted January 23, 2016 Level 5* Share Posted January 23, 2016 41 minutes ago, Pathoffreedom said: The problem I have is that EN converts the location data (long/lat) into a place name. The place name is of no use to me. What I want to retrieve later is the exact longitude and latitude data. Surely there is an easier way. 1) Can I disable the conversion of location long/lat data into a place name? Good question. I just checked EN Mac 6.4 on Yosemite (10.10.5), and it shows my address, not long/lat. What versions of OS and Evernote are you running? Link to comment
Pathoffreedom 0 Posted January 23, 2016 Author Share Posted January 23, 2016 I am also using 6.4 on Yosemite. Although this has been an "issue" for as long as I can recall. Location is always converted to displaying a place name (be that an address, or something more generic when in a remote area, etc.). I am thinking I could at least extract the latitude and longitude using AppleScript. Although the script I came up with (I am completely new to AS) failed. tell application "Evernote" set theSelection to get selection set theLat to latitude of theSelection set theLong to longitude of theSelection end tell set the clipboard to theLat & " " & theLong Error returned: error "Can’t get latitude of {note id \"x-coredata://4413454C-6245-4CA6-911A-6729DBDBCC21/ENNote/p166\" of notebook \"@ Inbox\" of application \"Evernote\"}." number -1728 from «class EVla» of {«class EVnn» id "x-coredata://4413454C-6245-4CA6-911A-6729DBDBCC21/ENNote/p166" of «class EVnb» "@ Inbox"} So, I am still working on that as a solution. Link to comment
Level 5* JMichaelTX 4,108 Posted January 23, 2016 Level 5* Share Posted January 23, 2016 13 minutes ago, Pathoffreedom said: I am thinking I could at least extract the latitude and longitude using AppleScript. Although the script I came up with (I am completely new to AS) failed. You are on the right track. You just needed one more statement to get a specific Note object from the selection:set oNote to item 1 of theSelection tell application "Evernote" set theSelection to get selection set oNote to item 1 of theSelection set theLat to latitude of oNote set theLong to longitude of oNote log ("Lat: " & theLat) log ("Long: " & theLong) end tell set the clipboard to theLat & " " & theLong --- RESULTS --- (*Lat: 30.208509408338*) (*Long: -95.497076858296*) Link to comment
Pathoffreedom 0 Posted January 23, 2016 Author Share Posted January 23, 2016 Thanks very much for that modification. I am now getting that result, but for some reason it's not being set to the clipboard. Any thoughts? What I'd like to do is set up a shortcut (using Alfred, or something to that effect) that will copy the long and lat to the clipboard, and I can then just hit CMD-V to paste it into the body of a note (or elsewhere). Link to comment
Level 5* JMichaelTX 4,108 Posted January 23, 2016 Level 5* Share Posted January 23, 2016 9 minutes ago, Pathoffreedom said: I am now getting that result, but for some reason it's not being set to the clipboard. Any thoughts? You need to convert the long/lat numbers to text: set the clipboard to (theLat as text) & " " & (theLong as text) Link to comment
Pathoffreedom 0 Posted January 23, 2016 Author Share Posted January 23, 2016 Thanks J. This is very helpful, and much appreciated. I am also appreciating how easy AppleScript is... almost like English, rather than something cryptic! Link to comment
Pathoffreedom 0 Posted January 23, 2016 Author Share Posted January 23, 2016 For anyone else interested in this... Here's my final script. I suggest either using FastScripts to run it quickly from the OS X menubar, or something like QuickSilver or Alfred. This script will retrieve the GPS data (including altitude, if it's set) from the current noteand paste it to where the cursor is in that note. So make sure you have the cursor in the location you want the GPS data. Or, if you want to manually paste the data from the clipboard, just remove the last two lines from the code ("delay 1" and onward). set the clipboard to "" tell application "Evernote" set theSelection to get selection set oNote to item 1 of theSelection set theLat to latitude of oNote set theLong to longitude of oNote set theAlt to altitude of oNote end tell if (theAlt as text) is not "0.0" and (theAlt as text) is not "missing value" then set the clipboard to "Location: " & (theLat as text) & " " & (theLong as text) & return & "Altitude: " & (theAlt as text) else set the clipboard to "Location: " & (theLat as text) & " " & (theLong as text) end if delay 1 tell application "System Events" to tell (name of application processes whose frontmost is true) to keystroke "v" using {command down} Link to comment
Level 5* DTLow 5,721 Posted January 23, 2016 Level 5* Share Posted January 23, 2016 13 hours ago, Pathoffreedom said: For anyone else interested in this... Here's my final script. Thanks @Pathoffreedom and @JMichaelTX for your work on this and sharing it. Its probably a niche requirement (until I need it ) so I can understand why Evernote hasn't made it part of the UI >>I suggest either using FastScripts to run it quickly from the OS X menubar, or something like QuickSilver or Alfred. I don't have any of those so I added it the the Apple Script Menu for the Evernote application >>I am also appreciating how easy AppleScript is... almost like English, rather than something cryptic! Yes, its a great tool. Every Mac user should at try it once, even if its just a simple one time script. Its also why I appreciate your postings on this, it helps with my Applescript education. Link to comment
eric99 809 Posted January 23, 2016 Share Posted January 23, 2016 In Evernote for windows, you can view the coordinates in the Info --> location -->edit There is even a search syntax to search for notes around a location, unfortunately this isn't completely working as it should be... Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.