sballin / alfred-search-notes-app

Use Alfred to quickly open notes in iCloud/Apple Notes.
https://www.alfredforum.com/topic/11716-search-appleicloud-notes/
MIT License
510 stars 24 forks source link

This plugin doesn't work on Catalina #12

Closed pawsys closed 4 years ago

sballin commented 4 years ago

Are you using the latest version, 1.4.3? If it's still not working please post the text in the debug log after you try to find and open a note. Take care to remove any private note contents if they show up there.

pawsys commented 4 years ago

Does it work for you using Alfred 4 / Catalina? (yes I am using the newest version)

On Tue, Oct 29, 2019 at 9:02 PM Sean Ballinger notifications@github.com wrote:

Are you using the latest version, 1.4.3? If it's still not working please post the text in the debug log https://www.alfredapp.com/help/workflows/advanced/debugger/ after you try to find and open a note. Take care to remove any private note contents if they show up there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sballin/alfred-search-notes-app/issues/12?email_source=notifications&email_token=AAZDNPCTTAWFB4VJEFJ5C3DQREBMPA5CNFSM4JGRZARKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECS3EPY#issuecomment-547729983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZDNPCVFJMIR5B6STIWUFDQREBMPANCNFSM4JGRZARA .

sballin commented 4 years ago

It works for me in Alfred 3 and Catalina. If you post the info from the debug log I may be able to help.

pawsys commented 4 years ago

How to run a debug log? I am typing the shortcut for the notes app and no notes are showing up.

On Tue, Oct 29, 2019 at 10:06 PM Sean Ballinger notifications@github.com wrote:

It works for me in Alfred 3 and Catalina. If you post the info from the debug log I may be able to help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sballin/alfred-search-notes-app/issues/12?email_source=notifications&email_token=AAZDNPHQPR45EKMFSK2OVTTQREI6BA5CNFSM4JGRZARKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECS5XLA#issuecomment-547740588, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZDNPFUKWY5T76SGUE63ZDQREI6BANCNFSM4JGRZARA .

sballin commented 4 years ago

Follow the instructions here to open the debug log: https://www.alfredapp.com/help/workflows/advanced/debugger/

Then try to use the workflow and see the output that appears in the debug log.

tiwood commented 4 years ago

It seems Apple Script support in the Notes.app is broken in Catalina if iCloud Sync is enabled. The following thread is from another application but the issue seems to be the same: https://hookproductivity.com/help2/integration/hook-and-macos-10-15-catalina-notes-app/

This is the error I'm getting right now:

[8:11:25.813 PM] ERROR: Search Notes.app[Run NSAppleScript] {
    NSAppleScriptErrorAppName = Notes;
    NSAppleScriptErrorBriefMessage = "AppleEvent handler failed.";
    NSAppleScriptErrorMessage = "Notes got an error: AppleEvent handler failed.";
    NSAppleScriptErrorNumber = "-10000";
    NSAppleScriptErrorRange = "NSRange: {67, 20}";
sballin commented 4 years ago

Thanks for the helpful info! Weirdly, I can't reproduce this. I was testing with "on my mac" notes on Catalina 10.15 + Alfred 3 before, but I upgraded to 10.15.1 and added my iCloud notes, and it continued to work. In Script Editor.app, can you try the following?

tell application "Notes" to return every note in default account

then after getting the list of x-coredata://... urls, copy one of them and try

tell application "Notes" to show note id "x-coredata://..." in default account

You can also play with removing in default account.

sballin commented 4 years ago

One more question, your error happens after you successfully get the list of notes then try to open one, right?

I looked into whether it might be a permissions thing. In System Preferences -> Security & Privacy -> Privacy tab, under "Automation" I gave permission to Notes, which appears with a checkbox under Alfred 3. When I removed that permission, I got a different error, number -1743 with message "Not authorized to send Apple events to Notes."

tiwood commented 4 years ago

The error happens in the Show note or folder with given ID RunNSAppleScript action. The Notes listing works fine for me. Additionally I've checked the permissions and they look ok to me:

screenshot_2019-11-13_20-46-40

Update: I've just added in default account to the AppleScript and now it works!

on alfred_script(q)
    tell application "Notes"
        if q contains "Note"
            show note id q in default account
        else
            show folder id q in default account
        end if
    end tell
end alfred_script

I'm only storing notes in my default account, so this is a good workaround for me.

sballin commented 4 years ago

I'm glad it works now, this was the fix in release 1.4.3, though it's also working without in default account for me on Catalina too... strange!