Alan He Posted February 8 Share Posted February 8 Activate OCR keywords, select the screen area, and press Enter to immediately obtain the text. Use the built-in OCR, no need to install dependencies. 1. I am the author 2. workflow no any dependency. 3. https://github.com/alanhg/alfred-workflows/tree/master/ocr snoop182, Grug and godbout 3 Link to comment
vitor Posted February 14 Share Posted February 14 This is simple enough and looks quite ready to go in the Gallery, but I have a few suggestions:You don’t need the Run Script, you can and should instead use the Run Shortcut automation. That would make it use no code and be a good candidate for the “Good for Learning” category.Would be useful to add a Hotkey Trigger too. I can imagine someone using e.g. ⌘⇧6 to take the screenshot and get the text. By the way: nice use of the Automation Task. Grug and Alan He 2 Link to comment
Alan He Posted February 17 Author Share Posted February 17 (edited) On 2/15/2024 at 3:21 AM, vitor said: This is simple enough and looks quite ready to go in the Gallery, but I have a few suggestions: You don’t need the Run Script, you can and should instead use the Run Shortcut automation. That would make it use no code and be a good candidate for the “Good for Learning” category. Would be useful to add a Hotkey Trigger too. I can imagine someone using e.g. ⌘⇧6 to take the screenshot and get the text. By the way: nice use of the Automation Task. Thank you for your suggestion. 1. I have updated the workflow, have a try. 2. because I change shortcuts, you must delete the OCR and then trigger the workflow. 3. I set Hotkey as ⌘ ⇧ 7 because the ⌘ ⇧ 6 conflicts with the system setting. Any user can customize the hotkey. Edited February 17 by Alan He Link to comment
Alan He Posted February 19 Author Share Posted February 19 @vitor Thank you for reviewing it again. Link to comment
vitor Posted February 19 Share Posted February 19 It’s live at https://alfred.app/workflows/alanhe/ocr/. Alan He 1 Link to comment
godbout Posted February 20 Share Posted February 20 this is so cool 😂️😂️😂️ fuck i'm amazed. what winner Alfred is. Alan He 1 Link to comment
Stooovie Posted March 30 Share Posted March 30 Any way to add different languages for recognition? Link to comment
Alan He Posted April 8 Author Share Posted April 8 On 3/30/2024 at 4:02 PM, Stooovie said: Any way to add different languages for recognition? Have you ever tried to recognize another language and failed? Link to comment
selfmade69 Posted May 10 Share Posted May 10 Is it just me or this really require full swift command line tool to be downloaded and installed? Its taking some 24 plus hours downloading for the command line tool! Link to comment
vitor Posted May 10 Share Posted May 10 1 hour ago, selfmade69 said: Is it just me or this really require full swift command line tool to be downloaded and installed? This workflow? It doesn’t, no. 1 hour ago, selfmade69 said: Its taking some 24 plus hours downloading for the command line tool! If it’s taking that long, there’s either a problem on your end of the connection or something went wrong on Apple’s side. I’d wager something hanged and would recommend restarting it. Link to comment
Faris Najem Posted May 12 Share Posted May 12 On 2/17/2024 at 5:02 AM, Alan He said: 1. I have updated the workflow, have a try. Hi, @Alan He, Thank you so much for this helpful workflow. I have a query regarding its functionality. Is there a method to prevent the screenshot from being saved to the clipboard, retaining only the OCR text? I attempted to disable the "Save to Clipboard" option within the "Interactive Screenshot" item, but it seems to result in an empty clipboard. Is there an alternative solution to achieve this? Thank you again. Alan He 1 Link to comment
Alan He Posted May 14 Author Share Posted May 14 On 5/13/2024 at 5:41 AM, Faris Najem said: Hi, @Alan He, Thank you so much for this helpful workflow. I have a query regarding its functionality. Is there a method to prevent the screenshot from being saved to the clipboard, retaining only the OCR text? I attempted to disable the "Save to Clipboard" option within the "Interactive Screenshot" item, but it seems to result in an empty clipboard. Is there an alternative solution to achieve this? Thank you again. I think you have a point, but how to implement it I need to think about. One way is that OCR here if I have to use the clipboard to pass the image then I can only script the deletion of the last image history after recognition. Link to comment
vitor Posted May 14 Share Posted May 14 8 hours ago, Alan He said: then I can only script the deletion of the last image history after recognition. I strongly advise against that. You should not be writing to Alfred’s clipboard database yourself, at the risk of corrupting it. If you don’t want the image in the clipboard at all, then save it to a file instead. Having the image in the clipboard is not a major concern. Those don’t last long in the Clipboard History. Link to comment
Alan He Posted May 14 Author Share Posted May 14 26 minutes ago, vitor said: I strongly advise against that. You should not be writing to Alfred’s clipboard database yourself, at the risk of corrupting it. If you don’t want the image in the clipboard at all, then save it to a file instead. Having the image in the clipboard is not a major concern. Those don’t last long in the Clipboard History. Hmmm, it would be nice if there was a way to screen capture without putting it on the clipboard, that would be nice to control. Link to comment
vitor Posted May 14 Share Posted May 14 4 hours ago, Alan He said: it would be nice if there was a way to screen capture without putting it on the clipboard Like I said, save it to a file if you don’t want it on the clipboard, the Automation Task allows for that. Those are the two options; it has to go somewhere or it wouldn’t be useful. If you want it to save to the clipboard but not show up in Clipboard History, mark the data as concealed and Alfred by default won’t save it. In JavaScript for Automation it would be something like: ObjC.import("AppKit") function copySensitiveImage(imagePath) { const pboard = $.NSPasteboard.generalPasteboard const image = $.NSImage.alloc.initWithContentsOfFile(imagePath) pboard.clearContents pboard.setStringForType(undefined, "org.nspasteboard.ConcealedType") pboard.setDataForType(image.TIFFRepresentation, $.NSPasteboardTypeTIFF) } copySensitiveImage("/some/path/here") But again, you should be saving it to a file instead. Alan He 1 Link to comment
Alan He Posted May 15 Author Share Posted May 15 (edited) On 5/14/2024 at 6:04 PM, vitor said: I strongly advise against that. You should not be writing to Alfred’s clipboard database yourself, at the risk of corrupting it. If you don’t want the image in the clipboard at all, then save it to a file instead. Having the image in the clipboard is not a major concern. Those don’t last long in the Clipboard History. @vitor Where to set store image to specified location ???? If you uncheck save to clipboard. Screenshots are stored on the desktop by default, which is definitely not appropriate. I need support for storing to a specific directory Edited May 15 by Alan He Link to comment
vitor Posted May 15 Share Posted May 15 When saving as an image, the Automation Task outputs the path of the saved image as an argument to the next object. Connect something else to it (like a Move With the Finder Automation Task) to move it somewhere else. That Automation Task will also in turn return the destination path of the image. You can keep chaining as needed. Alan He 1 Link to comment
Alan He Posted May 15 Author Share Posted May 15 On 5/13/2024 at 5:41 AM, Faris Najem said: Hi, @Alan He, Thank you so much for this helpful workflow. I have a query regarding its functionality. Is there a method to prevent the screenshot from being saved to the clipboard, retaining only the OCR text? I attempted to disable the "Save to Clipboard" option within the "Interactive Screenshot" item, but it seems to result in an empty clipboard. Is there an alternative solution to achieve this? Thank you again. https://github.com/alanhg/alfred-workflows/tree/master/ocr just have a try. v3 No need to store screenshot to the clipboard when taking screenshot. Link to comment
Faris Najem Posted May 16 Share Posted May 16 23 hours ago, Alan He said: just have a try. v3 Yes! now it doesn't store screenshots in the clipboard. Thank you so much. Link to comment
DrSirius Posted May 17 Share Posted May 17 On 2/19/2024 at 12:53 AM, Alan He said: @vitor Thank you for reviewing it again. I am trying to get this to work but the temp.png file is always blank and weird. What can be the problem? Link to comment
DrSirius Posted May 20 Share Posted May 20 My Screenshots, although being taken of a screen are showing the image of the desktop image instead! Help please! 😐 See below! Link to comment
effndc Posted May 20 Share Posted May 20 It seems that macOS 14.5 broke this and any other Shortcut that attempts to "Copy text from image". If manually do a screenshot, select to grab text from image, select all, paste it works. If I use your shortcut or any other that uses the same Shortcut actions they fail to actually extract the text. Link to comment
Octavius Posted May 21 Share Posted May 21 Unfornutly same. Mac OS 14.4.1 (23E224). The plugin just does a screenshot of desktop wallpapers instead of a window. It looks like all windows are fully transparent for him. Link to comment
vitor Posted May 22 Share Posted May 22 3 hours ago, Octavius said: The plugin just does a screenshot of desktop wallpapers instead of a window. You have to enable permissions to record the screen. Alan He 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now