Jump to content

zeitlings

Member
  • Posts

    263
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by zeitlings

  1. I guess so. My first experiments, from which the workflow is derived, were actually with PDF documents. I'll play around with that sometime.
  2. Ah, I shouldn't have linked to the explicit release. There has been another update in the meantime that fixes the problem that was caused by leaving some deprecated paths in place. The security issue is supposed to be dealt with by the permission handler, which should work in the latest release. The executable is always located in the workflow folder (double-click on any object in the Alfred workflow and at the bottom left of the window that opens there is a folder icon that opens that folder when you click on it).
  3. Sure, ⌘⇧6 feels like a natural extension. There's already an updated version that also bundles a higher resolution icon. As for the dictionary workflow, it works by calling some cryptic API endpoints that are only accessible via Objective-C. Unfortunately, there is no way to do this in plain swift that I know of. I'll send you a message about the rest.
  4. Alfred OCR I noticed that Apple's Vision framework finally produces some usable results. This means: No external dependencies are required to perform the OCR. Alfred OCR Light The workflow allows you to copy text from images using optical character recognition. Take a snapshot with your mouse or trackpad to automatically copy the recognized text to the clipboard. Alfred OCR+ The workflow allows you to copy text from images, or to convert PDF files into searchable PDF documents using optical character recognition, and to apply compression to PDF documents. 1 / Snapshot Take a snapshot with your mouse or trackpad to automatically copy the recognized text to the clipboard. Default shortcut: ⌘+⇧+6 Default keyword: ocr 2 / PDF Document To convert a PDF into a searchable PDF document, pass it to the workflow’s Universal Action. To compress the resulting PDF, pass the source document on while pressing the ⌘+⇧ keys. To open the resulting PDF, pass the source document on while pressing the ⌥+⇧ keys. To force the replacement of a source document, pass it on while pressing the ⌥+⌘ keys. To compress a PDF without performing OCR, pass it to the Compress PDF Document File Action. To view the progress tracker, re-enable the workflow with the Keyword (default: ocr). Configuration To open the OCR Workflow Configuration, type the keyword preceeded by a colon (default: ocr). Languages Specify the languages you want the OCR process to consider by adding the appropriate RFC-5646 language tag. The following languages (and regions) are currently supported: en-US, fr-FR, it-IT, de-DE, es-ES, pt-BR, zh-Hans, zh-Hant, yue-Hans, yue-Hant, ko-KR, ja-JA, ru-RU, uk-UA Explanations: en-US: (English as used in the United States) de-DE: (German as used in Germany) fr-FR: (French as used in France) it-IT: (Italian as used in Italy) es-ES: (Spanish as used in Spain) pt-BR: (Portuguese as used in Brazil) ko-KR: (Korean as used in South Korea) uk-UA: (Ukrainian as used in Ukraine) ja-JA: (Japanese as used in Japan) ru-RU: (Russian as used in Russia) yue-Hant: (Traditional Cantonese) yue-Hans: (Simplified Cantonese) zh-Hant: (Traditional Chinese) zh-Hans: (Simplified Chinese) Change Log v1.4.0 (OCR+) Added bitmap compression and compression facets Added embedding strategy options "Word Granularity" attempts to embed the text word by word "Line Oriented" is the strategy previously used (use if you encounter unexpected results) Improved OCR embedding granularity Fixed 'Recognizer init' error v1.3.0 (OCR+) Added PDF compression Added a keyword for quick access to the workflow configuration (Alfred 5.1+) Added Universal Action modifier option to apply compression to PDFs (⇧⌘) Added Universal Action modifier option to open converted PDFs in the default application (⌥⇧) Added a configuration option to open converted PDFs in the default application Added a configuration option to specify how text should be joined when taking a snapshot Added a File Action to compress PDF documents Changed the modifier keys to replace a PDF and added noticeable visual cues (⌥⌘) Changed the way an export strategy is specified by using a pop-up selection box Improved performance v1.2.3 (OCR+) Fixed an error thrown due to missing workflow cache directory Fixed snapshot tasks queuing up if they are started before the previous task has finished Added explicit opt-out of Snapshot tasks while PDF conversions are running v1.2.2 (OCR+) Fixed low contrast output images produced for some PDF documents Added progress tracker for the document recognition process Added three options to handle document output: export to location, copy to same location and replace. Priority behavior: Replace > Copy > Export. Added new icons Improved output file size for PDF documents that do not already contain text v1.2.0 (OCR Light) Add File Action to extract text from images Fix for macOS Sonoma (Compiles the script en passant to compensate for the failure to link objc symbols on macOS 14). v1.1.1 (OCR Light) Adds if #available check to accommodate macOS 12.0 v1.1.0 (OCR Light) Updated configuration and documentation Added new icon
  5. Sounds like your three months trial is over...
  6. Define Word I wanted a slightly better dictionary for lookups. In particular, I wanted well formatted previews of the entries without having to open the Dictionary app. You can choose from all available dictionaries that are installed on your system, define the fallback dictionaries for your lookups, set the font size of the previews, or manually select a dictionary to use. The previews reflect the global appearance, i.e. they have a dark mode! The workflow also includes a preset for looking up synonyms of a word and a convenient keyboard shortcut for quick lookups. ‣Download from Github ◂ Usage Note Specify the dictionaries you want to use (see Dictionary Options below). Define a fallback dictionary against which possible misspellings will be checked. The workflow can be used as a multilingual spell checker. Default keyword: def Default shortcut: ⌥+⇧+D Keyword sd: Select a specific dictionary for lookups Keyword synd: Find synonyms by consulting the thesauri only (english) Cache reset: def ? Modifiers ⇧ or ⌘Y to preview the dictionary entry ⌃ to see the dictionary associated with the entry ⌘C to copy the dictionary entry’s plain text to the clipboard ⌘⏎ to paste a word to the frontmost application (spell checker) ⌘L to view the plain text as large type Preview Dictionary Options Oxford Study Indonesian Dictionary - Inggris-Indonesia • Indonesia-Inggris Oxford PWN Polish-English Dictionary / Wielki słownik polsko-angielski Oxford Paravia Il Dizionario inglese - italiano/italiano - inglese Oxford Portuguese Dictionary - Português-Inglês • Inglês-Português Oxford Turkish Dictionary - Türkçe-İngilizce • İngilizce-Türkçe Dicionário de Português licenciado para Oxford University Press Dizionario italiano da un affiliato di Oxford University Press Oxford Russian Dictionary - Русско-Английский • Англо-Русский Gran Diccionario Oxford - Español-Inglés • Inglés-Español Oxford Arabic Dictionary - عربي-إنجليزي • إنجليزي-عربي Oxford Urdu Dictionaries - اردو۔انگریزی • انگریزی-اردو Oxford Gujarati Dictionaries - ગુજરાતી-અંગ્રેજી • અંગ્રેજી-ગુજરાતી Oxford Tamil Dictionaries - தமிழ்-ஆங்கிலம் • ஆங்கிலம்-தமிழ் พจนานุกรมอังกฤษ-ไทย & ไทย-อังกฤษ ฉบับทันสมัยและสมบูรณ์ที่สุด Magay Tamás szótár - Magyar-Angol • Angol-Magyar Oxford Telugu Dictionaries - తెలుగు-ఇంగ్లీష్ • ఇంగ్లీష్-తెలుగు Velký anglicko-český a česko-anglický slovník Oxford Bengali Dictionaries - বাংলা-ইংরেজি • ইংরেজি-বাংলা Diccionario General de la Lengua Española Vox MOT sanakirja suomi-englanti, englanti-suomi Oxford Hindi Dictionaries - हिन्दी-अंग्रेज़ी • अंग्रेज़ी-हिन्दी מילון אבן-שושן מחודש ומותאם לשנות האלפיים Multidictionnaire de la langue française PONS Großwörterbuch Französisch Deutsch Oxford American Writer’s Thesaurus Duden-Wissensnetz deutsche Sprache Oxford-Hachette French Dictionary Толковый словарь русского языка New Oxford American Dictionary Prisma Handwoordenboek Engels Prisma woordenboek Nederlands Oxford Dictionary of English พจนานุกรมไทย ฉบับทันสมัยและสมบูรณ์ Oxford Thesaurus of English Politikens Nudansk Ordbog Oxford German Dictionary 超級クラウン中日辞典 / クラウン日中辞典 Arkadaş Türkçe Sözlük 뉴에이스 영한사전 / 뉴에이스 한영사전 ウィズダム英和辞典 / ウィズダム和英辞典 Apple Dictionary Từ điển Lạc Việt TTY Dictionary Norsk Ordbok राजपाल हिन्दी शब्दकोश 商務新詞典(全新版) NE Ordbok 뉴에이스 국어사전 譯典通英漢雙向字典 现代汉语同义词典 英譯廣東口語詞典 牛津英汉汉英词典 漢英對照成語詞典 现代汉语规范词典 五南國語活用辭典 スーパー大辞林 汉语成语词典
  7. I assume you’re using the soulver workflow. You can create or copy-paste the script filter object, set the keyword to $ and enter this in the Script text field: ./alfred-soulvercore "$1 usd to eur". This will call the equivalent of your c $1 usd to eur query. You can set up a hotkey to define the word from your text selection, e.g. alt+shift+d (define the prefix “define” on the hotkey object). In `Preferences > Features > Dictionary' you can also replace “define” with a shorter keyword. The small 1-line preview has also been bothering me for a while though. I’ve just been looking into it, and it should be easy enough to create a workflow that provides a QuickLook preview. I’ll come back to this when I find the time.
  8. Choose the Run Script object, pick /usr/bin/osascript (AppleScript) from the Language dropdown and paste this into the Script text field: tell application "Finder" to activate
  9. Now supports deep linking, which is new to DEVONthink 3.9, i.e. selection links and annotation links. To get the full annotation link, your text selection just needs to overlap it. I anticipate poor performance for very large PDFs and in cases where the selected text occurs quite often in the document. For these cases, the annotation check can be disabled in the configuration. Here is the AppleScript, if anyone is interested in it: (* Part of the DEVONthink ↔ PDF Expert workflow for Alfred v2.1.1 https://github.com/zeitlings/alfred-workflows#14-devonthink--pdf-expert Get the DEVONthink page link, selection link, or annotation link for the page viewed in PDF Expert ==================================================================== Credits - pete31: https://discourse.devontechnologies.com/t/script-open-devonthink-record-for-pdf-expert-tab/47243 - Umlaut fix: https://stackoverflow.com/a/23226449/7625403 *) use AppleScript version "2.4" use framework "PDFKit" use scripting additions property NSURL : a reference to current application's NSURL property NSString : a reference to current application's NSString property PDFDocument : a reference to current application's PDFDocument on run argv set checkForAnnotations to (item 1 of argv as integer) as boolean tell application "System Events" set bufferedClipboard to the clipboard activate application "PDF Expert" delay 0.5 tell process "PDF Expert" to keystroke "c" using {command down} delay 0.2 set perhapsSelection to the clipboard as text tell process "PDF Expert" to keystroke "g" using {command down, option down} -- go to tell application "System Events" to keystroke "c" using command down delay 0.5 tell application "System Events" to key code 53 -- esc set theActiveLabel to the clipboard try tell application process "PDF Expert" tell window 1 set theFileName to value of attribute "AXTitle" & ".pdf" if theFileName starts with "* " then set theFileName to characters 3 thru -1 in theFileName as string end tell set PID to unix id end tell on error error_message number error_number return "Error with code " & (error_number as text) & " " & (error_message as text) end try end tell set thePath to my recoveredPath(theFileName, PID) set theURL to NSURL's fileURLWithPath:(NSString's stringWithString:thePath) set pdf to PDFDocument's alloc()'s initWithURL:theURL set theCount to pdf's pageCount() set thePageIndex to -1 set cur to 0 repeat while cur < theCount set thePage to pdf's pageAtIndex:cur set theLabel to thePage's label() if theLabel ≠ missing value then if (theLabel as text) is theActiveLabel then set thePageIndex to cur exit repeat end if end if set cur to cur + 1 end repeat if thePageIndex is equal to -1 then set the cliboard to bufferedClipboard return "Unable to recover Page Index" end if set pageLink to my referenceURL(thePath, thePageIndex) try set thePage to pdf's pageAtIndex:thePageIndex -- ------------------------------------- -- -- Check for annotation intersection -- -- ------------------------------------- -- if checkForAnnotations then set theSelections to pdf's findString:perhapsSelection withOptions:3 repeat with thisSelection in theSelections if (thisSelection's pages() as list) contains thePage then set theBounds to (thisSelection's boundsForPage:thePage) set theOrigin to item 1 of theBounds set theSize to item 2 of theBounds set coorX to item 1 of theOrigin set coorY to item 2 of theOrigin set width to item 1 of theSize set height to item 2 of theSize repeat with thisAnnotation in thePage's annotations() set annotationBounds to thisAnnotation's |bounds|() set annotationOrigin to item 1 of annotationBounds set annotationSize to item 2 of annotationBounds set annoX to item 1 of annotationOrigin set annoY to item 2 of annotationOrigin set annoWidth to item 1 of annotationSize set annoHeight to item 2 of annotationSize set a to (coorX < (annoX + annoWidth)) set b to ((coorX + width) > annoX) set c to (coorY < (annoY + annoHeight)) set d to ((coorY + height) > annoY) set isIntersecting to a and b and c and d if isIntersecting then set theType to thisAnnotation's type() as text -- possibly nil if theType is missing value then set theType to "Highlight" end if set x to (round annoX rounding as taught in school) as text -- .... set y to (round annoY rounding as taught in school) as text set deepAnnotationLink to (pageLink as text) & "&annotation=" & theType & "&x=" & x & "&y=" & y set the clipboard to deepAnnotationLink return deepAnnotationLink end if end repeat end if end repeat end if -- ------------------------------ -- -- Reconstruct page selection -- -- ------------------------------ -- set theText to thePage's |string|() set theRange to theText's rangeOfString:perhapsSelection if theRange's |length|() ≠ 0 then set theStart to theRange's location() as text set theLength to theRange's |length|() as text set theSelection to NSString's stringWithString:perhapsSelection set theSearchString to theSelection's stringByAddingPercentEncodingWithAllowedCharacters:(current application's NSCharacterSet's URLQueryAllowedCharacterSet()) set deepSelectionLink to pageLink & "&start=" & theStart & "&length=" & theLength & "&search=" & theSearchString set the clipboard to deepSelectionLink return deepSelectionLink end if set the clipboard to pageLink return pageLink on error number -2753 -- not defined set the cliboard to bufferedClipboard return "Document not found in any open Database" end try end run on recoveredPath(theFileName, PID) set theOpenFiles to (do shell script "lsof -p " & PID) set convertedOutput to (do shell script "iconv -t UTF8-MAC <<<$" & quoted form of theOpenFiles) set theLines to paragraphs of convertedOutput repeat with thisLine in theLines if thisLine contains theFileName then set thePath to characters (offset of "/" in thisLine) thru -1 in thisLine as string return thePath end if end repeat end recoveredPath on referenceURL(thePath, thePageIndex) tell application id "DNtp" try set theDatabases to databases set theResults to {} repeat with thisDatabase in theDatabases set dbResults to lookup records with path thePath in thisDatabase set theResults to theResults & dbResults end repeat if theResults = {} then return else set theUUID to uuid of (item 1 of theResults) set referenceURL to "x-devonthink-item://" & theUUID & "?page=" & (thePageIndex as text) return referenceURL end if on error error_message number error_number return "Error with code " & (error_number as text) & " " & (error_message as text) end try end tell end referenceURL
  10. At the very top of my list are Menu bar search, Dict.cc, this dark/ light mode switcher, which apparently is not available anymore, a text processing workflow I wrote for transforms, stats, fixing, extracting etc., and my devonthink workflow, as I practically live in that application. These I use quite frequently, but perhaps not daily: The ancient Unicode Symbols Search A trivial workflow I wrote to append something to my Logseq inbox. Another workflow I wrote for getting merged citation references from various sources or to look up what else an author has published The classic Word Search, although there have to be improved versions of this My What Unicode Character is this? workflow whenever I’m doing NLP stuff OCR And recently Window Switcher (either vitor’s or wooshy to catch dialog-like windows, such as the emoji pane, which only the latter registers; with wooshy, unfortunately, there’s some noise sometimes that is not filtered) Alfred History Search (I would like to use it more, but some limitation causes many queries not to be picked up) Then I have several File Filters for searching specific file types either by name or through their contents, several hotkeys to quickly launch applications and two hotkeys that streamline two Alfred base functions: define the highlighted word spell the highlighted word this one I basically use for ad hoc autocorrects of typos. Select the word, hit shift+alt+s, hit enter, hit command+v and in 99% of all cases the matter is closed 😄
  11. As a quick fix, you could create the sdef for dt3 in the terminal. Then you just have to move it to a place where the workflow can detect it. sdef /Applications/DEVONthink\ 3.app > DEVONthink3.sdef
  12. Hey, @dfay. Ah, the file extension got lost somehow. You can try again now: https://github.com/zeitlings/alfred-devonthink/releases or just append ".alfredworkflow" to the filename in Finder.
  13. DEVONthink 3 Portal Advanced DEVONthink 3 interface for your databases. Search files or groups and interact with them through Alfred. Use A dvn [ ] [ . ] [ {query} ] dvn Displays the available databases dvn . Displays global actions dvn {query} Initiates a global search dvn :c Shows internal configuration Use B ddvn [ {query} ] ddvn {query} Initiates a file filter brute-force search (fast) Feature Overview (Selection) Global and Database Search Tag Search with Auto Suggest Document Actions move, replicate, duplicate, create annotation file, find similar items, etc. Extra Get the BibTeX reference or CSL formatted citation from a DOI, ISBN or jstore URL. CSL formatted citations can also be generated from an existing BibTeX reference.1 Multiple Document Actions move, replicate, open all, reciprocal linking, etc. Navigate the Folder Structure Import New Documents Customizable Annotation Templates Colored Labels Colored Flags on Labeled Records Documentation You can find the full documentation of the workflow on Github.
  14. Get either the DEVONthink 3 reference URL from PDF Expert, i.e. the x-devonthink-item page link for the active document opened in PDF Expert, the selection link if you have text selected, or the annotation link if your selection intersects an annotation and checking for annotations is enabled. cmd ⌘ to open the PDF on the same page in DEVONthink .xdev to enable or disable opening the document in DEVONthink when using the hotkey Expected result A x-devonthink-item://1D7FA99A-AAFF-4883-9853-F0666A650400?page=6 Expected result B x-devonthink-item://1D7FA99A-AAFF-4883-9853-F0666A650400?page=6&start=66&length=9&search=selection Expected result C x-devonthink-item://1D7FA99A-AAFF-4883-9853-F0666A650400?page=6&annotation=Squiggly&x=212&y=406 Known issues Fails with documents opened in PDF Expert split view Download and Preview: https://github.com/zeitlings/alfred-workflows#14-devonthink--pdf-expert
  15. Convert Roman numerals to decimal and vice versa. Accepts Arabic numbers in the range 1 to 3999. Download on Github
  16. The What Unicode character is this? workflow tells you which unicode character it is. Given a character or string, you will get the unicode code points, the scalar names and general categories. Modifiers Holding ⌘ yields \u{30C4} (swift, ES6 formatted) Holding ⌥ yields \u30C4 (python, go formatted) Holding ⌃ yields &#x30C4; (HTML entity) Holding ⇧ yields 0x30C4 (hex literal) Inverse Given a hex value, either raw or in one of the above formats, will return its corresponding Unicode character. For example, whatisit? \u{1F914} will return the info for 🤔
  17. Search, navigate and view information from duden.de German spelling dictionary. shift ⇧ or cmd ⌘+Y: Get QuickLook previews for the landing page, grammar, and synonymscmd ⌘+L to view the full entry contents.Action synonymes to list all synonyms. Action any synonym to view the entry for it.Action examples or idioms to list all that are available. https://github.com/zeitlings/alfred-workflows#11-duden-workflow Credits SwiftSoup
  18. Hey, I found a way to implement modifier palettes and double-tap hotkeys, i.e. a way to invoke actions on consecutive keystrokes. The core idea is to inject environment variables into the workflow configuration and to modify them with some delay. For example, you could use ⌥K to do multiple things. On its own, the hotkey would do nothing, but when activated shortly after hitting another hotkey that activates some palette, it will trigger a specific action: ⌥O, ⌥K To trigger action A (e.g. launch an app) ⌥I, ⌥K To trigger action B. (e.g. launch a different app) Double-tap hotkeys work according to the same mechanism. I have uploaded a demo and spelled out some more details over here: https://github.com/zeitlings/alfred-workflows#21-extended-hotkeys Disclaimer: Alfred may crash if you get the timing of the keystrokes just right. This is due to a data race where the same variable (“gate”) is accessed and modified by different threads at the same time. I don’t know how the Scripting Bridge is implemented behind the scenes, but perhaps setting environment variables could be wrapped in a mutex to ensure exclusive access to those variables in a future update?
  19. The project is a little bit too involved for that, I'm afraid 😅
  20. Thanks! The binary is signed only with a development certificate that I can use as a free-tier developer. For Apple to do their automated checks for notarization, they have you pay the annual €100 that make you eligible to try to put something on the App Store, afaik. And without notarization, the executable should stay in quarantine, whether it is signed or not - or not? Since I currently don't have a use for a payed Developer ID, I don't think that it is an option ¯\_(ツ)_/¯ The white space width and overall padding is calculated on a per-font basis to render an as-flawless-as-possible calendar block. To get the font information by somehow probing the user's GUI is something I haven't had the patience to try to implement in Swift alone, yet. Perhaps that is a use case for osascript and something I could look into once I get motivated to pick up the project again. Anyway, to observe how the miscalculations mess up the rendered calendar, you can just change the font and not purge the cache. Not all whitespace is created equal 🫠
  21. Alfred Calendar++ A feature-rich block calendar workflow with Apple Calendar integration to view, create, and search calendar events, or to check your upcoming agenda. How to Use Activate the workflow with the keyword (default: cc) or by using the hotkey. Quick access keywords for the agenda, creating new events, and the global search are derived from the keyword by appending a, n, or s: cca, ccn, ccs. The full documentation is available on Github and in the workflow configuration. Block Calendar Week View Agenda New Event Search Mask
  22. I'm not sure if this behavior is intentional, and if it is, I can't quite understand the reasoning behind it. Perhaps somebody can point out some use cases where this is required. When setting the property action for an item returned by a script filter, this property sets “the Universal Action items used when actioning the result, and overrides the arg being used for actioning.” (See here under action : OBJECT | ARRAY | STRING (optional)). This is great and works fine. However, when pushing the item to the file buffer via ⌥+↑, the arg is still used and not the action. This is unexpected, because whatever I push to the buffer I intend to use in some Universal Action. This is why I think that the action property of Script Filter items should also override the arg that is used for the file buffer. It's not a super big deal, but it is an inconsistency imho. I want to mention it before I go on to write a workaround and forget about it. For some context, here's the problem I ran into: There is this item: { "title" : "Document Title", "arg" : "x-devonthink-item:\/\/819603F0-07C6-4B20-B869-628981866614", "action" : "\/path\/to\/file.pdf", "type" : "file:skipcheck", "variables" : { "trigger" : "launch" }, "valid" : true, ... } The arg is registered as a URL and when actioning the item, a PDF Document will be opened in DEVONthink using the arg and Alfred’s Open URL file action after checking for the var “trigger” being equal to “launch”. For the file buffer to pick up on the file system path though, it would need to be set as arg. Given that action overrides the arg for Universal Actions, I would expect it to also override the arg for the file buffer since the buffered items all end up being actioned by piping them to the Universal Actions. Thanks for considering it! And one additional feature request: With files in the buffer and the Alfred launch window being empty, have ⌥+↓ pull the last file from the buffer down into the launch window, or even better, cycle through them 🤗
  23. I'm not registered with the AppStore, unfortunately, so no notarization for me. It did not even occur to me not to compile it, though. It's definitely doable, the program is simple enough. Give me a second.
×
×
  • Create New...