The environment variables are a pain in the butt, too. On the windows machine I tested with, there were two Path variables. I added to both…
(i had trouble initially because of the way windows forms the paths, backslashes/forwardslashes. Do you have the target.path.replace pattern correct in the template?)
Hiya, I’m not a techie but I’ve been trying to get this to work on Windows 10. When I tried to run the term tesseract in powershell, it gave me an error that looked something likes this (btw I’m aware of the misspelling - it’s just a representation).
Aferwards, I found this medium article which explains how to add System Variables. It looks like it’s working in poweshell for me now! But not in Obsidian (the red image is the error I am still getting).
Anyway, not sure if this was the obvious thing to do, just thought I’d throw in what little I found in case it helps someone . Would be really cool to get it to work in the future.
@joschmit, seems like it could be what you are having issue with as well.
This is weird. I successfully installed & used this on one machine (running Xubuntu 18.04). Synced up (including plugins & settings) on my laptop running Mint 20 & I when I try to create a new note from the OCR template I get the following error in the Obsidian console:
main.ts:213 Error with User Template ocr Error: Command failed: /usr/bin/tesseract “$ocr_input” -
/bin/sh: line 1: /usr/bin/tesseract: No such file or directory
at ChildProcess.exithandler (child_process.js:317)
at ChildProcess.emit (events.js:315)
at maybeClose (internal/child_process.js:1048)
at Socket.<anonymous> (internal/child_process.js:439)
at Socket.emit (events.js:315)
at Pipe.<anonymous> (net.js:673)
I’ve verified by copying the tesseract path & pasting into a terminal that it /usr/bin/tesseract is correct. Any suggestions about why it can’t be found?
Hello, I am getting the same parse error with version 1.12.0 of Templater on Obsidian 0.15.9.
The error message I get on the Console is Templater Error: Template parsing error, aborting. tp.user.ocr is not a function
Interestingly enough, on the same machine (Macbook Air with mas OS Monterey) with the same version of Obsidian, but in a different Vault where the version of Templater is 1.7.1 the same script as above is working fine.
Is there anything I should do differently or a workaround for this behavior, or do I have to do the OCR in the vault that works and copy the results in the other one?
Many thanks for your help with this issue.
Best regards
Sorry for the inconvenience. It looks like a templater update may have made the script no longer work. I don’t have time to troubleshoot, so I left a notice on the original post.
Thank you very much for your quick response. I will continue working with the two vault until a solution can be found.
Many thanks for a very useful script.
Best regards
hi,
same boat as you.
i snapshot MCQs on phone,
and wanna OCR them and edit/study on obsidian.
time flies, there are already plugins like “text extractor” and “taskbone ocr”.
the latter may need paid if heavily used.
text extractor, claim to use tesseract, dont function well
but there is a STANDALONE foss called capture2text, which also use tesseract but somehow they modified and function very very well.
capture2text support CLI command line mode. e.g. capture2text -i input.jpg -o output.jpg (or to clipboard)
the only remaining thing is how to make it work smoothly instead of ocr files 1 by 1. thanks
ps: i saw this OP used templater for this /w tesseract, so this may also be possible.