lemonmade/templates

Adding text that includes variables to Project's note breaks script

qaid opened this issue · 2 comments

qaid commented

Totally loving this script - thanks so much for your hard work

The Problem(?) I Found

While I am able to include variables and plain text in the note fields of Tasks within a Project, I am unable to use declared variables in the notes field of the Project itself.

I can see that if my Project note contains something like this:

$ticketName $ticketURL
start: today
due: ask
>>>WORK > Tickets

REFERENCE:
$ticketName ($ticketURL)

The script will ask me to assign a value to "ticketName(" and likewise it will next ask for a value for "ticketURL)". This seems to indicate that when identical variable names exist the script will assign a value to the one that comes last in the inputs?

A Potential Solution (concept only)

Perhaps an escape mechanism like "----" or "//" that can be typed into the note field of the Project that instructs the script to skip over the subsequent text or just pass it through as text to the note before processing through the variables or logic that may be contained in the Tasks within the Project?

Yes, I see this happening as well. In looking at the code, I honestly don't remember why I decided to start looking for the variables from the end of the note, but that's what I did. It seems that I hardcoded that throughout the script, so it would take a fair number of changes to fix it up. I think that if you put the "real" note before the directives for the script, it should work just fine. I will, however, put this on my list of things to fix as I agree that it makes more sense for it to come after.

qaid commented

"Real" Notes Before Directives

I tried putting the "real" Project note before the directives, but it looks like that text is ignored when running the script because the resultant project didn't contain any notes, but it did otherwise function normally and parse the variables in the rest of the Project note.

Pass-through After Processing?

Thinking about it a step more I've realized another challenge: even if the script could "pass over" or not process the text you want to be a "real" Project note, that text could never contain any of the variables created in the rest of the note that is supposed to get processed. So the author wouldn't be able to take advantage of the variables they're creating. (This is exactly what I was trying to do.)

Perhaps some way in the syntax to indicate that a block of note text should be processed AFTER the directives are processed AND should then be made the body of the "real" note?

Pie in the sky, anyway. This script as it is has improved my relationship with Omnifocus so much already. Thanks again.