Can anyone spot whether I'm doing something stupid here?
The script below is supposed to remove a suffix from an item name and mark the item as completed. (It's a companion script for my Verify Next Actions Exist script.) It seems to work for action groups, but for projects it fails to mark the project as completed.
I'll file a bug report if this code looks OK to the other scripters here.
The script below is supposed to remove a suffix from an item name and mark the item as completed. (It's a companion script for my Verify Next Actions Exist script.) It seems to work for action groups, but for projects it fails to mark the project as completed.
Code:
property missingNASuffix : "Missing NA" property missingNADelimiter : "—" property suffixToStrip : missingNADelimiter & missingNASuffix property suffixLength : count of suffixToStrip tell application "OmniFocus" tell front document tell document window 1 set theSelectedItems to value of selected trees of content repeat with anItem in theSelectedItems tell anItem if (name ends with suffixToStrip) then set completed to true set newName to rich text 1 thru (-1 * (suffixLength + 1)) of (get name) set name to newName end if end tell end repeat end tell end tell end tell
__________________
Cheers,
Curt
Cheers,
Curt