Issue with tell statement

on testOF_()
        log "begin testOF"
        tell application "OmniFocus"
            log "set currDoc"
             set currDoc to default document
               log "set currName"
             set currName to name of currDoc
             log "entering tell"
             tell currDoc
                 Set chosenProject to first flattened project whose name = "Adobe Tasks"
                    set currContext to context of chosenProject
                    log "about to get name of chose Project"
                    set cName to name of chosenProject
                    log cName
                 tell chosenProject
                     make new task with properties {note:noteFieldValue, name:titleFieldValue}
                 end tell
             end tell
        end tell
        return currName

    end testOF_

resulting log:

2017-01-25 08:36:25.201219 NoteTaker[78526:2507899] Wednesday, January 25, 2017 at 8:36:25 AM
2017-01-25 08:36:32.988422 NoteTaker[78526:2507899] begin testOF
2017-01-25 08:36:33.051103 NoteTaker[78526:2507899] *** -[AppDelegate saveNote:]: OmniFocus got an error: Can’t get «class ocid» id «data optr00000000454E6F7465000000». (error -1728)

You can see that not even: log “set currDoc” is being processed. So, is the script choking on the “tell application” call?

Error -1728 is a file reference error, which seems very strange.

Hi,

actually according to the error message the error is related to the saveNote handler.
Consider that log messages in application tell blocks are not displayed unless you write tell me to log …