sballin/alfred-search-notes-app

Can't open notes contained in “On my Mac” if iCloud notes also present

Closed this issue · 3 comments

To Reproduce
Make sure the Notes app both contains notes synced through iCloud, and notes stored locally (in the “On My Mac” section).
Use the workflow to search for a note from the On My Mac section, and press enter to open it; nothing happens.

Info

  • macOS version: 11.4
  • CPU: M1
  • Alfred version: 4.3.4
  • Workflow version: 3.3.0
  • In System Preferences > Security & Privacy > Privacy, there are checkmarks for Accessibility > Alfred 4, Full Disk Access > Alfred 4, Automation > Alfred 4 > Notes, and Automation > Alfred 4 > System Events? Yes!
  • What is the output of the debug log when the error occurs?
[11:18:08.435] Search Notes[Script Filter] Processing complete
[11:18:08.437] Search Notes[Script Filter] Passing output 'x-coredata://[REDACTED]/ICNote/p50?com' to Run NSAppleScript
[11:18:08.740] ERROR: Search Notes[Run NSAppleScript] {
    NSAppleScriptErrorAppName = Notes;
    NSAppleScriptErrorBriefMessage = "Can\U2019t get note id \"x-coredata://[REDACTED]/ICNote/p50\" of default account.";
    NSAppleScriptErrorMessage = "Notes got an error: Can\U2019t get note id \"x-coredata://[REDACTED]/ICNote/p50\" of default account.";
    NSAppleScriptErrorNumber = "-1728";
    NSAppleScriptErrorRange = "NSRange: {301, 38}";
}
[11:18:08.761] Search Notes[Run NSAppleScript] Processing complete
[11:18:08.762] Search Notes[Run NSAppleScript] Passing output '' to Run Script

Additional context
Before I enabled iCloud note syncing (and therefore only had the “On My Mac” section), the workflow could open notes from this section just fine.
To be clear, the workflow still finds these notes (they're listed in the results) but can't open them (actionning the result doesn't do anything).

As a test, I changed the default account in Notes preferences, from iCloud to On My Mac, and predictably this flips the issue: with that setting, the workflow can't open iCloud notes anymore, but can open local notes.

It makes sense that this is happening, but I agree it's not good behavior... the workflow always shows the note with the given id "in the default account" because there was a subtle bug happening before without that specifier. It is possible for the script to specify the right account. I'll try to fix this in the next release.

Should be fixed in version 3.4.0.

Can confirm it now works for me!