Jump to content

Search Apple/iCloud Notes


Recommended Posts

  • 3 months later...
  • 4 weeks later...

Hi @sballin, thanks for this brilliant workflow. It's indeed godsend.

 

However, I can't use the body search (nb) because I'm getting this security issue (and "Security & Preferences" pane doesn't show the "Allow" option (because I've already allowed it and can use title search and folder search).

 

The error_log shows this:

 

panic: runtime error: slice bounds out of range [104:100]

goroutine 1 [running]:
main.BuildSubtitleAddition(0xc00002240a, 0x68, 0xc000026070, 0x64, 0x208af58ea, 0x1, 0x64, 0xc000022500)
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:216 +0x2d4
main.LiteDB.GetResults(0xc000242000, 0x208af58ea, 0x1, 0x208af58e5, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:317 +0xd51
main.main()
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:403 +0x138
touch: Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.ED7FF581-A6D4-467A-9095-7248E1201713/update.py: No such file or directory
touch: Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.ED7FF581-A6D4-467A-9095-7248E1201713/update.py: No such file or directory
panic: runtime error: slice bounds out of range [104:100]

goroutine 1 [running]:
main.BuildSubtitleAddition(0xc00002248a, 0x68, 0xc000026070, 0x64, 0x208b558ea, 0x1, 0x64, 0xc000022580)
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:216 +0x2d4
main.LiteDB.GetResults(0xc000242000, 0x208b558ea, 0x1, 0x208b558e5, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:317 +0xd51
main.main()
	/Users/sean/Dropbox (MIT)/Dotfiles/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C13422B2-62E5-4A91-A8D9-65E18FA46712/search_notes/main.go:403 +0x138

 

Despite trying the spctl --master-disable method and giving Alfred 4.app and search_notes binary almost all privacy privileges, I can't seem to get the search body function work.

 

Any solutions would be much appreciated.

 

Thanks! 🙂

Screenshot 2021-03-17 at 23.47.00 (Notes).png

Link to comment

As I moved away from Evernote, I'm now keeping all my files/attachments/searchable pdfs in iCloud Drive and I'm using Notes as my main note taking app. I'm very keen with my current setup and this workflow is tremendously helpful - literally a godsend! - after the new Evernote apps broke my entire workflow (neither the Alfred extension nor spotlight worked anymore to search/action notes).

 

I have one question regarding this workflow - how could I modify it to have the note open in a separate window after the search - without the sidebar? It currently opens the note in the "list view" and I have to double-click on the note to open it in a separate window. Any way to setup another modifier key (e.g. using ⌘+Enter after searching) so it opens directly the specific note?

Edited by jxxst
typo
Link to comment
4 hours ago, jxxst said:

I have one question regarding this workflow - how could I modify it to have the note open in a separate window after the search - without the sidebar? Is currently opens the note in the "list view" and I have to double-click on the note to open it in a separate window. Any way to setup another modifier key (e.g. using ⌘+Enter after searching) so it opens directly the specific note?

 

You could create a new "Run NSAppleScript" action with the following code:

 

on alfred_script(q)
	tell application "Notes"
		-- Show user requested note
		-- Get note id which is first item in q
		set noteID to text 1 thru ((offset of "?" in q)-1) of q
		show note id noteID in default account
		show note id noteID in default account
		-- Click menu Window -> Float Selected Note
		tell application "System Events" to tell process "Notes" to click menu item 11 of menu 7 of menu bar 1
	end tell
end alfred_script

 

Link to comment
14 hours ago, buraktuyan said:

However, I can't use the body search (nb) because I'm getting this security issue (and "Security & Preferences" pane doesn't show the "Allow" option (because I've already allowed it and can use title search and folder search).

 

Thanks for reporting this issue. I don't think it's security related, that error message is always the same because it's the most common problem users face. I think it's because of certain characters like i/İ having different byte length depending whether they are uppercase or lowercase, and the workflow converts notes to lowercase when searching. I'll work on a fix...

Edited by sballin
Link to comment
4 minutes ago, sballin said:

 

Thanks for reporting this issue. I don't think it's security related, that error message is always the same because it's the most common problem users face. I think it's because of certain characters like i/İ having different byte length depending whether they are uppercase or lowercase, and the workflow converts notes to lowercase when searching. I'll work on a fix...

 

Actually, I resolved the issue on my end by removing the error handling code for the "Search note bodies" function:

 

When I start searching for note bodies, Alfred shows the default fallback options for a second or two (and no icons/options for this workflow) but then your workflow starts showing the results for the note body search. When there's error handling, this transition triggers the error message above.

Screenshot 2021-03-18 at 15.21.56 (CleanShot)@2x.png

Link to comment
12 minutes ago, buraktuyan said:

Actually, I resolved the issue on my end by removing the error handling code for the "Search note bodies" function

 

Weird! I'll have to think about this. I was able to reproduce your error message with a note containing "İ" but removing the error handling didn't fix things for me.

Link to comment
5 minutes ago, sballin said:

 

Weird! I'll have to think about this. I was able to reproduce your error message with a note containing "İ" but removing the error handling didn't fix things for me.

I just ran a test with a note containing "İ" in it, and the nb search couldn't list it in the results. However it didn't throw an error message either.

 

As a note, some of my notes had characters like İ or Ş in them, that was probably the core reason why I was getting this error in the first place.

Link to comment
7 hours ago, buraktuyan said:

I just ran a test with a note containing "İ" in it, and the nb search couldn't list it in the results. However it didn't throw an error message either.

 

As a note, some of my notes had characters like İ or Ş in them, that was probably the core reason why I was getting this error in the first place.

 

Here is a pre-release version where characters like that should be handled properly: https://github.com/sballin/alfred-search-notes-app/files/6168245/Search.Notes.zip

 

Let me know if you encounter any issues!

Link to comment
8 hours ago, sballin said:

 

Here is a pre-release version where characters like that should be handled properly: https://github.com/sballin/alfred-search-notes-app/files/6168245/Search.Notes.zip

 

Let me know if you encounter any issues!

 

It works great for me without any issues and without any manual changes to the code. Thanks a LOT! 🙂👍

And I liked the new fallbackCreateNew and fallbackSearchBodies functions -- the second one already made my life easier. 👌

Link to comment

Version 3.3.0 is released! New features:

  • Choose between creating a new note or searching note bodies when no note with a matching title is found (set your preference in environment variables)
  • Better support for accented characters
  • Paste note links quickly using a snippet shortcut
Edited by sballin
Link to comment

Hi everyone -- longtime Alfred user, new to this workflow. I'm on latest Big Sur (11.2.3) and I can't get past the "Allow Anyway" part of the installation. I click Allow Anyway, it disappears, I call up Alfred, and it starts all over again. Any suggestions? Thank you!

Link to comment
15 minutes ago, qe3 said:

Hi everyone -- longtime Alfred user, new to this workflow. I'm on latest Big Sur (11.2.3) and I can't get past the "Allow Anyway" part of the installation. I click Allow Anyway, it disappears, I call up Alfred, and it starts all over again. Any suggestions? Thank you!

 

In the security pref pane, do you have "Allow apps downloaded from" set to "App Store and identified developers?"

 

Does anything show up in the error log or alfred debug log when you try to open it?

Link to comment
1 hour ago, sballin said:

 

In the security pref pane, do you have "Allow apps downloaded from" set to "App Store and identified developers?"

 

Does anything show up in the error log or alfred debug log when you try to open it?

Yes to #1. Image attached.

 

No to #2. See attached after 10-15 attempts to follow the directions.

253022568_ScreenShot2021-03-24at6_19_47PM.thumb.png.0d28e7745a355b84f3836072fe72bdaa.png

 

 

Screen Shot 2021-03-24 at 6.21.29 PM.png

Link to comment
35 minutes ago, qe3 said:

Yes to #1. Image attached.

 

No to #2. See attached after 10-15 attempts to follow the directions.

 

Weird... here are a couple more things you can try:

 

1. Locate the binary in (workflow directory)/search_notes, it's the file named search_notes. Right click the binary and press Open (don't do anything else like double click, cmd-down, etc). This is supposed to be equivalent to "Allow Anyway"

2. Try running the binary in the terminal (cd to search_notes directory and do ./search_notes)

3. If neither of the above work, try restarting your computer, or doing 1/2 on a different computer...

Link to comment
  • 1 month later...

Thanks for this great workflow! It's caused me to migrate from Evernote to Notes.

 

To that end, is it possible to add "add to note" as a file selection action? So I can select a file in Finder and add to note or make new note and include it as attachment?

 

TY!

Link to comment
  • 2 weeks later...
10 hours ago, jarrodjob said:

When I type "n"+"<space>" and start typing I get search results ABOVE note results.  The desired state is ONLY notes.

 

Then you need to not use a keyword that matches loads of other search results.

 

When you open Alfred and start typing, you are performing a regular Alfred search. If the query matches a workflow's keyword, that will also be run, and its results will be integrated with those from the regular search. If you want to run only the workflow, you have to "enter" it by actioning it in Alfred's search results (or using a Hotkey).

 

So to ensure you only get results from one workflow while you’re in Alfred’s main search mode, you need to pick a keyword that won’t match any other stuff. Prefixing your keyword with . usually works well, i.e. use .n, not n, and your query probably won’t match anything but the workflow keyword.

 

Edited by deanishe
Link to comment
  • 2 weeks later...
On 5/21/2021 at 2:19 AM, deanishe said:

 

Then you need to not use a keyword that matches loads of other search results.

 

When you open Alfred and start typing, you are performing a regular Alfred search. If the query matches a workflow's keyword, that will also be run, and its results will be integrated with those from the regular search. If you want to run only the workflow, you have to "enter" it by actioning it in Alfred's search results (or using a Hotkey).

 

So to ensure you only get results from one workflow while you’re in Alfred’s main search mode, you need to pick a keyword that won’t match any other stuff. Prefixing your keyword with . usually works well, i.e. use .n, not n, and your query probably won’t match anything but the workflow keyword.

 

 

THANK YOU @deanishe and @sballin.  Really appreciate the lift here.  Exactly what I needed, and it does make sense to have it be this way.

 

-JJ

Link to comment
  • 5 weeks later...

Hi,

 

I'm getting the error of permissions, and there is no change if I try to manually run the search_notes executable from terminal or from Finder, and System Preferences is not giving me any option to run the executable. This appears to have broken as of upgrading to Big Sur 11.4, but I can't confirm that 100%.

image.png.c391d55a3613f1f8c16e62bb0d18eb28.png

 

That said, it looks like there is a permission issue on the database? From the error log at the above prompt:

panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

 

Any ideas? Thank you for such a great workflow!!

Link to comment
1 hour ago, metafizikal said:

Hi,

 

I'm getting the error of permissions...

 

Sounds like Alfred may not have full disk access, something similar happened to another user after upgrading to 11.4: https://github.com/sballin/alfred-search-notes-app/issues/43#issuecomment-867308050

 

Here are what the permissions should look like: https://github.com/sballin/alfred-search-notes-app#required-permissions

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...