Mindnode import formats5/29/2023 ![]() Open "mindnode:///import?format=md&content=$encodedContents&name=$name"Īn example call from my testing looked like this: ~/scripts/md2mindnode.sh "/Users/stephen/Desktop/a.md" "temporary" #!/bin/zshĪlias urlencode='python -c "import sys, urllib as ul print ul.quote_plus(sys.argv)"' This script takes a file path and a name for the mind map as its arguments. If you’re happy with the point of just creating and not saving, and you really do want to pass a file and a name in, you could do something simpler with a shell script and probably even re-do the above, but I was so far in to trying to get the save working as well I figured I’d share anyway. ![]() Set theTextEnc to theTextEnc & useChar as string Set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string Set firstDig to round (eachCharNum / 16) rounding down Set eachCharNum to ASCII number of eachCharĮlse if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum 46) and (eachCharNum 57) and (eachCharNum 90) and (eachCharNum 122) then Repeat with eachChar in characters of theText Set mdFile to alias ((folderPath as text) & name)ĭo shell script "open 'mindnode:///import?format=md&content=" & urlEncode(mdContent) & "&name='" & urlEncode(name) Set fileNames to name of every file of folderPath whose name extension is fileExtension use AppleScript version "2.4" - Yosemite (10.10) or later This example AppleScript allows you to select a folder, picks out all of the files with a file extension of md (that’s what I use as my default markdown extension as it’s nice and short), grabs the content of each file in turn, URL encodes it, and then opens it using the URL scheme’s import option via the command line. Therefore for a scripted solution, we could either look at first converting Markdown to OPML, or resigning ourselves to automating just the open via URL scheme (this leaves a confirmation dialog open, so without then calling in something like Keyboard Maestro to deal with that I just ended up banging my head on how to get past that to control MindNode to do the saving. Looking through the MindNode AppleScript dictionary there’s no import option, only open, and while that works on importing OPML files (see the AppleScript example for this in the manual, or on GitHub), it doesn’t work on Markdown files from my brief testing. I’m not sure what action was being used on iOS that wasn’t being used on Drafts, but I had a look in the MindNode manual for the Mac and created this single step Drafts action that just uses the Mac URL scheme. Different development teams and code bases that aren’t as shared as people would like (usually thanks to a history of separate development) are factors that can lead to this. In terms of URL schemes working one platform and not another, that isn’t that uncommon.
0 Comments
Leave a Reply. |