Jump to content

Obsidian Idea Capture - Write Todos, Ideas, Bookmarks, and Journal entries to your daily note without context switching


Recommended Posts

Hello, 

 

I wanted to share my first public Alfred workflow, a tool I made in my conquest towards ADHD management. My goal was to write down any sort of fleeting thought into my Obsidian notes, so I can continue to focus on what I should be doing.

 

Features:

  • Write to obsidian dailynote under a specific markdown header
    • `jt <msg>` ## TODO
    • `ji <msg>` ## Ideas
    • `jj <msg>` ## Journal
  • Creates daily note if it doesn't exist
  • Copy current chrome / safari tab as markdown link
  • Append current browser tab to daily notes 
    • Defaults to  ## Bookmarks, but modifier keys send to Todo or Ideas
  • Search notes for a browser tab
  • Search the content of your notes 
    • (requires shimmering obsidian)

 

Everything is hardcoded to use my headers but it should be easy to customize to use other terms or daily note structures / file name

 

See README for a few screen recorded gifs and more info

https://github.com/bs7280/Alfred-Note-Capture

 

 Would love any feedback on this, as its my first time publishing a workflow. And would love to hear if this tool is useful to you!

Link to comment

I followed the directions, but I get this error:

 


[12:51:51.073] ERROR: Obsidian Idea Capture[Run Script] Traceback (most recent call last):
  File "/Users/raguay/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/BBE171A4-F77A-4545-8645-1C3CD7CB669B", line 28, in <module>
    create_daily_note(vault)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 26, in create_daily_note
    with open(template_location, 'r') as f:
IsADirectoryError: [Errno 21] Is a directory: '/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/'

Link to comment
  • 2 weeks later...

Hey @raguay.customct sorry for just now noticing your repsonse. Im new to the forum and appear to have misconfigured my post notifications.

 

Also, thanks for checking out my plugin! So im guessing theres a bug in my code that has to do with not properly handling directories. My obsidian notes are all in one folder (I use a Dendron style of hierarchy management). Can you share some more info on:

  • all your config settings for the workflow
  • more info about the contents of your note structure? Share whatever your comfortable with but a screenshot of the top level of your note dir would be good.
  • Info on where you're daily notes live (especially if its in a folder

I expect to need to do a code fix for this, so your help debugging is very appreciated

Link to comment
6 hours ago, bshaughn said:

Hey @raguay.customct sorry for just now noticing your repsonse. Im new to the forum and appear to have misconfigured my post notifications.

 

Also, thanks for checking out my plugin! So im guessing theres a bug in my code that has to do with not properly handling directories. My obsidian notes are all in one folder (I use a Dendron style of hierarchy management). Can you share some more info on:

  • all your config settings for the workflow

CleanShot2023-12-18at09_00.50@2x.thumb.png.0579981d3b06c55cb27057d91ce52a28.png

  • more info about the contents of your note structure? Share whatever your comfortable with but a screenshot of the top level of your note dir would be good.

CleanShot2023-12-18at09_01.51@2x.thumb.png.0c5356307905dc5aeeed0a1160ab8adc.png

  • Info on where you're daily notes live (especially if its in a folder

The folder "daily" in the above picture. 

 

I expect to need to do a code fix for this, so your help debugging is very appreciated

I answered inside of you questions. I use a folder hierarchy for organization of indexes, but most of the actual files are all on the top level. That directory is inside of Dropbox for syncing to my iPad and iPhone as well. I just noticed I had one file miss named....got to fix that one.

 

I'm glad to help anyway you need it. This month is very busy with Christmas activities (I'm a missionary that does freelance programming). But I can test things you need tested. The biggest issue is that the workflow assumes everything is a file. The "Dendron style of hierarchy management" is the same as how S3 storage works, but the S3 system still allows access just like a normal file/folder system. 

Link to comment
  • 2 weeks later...
On 12/17/2023 at 8:08 PM, raguay.customct said:

I answered inside of you questions. I use a folder hierarchy for organization of indexes, but most of the actual files are all on the top level. That directory is inside of Dropbox for syncing to my iPad and iPhone as well. I just noticed I had one file miss named....got to fix that one.

 

I'm glad to help anyway you need it. This month is very busy with Christmas activities (I'm a missionary that does freelance programming). But I can test things you need tested. The biggest issue is that the workflow assumes everything is a file. The "Dendron style of hierarchy management" is the same as how S3 storage works, but the S3 system still allows access just like a normal file/folder system. 


Hello @raguay.customct thanks again for your help, and I hope you had a great Christmas.

 

Ive just now published an updated release that includes some fixes for folder related operations, as well as a dozen test cases. I am limited in my ability to test on your notes of course, but I added some test cases based on the error message you gave me, and some other examples created from your screenshot. Additionally, I tried to place a better emphasis on testing and supporting folder structures as you've mentioned. 

It should hopefully work now, technically I think you only need to update the `scripts/utils.py` file but not 100% sure. Here is the latest release: https://github.com/bs7280/Alfred-Note-Capture/releases/tag/v0.1.2 

It also includes the backend of my next big feature to do a fuzzy search and insert text at any filename + header in your notes, but the alfred workflow side isn't done yet 

On a somewhat related note... do you suggest a good resource for CICD practices for alfred pacakges? Testing my workflow outside of scripts is cumbersome, in an ideal world I could run  and export the new workflow as part of a pipeline, but that may not be possible.

Link to comment
9 hours ago, bshaughn said:


Hello @raguay.customct thanks again for your help, and I hope you had a great Christmas.

 

Ive just now published an updated release that includes some fixes for folder related operations, as well as a dozen test cases. I am limited in my ability to test on your notes of course, but I added some test cases based on the error message you gave me, and some other examples created from your screenshot. Additionally, I tried to place a better emphasis on testing and supporting folder structures as you've mentioned. 

It should hopefully work now, technically I think you only need to update the `scripts/utils.py` file but not 100% sure. Here is the latest release: https://github.com/bs7280/Alfred-Note-Capture/releases/tag/v0.1.2 

It also includes the backend of my next big feature to do a fuzzy search and insert text at any filename + header in your notes, but the alfred workflow side isn't done yet 

On a somewhat related note... do you suggest a good resource for CICD practices for alfred pacakges? Testing my workflow outside of scripts is cumbersome, in an ideal world I could run  and export the new workflow as part of a pipeline, but that may not be possible.

Just installed it and it still crashes on me. At first, I didn't have the template file "Templater/Daily". It gave this error:

 

[16:26:59.170] ERROR: Obsidian Idea Capture[Run Script] Traceback (most recent call last):
  File "/Users/raguay/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/C448380C-2638-4567-A154-B6475936DC3D", line 28, in <module>
    create_daily_note(vault)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 47, in create_daily_note
    with open(template_location, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/Templater/Daily'

 

I created the file in the Templater directory and it still errored because my file has the ".md" on the end. Without the ".md", Obsidian will not open it. I then removed the ".md" from the file name and tried again. It gave this error:

 

  File "/Users/raguay/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/2DD9295A-D75E-49A4-AF33-E814D8F90255", line 31, in <module>
    append_to_daily_vault(vault, header, content)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 144, in append_to_daily_vault
    new_text = insert_text(vault_path, header, message)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 104, in insert_text
    raise ValueError(f"Could not find header `{header}`")
ValueError: Could not find header `## Todo`

 

Which that header was in my file. Therefore, the regular expression you are using isn't finding it for some reason. It didn't save anything in my "daily" directory.

 

I had a good Christmas with my kids that live in Thailand, but still missing those in the US. It's hard having family in different countries!

Link to comment

Thanks @raguay.customct Im glad you were able to see some of your family. Also I think ill owe you a beer or coffee after all this help you've given.


TLDR:

  • First error I see the issue, and will share a fix in a few days to use the correct daily note template, OR use a default template. 
  • Second "Couldn't find header" error is likely because header must be an exact match to `## Todo` including header level and capitalization (these will be reworked soon)

Details:

 

It appears I need to fix / update the logic for using the existing daily template, and add a default value (as seen in the github README). I can't get the update out today but in the meantime, I want to see if we can fix the header not found issue. 
 

My current method to find a given header, and insert text, is a python re-write of the Shimmering Obsidian's JS script to do the same thing, and I intentionally kept some 'features' that I intend to change very soon. One of those is the strict matching of the given header. E.g. searching for `## Todo` will fail if the daily note's header is `# Todo` (or vice versa). Even before trying to write this workflow, I was having issues with the shimmering obsidian append feature, and it had to do with not an exact match of my "search header" and what was actually in my daily notes.

 

Additionally, the headers for each part of the workflow are hard coded, I want to add them to the workflow config eventually. So Im guessing the last issue is a slight mismatch in the exact daily note headers. Im working on a complete re-write of this method to support some more advanced workflow feature i'm working on, but until then can you try this:

 

  • Copy the following markdown snippet to a daily note
  • try running one of the workflow's "Append to daily note" commands

If this doesn't work, then can you share your daily template / daily note? 


 

Template markdown:

```

## Todo

 

## Ideas

 

## Journal

 

## Bookmarks

 

## Other

```

Thanks again, and happy new year!

Link to comment

I got this error when trying to run: (in Alfred Debugger)

 

[13:10:48.407] Logging Started...
[13:10:58.486] Obsidian Idea Capture[Keyword] Processing complete
[13:10:58.488] Obsidian Idea Capture[Keyword] Passing output 'testing dd ' to Arg and Vars
[13:10:58.489] Obsidian Idea Capture[Arg and Vars] Processing complete
[13:10:58.490] Obsidian Idea Capture[Arg and Vars] Passing output '' to Run Script
[13:10:58.553] ERROR: Obsidian Idea Capture[Run Script] xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Link to comment

Thanks for replying @Stephen_C. I hadn't updated homebrew in a while, so installing CLT solved the xcrun issue. Now this is the error I'm getting: 

 

[13:19:43.133] Obsidian Idea Capture[Arg and Vars] Processing complete
[13:19:43.135] Obsidian Idea Capture[Arg and Vars] Passing output '' to Run Script
[13:19:43.177] ERROR: Obsidian Idea Capture[Run Script] Traceback (most recent call last):
  File "/Users/ballard/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E216E5AB-E5E3-4738-BFFC-13E74E8BEEA6", line 31, in <module>
    append_to_daily_vault(vault, header, content)
  File "/Users/ballard/Documents/Alfred/Preferences/Alfred.alfredpreferences/workflows/user.workflow.5F68CEB5-15DC-4EA3-AAE2-8A8A6C79D471/scripts/utils.py", line 144, in append_to_daily_vault
    new_text = insert_text(vault_path, header, message)
  File "/Users/ballard/Documents/Alfred/Preferences/Alfred.alfredpreferences/workflows/user.workflow.5F68CEB5-15DC-4EA3-AAE2-8A8A6C79D471/scripts/utils.py", line 104, in insert_text
    raise ValueError(f"Could not find header `{header}`")
ValueError: Could not find header `## Bookmarks`

Link to comment

 

Hi @bb13 thanks for your interest in this workflow, and thanks @Stephen_C for helping debug. 

The new error your seeing is definitely a bug in my the plugin that im going to try to release a fix for today or tomorrow. Basically it expects your daily note to contain certain headers, so I set my daily note template to have some preset headers including `## Bookmarks`. You can test that its working by adding `## Bookmarks` exactly as is to your current daily note and it should work. 

Another bug is that its supposed to automatically add the header if it doesn't exist, or use a default template if your obsidian template doesn't exist.... but its not working. 

Im going to try to fix this and release this tonight, and ill be at my computer pretty much all evening available to help!

Link to comment

Hi, I just installed it and it created the note fine in the main vault, but I would like to have them in the "daily" folder that I use for daily notes. It would be nice to have a field for specifying the daily notes folder. I have over 200 notes and finding the daily one in that list isn't easy.

Edited by raguay.customct
Link to comment

Hi @raguay.customct that should be supported now. I update how the daily path config works and it should allow any folder naming convention.

 

`path/to/dailynotes/%Y/%m/note_%d` would generate a path like `path/to/dailynotes/2023/01/note_06.md` as an example for today. 

 

Some notes regarding the behavior:

- will create all folders if they don't exist

- daily note naming convention allows you to add `.md` in your config, but will add it to the path if not present. 

 

This should hopefully allow as much flexibility as anyone would need. 
 

Link to comment
44 minutes ago, bshaughn said:

Yep. It produces this:

 

 

[14:53:48.269] Logging Started...
[14:53:53.175] Obsidian Thought Capture[Keyword] Processing complete
[14:53:53.189] Obsidian Thought Capture[Keyword] Passing output 'help' to Arg and Vars
[14:53:53.190] Obsidian Thought Capture[Arg and Vars] Processing complete
[14:53:53.191] Obsidian Thought Capture[Arg and Vars] Passing output '' to Run Script
[14:53:53.192] Obsidian Thought Capture[Arg and Vars] Passing output '' to Debug
[14:53:53.193] Obsidian Thought Capture[Debug] '', {
  config_obsidian_vault = "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/daily/%Y/%m/note_%d"
  daily_note_format = "%Y-%m-%d"
  input_append = "message"
  message = "help"
  note_header = "## Todo"
  open_after_appending = "0"
}
[14:53:53.239] ERROR: Obsidian Thought Capture[Run Script] Traceback (most recent call last):
  File "/Users/raguay/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/EAF6480F-FD95-4C71-B702-258326BAD850", line 29, in <module>
    create_daily_note(vault)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 58, in create_daily_note
    template_location = get_daily_template(vault_path)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 77, in get_daily_template
    sys.stderr.write(
TypeError: TextIOWrapper.write() takes no keyword arguments

Link to comment
9 hours ago, raguay.customct said:

Yep. It produces this:

 

 

[14:53:48.269] Logging Started...
[14:53:53.175] Obsidian Thought Capture[Keyword] Processing complete
[14:53:53.189] Obsidian Thought Capture[Keyword] Passing output 'help' to Arg and Vars
[14:53:53.190] Obsidian Thought Capture[Arg and Vars] Processing complete
[14:53:53.191] Obsidian Thought Capture[Arg and Vars] Passing output '' to Run Script
[14:53:53.192] Obsidian Thought Capture[Arg and Vars] Passing output '' to Debug
[14:53:53.193] Obsidian Thought Capture[Debug] '', {
  config_obsidian_vault = "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/daily/%Y/%m/note_%d"
  daily_note_format = "%Y-%m-%d"
  input_append = "message"
  message = "help"
  note_header = "## Todo"
  open_after_appending = "0"
}
[14:53:53.239] ERROR: Obsidian Thought Capture[Run Script] Traceback (most recent call last):
  File "/Users/raguay/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/EAF6480F-FD95-4C71-B702-258326BAD850", line 29, in <module>
    create_daily_note(vault)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 58, in create_daily_note
    template_location = get_daily_template(vault_path)
  File "/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/rag/Alfred/Sync/Alfred.alfredpreferences/workflows/user.workflow.775A24A9-363A-43C5-B47B-BF3020C71437/scripts/utils.py", line 77, in get_daily_template
    sys.stderr.write(
TypeError: TextIOWrapper.write() takes no keyword arguments



Ok so I made a dumb error in an exception logging line that's causing the error, but it appears your vault path and daily path are slightly misconfigured, so I think there's an easy fix on your end. 


Current settings:

`vault_path="/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/daily/%Y/%m/note_%d"`

`daily_note_format = "%Y-%m-%d"`

Note the vault path is including the datetime formatter terms, and is pointing to where you want your daily notes.

So you need to change it to:

 

`vault_path="/Users/raguay/Library/CloudStorage/Dropbox-Personal/Richard/Notes/TheArchive/"`

`daily_note_format = "daily/%Y/%m/note_%d"`

And that should work for you, though I do need to fix that one bugged logging line next time I publish a feature. 

Link to comment

@raguay.customct Nice im happy its working. I hope it can be useful for you in your daily work, and I'll have some even more powerful features soon. My goal is to allow the same idea of inserting notes / links but to any document or header in your notes in a convenient way, not just 4 hard coded headers in your daily notes.

And no need to apologize, your help has been very appreciated, I never would of found these bugs myself. Hope you kick the pneumonia soon, that's no fun. 

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...