Photojournal script

I have an action I use to add information about photographs to an existing draft. It includes the date, a description from the working draft and should include the location. I’ve just noticed that the last few times I’ve run this it has returned my home location rather than the photo locations (Drafts has access to location services).

Can you see why this would be?

let draftFound= Draft.find("XXXXXXXX-YYYY-ZZZZ-TTTT-WWWWWWWW")

// Original post wants to do insertion between title and body
// Insertion consists of a date line, the content of the originating/current draft, and the current location coordinates.

// Let's build the new content to insert...
// Start with the date line
let strNewContent = draftFound.processTemplate("[[date|%A %d-%m-%y - %R]]");
// Add the current draft content on a new line after the date and followed by another newline
strNewContent = strNewContent + "\n" + draft.content + "\n";
// Add the coordinates for the current draft (current location should be most reliably based on modified coordinates)
strNewContent = strNewContent + draftFound.processTemplate("[[modified_latitude]],[[modified_longitude]]")

// Insert the new content by replacing the content with the new content between the title and body.
draftFound.content = draftFound.title + "\n\n" + strNewContent + "\n" + draftFound.processTemplate("[[body]]");

// Update the found draft
draftFound.update();
type or paste code here

The [[modified_*]] tags should return the location stored the last time that specific draft was in any way updated with new content (and saved). I’m not sure exactly the what/when/where of when you are running this action, but I don’t see how that would be a reliable way to capture location information related to a photo.

Where is the “photo location” suppose to be coming from? Are you running this action when you are at the location you are taking the photo? If so, you should use [[latitude]] and [[longitude]] to get the current location.

1 Like