Jump to content

John Christopher Jones

Level 2
  • Posts

    40
  • Joined

  • Last visited

About John Christopher Jones

Recent Profile Visitors

2,241 profile views

John Christopher Jones's Achievements

29

Reputation

  1. This doesn't work on the macOS client as of version 6.10. For example: I want to create a note to help me call my house, senate, and state senate and state delegates. Evernote could just let me CMD+K and type "tel:555-555-5510". Instead, well, I have to re-key the phone numbers into my phone every time I want to make a call. Footnote: I would at least like to explicitly opt into using unsupported url schema. This "safety" prohibition prevents a huge number of edge enhancements to the Evernote network. It'd be extremely useful to me to be able to add a link for FileMaker so I can use a url like "fmp://$/ProLog?script=NewCall&$tel=555-555-5510", which would let me invoke the FileMaker script "NewCall" in the already-opened datebase "ProLog", where FileMaker itself lets me invoke custom URL schema to start a phone call and create a database record to record the call log at the same time.
  2. It looks like in Yosemite and/or with the Evernote ScanSnap, it's possible to wind up with ENML that the original version of my script won't work on. I've updated the script to handle this situation. Specifically, the problem is that PDFs are saved to Evernote as "Unnamed File Attachment". It turns out that sometimes the filename is actually a string of invalid UTF-8 characters (0xCA 0xCA 0xCA 0xCA). For example: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note><div><en-media type="application/pdf" style="cursor:pointer;" width="100%" height="1082" hash="0760b2f2fcb5c4ce81ccae342f754b8f"/>ÊÊÊÊÊ</div></en-note> Updated script reproduced below in case my link breaks for some reason: -- Join PDFs in multiple Evernote notes into a single PDF in a new note-- Author: John Christopher Jones <john.christopher@alumni.virginia.edu>-- Created: 2014-11-17-- Updated: 2014-12-11 -- write utf8 and strip non-ascii characters when extracting hash values-- inspired by-- http://applehelpwriter.com/2013/03/23/how-to-merge-pdf-files-in-os-x/-- We'll join note titles together using this string-- This isn't going to be a great title, but it'll be-- a good reminder of what's in the new note.set title_separator to " | "-- Create a temporary folder for the exported Evernote attachments-- Create an output filepath to write the joined pdf toset temp_folder to do shell script "mktemp -d -t evernote_pdf"set output_filepath to temp_folder & "/" & (do shell script "uuidgen") & ".pdf"-- XSLT used to extract hash values from en-media tags-- Crazy {} translation nonsense used to work around forum post scrubbersset xslt to "{?xml version='1.0'?}{xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:en='http://xml.evernote.com/pub/enml2.dtd'} {xsl:output method='text' omit-xml-declaration='yes' indent='no'/} {xsl:strip-space elements='*'/} {xsl:template match='en-media'} {xsl:value-of select='@hash'/} {xsl:text} {/xsl:text} {/xsl:template} {xsl:template match='text()|@*'}{/xsl:template}{/xsl:stylesheet}"set my text item delimiters to "{"set xslt to text items of xsltset my text item delimiters to "<"set xslt to xslt as textset my text item delimiters to "}"set xslt to text items of xsltset my text item delimiters to ">"set xslt to xslt as text-- Write XSLT to temporary locationset xslt_path to do shell script "mktemp -t evernote_enml"tell application "Finder" to write xslt to xslt_path-- Initialize some listsset hash_values to {}set pdf_list to {}set title_list to {}tell application "Evernote" -- Loop over every attachment in every note -- Note order follows the visible sort order in the OS X Desktop Client v5.7.2 set noteList to selection repeat with n in noteList set the end of title_list to title of n -- Write the ENML to a temporary file and extract the en-media hash values set enml_text to (ENML content of n) as text set enml_path to do shell script "mktemp -t evernote_enml" tell application "Finder" to write enml_text to enml_path -- Extract the hash values from the ENML temporary file using the XSLT set hash_values to paragraphs of (do shell script "cat " & (quoted form of enml_path) & " | strings | xsltproc --novalid " & (quoted form of xslt_path) & " - ") -- Delete the temporary ENML file do shell script "rm " & (quoted form of enml_path) -- Export each attachment in the order that it appears in the note repeat with hash_value in hash_values -- Get the attachment that has this hash set a to item 1 of (attachments of n whose hash is hash_value) -- Write the attachment to the temporary folder set pdf_path to temp_folder & "/" & (do shell script "uuidgen") & ".pdf" write a to pdf_path as «class utf8» -- Save the filepath for later set the end of pdf_list to pdf_path end repeat end repeat -- We'll join PDF filepaths so that they're single-quoted and space-delimited set my text item delimiters to "' '" -- Join PDFs do shell script (quoted form of "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py") & " --output " & (quoted form of output_filepath) & " " & ("'" & (pdf_list as text) & "'") -- Create a new note with a title built from the titles of the selected notes set my text item delimiters to title_separator set new_note to create note from file output_filepath title (title_list as text) -- Open the newly created note in a new window so the user doesn't have to wonder -- where the thing is and if it was actually created. open note window with new_note -- Delete all of the remaining temporary files do shell script "rm -r " & quoted form of temp_folder do shell script "rm " & quoted form of xslt_pathend tell
  3. Since I posted that link back in January, I've taken to using this feature a lot. The problem is just getting the link out of Mail in a decent form. Once you've got the link you can throw it in Evernote, throw it in Things, TextEdit, or whatever, and it'll just magically work both in iOS and OS X. The message link should technically be a URN, but it's formatted as a URL. The format is message://<message-id>, with the angle brackets. However, to get consistent results the angle brackets need to be encoded (that's %3c and %3e). Anyhow, here's some AppleScript. I throw this into a Keyboard Maestro macro and use the hot key CMD+CTRL+C, which is a the same hotkey I use for my "copy file path" macro for Finder. tell application "Mail" set _sel to get selection set _links to {} repeat with _msg in _sel set _messageURL to "message://%3c" & _msg's message id & "%3e" set end of _links to _messageURL end repeat set AppleScript's text item delimiters to return set messageLinks to (_links as string) set the clipboard to messageLinks end tell
  4. I agree that Evernote has more important fish to fry, but they do place a lot of importance on PDF handling in Evernote. They do this to the extent that they added inline PDF annotation, and they did this despite having developer access to Yosemite and recognizing that Apple would add their own system-wide PDF annotation extension in Yosemite. Evernote wanted PDF annotation that would work across platforms. One of the killer Evernote Premium features is priority OCR, which, while useful for the occasional JPEG and photograph of a bookshelf, really gets most of its use in PDFs. So, something like this script might be a natural feature for them to add. So, I don't blame you for wanting to warn Evernote off of yet-more PDF features in lieu of at least the dozen things we've both pointed out or read about recently. That said, it really is kinda difficult to merge PDFs that are embedded in Evernote notes without something like this.
  5. I don't think there is a way to to get the dates directly. Unless someone else knows of a way you would probably need to make an applescript to do that. I only toyed with applescript with EN so I couldn't really make one for you. I actually wrote a script to import your Finder selection as individual Evernote notes and posted here a while back. It copies the file creation and modification timestamp from the original file and saves the original file path in the Source URL field.
  6. I totally agree about wanting a merge feature. Like JMichael, I don't like Evernote's way of merging notes very much. This is especially useful when using a ScanSnap with the occasional thick stack that has to be hand-fed because of low grade paper. You can easily wind up with several notes in Evernote that ought to contain a single multi-page PDF. So, I think I solved the problem on my blog. I wrote an AppleScript to join multiple PDFs across multiple notes into a single new note with a single PDF. This script will join PDFs in the order they appear in Evernote—by notes, and by attachments within notes. So, if you need to reverse the sort order of the notes or PDFs, you'll need to reverse the order in the Evernote. In case the link ever goes down, here's the script in full. -- Join PDFs in multiple Evernote notes into a single PDF in a new note-- Author: John Christopher Jones <john.christopher@alumni.virginia.edu>-- Created: 2014-11-17-- inspired by-- http://applehelpwriter.com/2013/03/23/how-to-merge-pdf-files-in-os-x/-- We'll join note titles together using this string-- This isn't going to be a great title, but it'll be-- a good reminder of what's in the new note.set title_separator to " | "-- Create a temporary folder for the exported Evernote attachments-- Create an output filepath to write the joined pdf toset temp_folder to do shell script "mktemp -d -t evernote_pdf"set output_filepath to temp_folder & "/" & (do shell script "uuidgen") & ".pdf"-- XSLT used to extract hash values from en-media tags-- Crazy {} translation nonsense used to work around forum post scrubbersset xslt to "{?xml version='1.0'?}{xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:en='http://xml.evernote.com/pub/enml2.dtd'} {xsl:output method='text' omit-xml-declaration='yes' indent='no'/} {xsl:strip-space elements='*'/} {xsl:template match='en-media'} {xsl:value-of select='@hash'/} {xsl:text} {/xsl:text} {/xsl:template} {xsl:template match='text()|@*'}{/xsl:template}{/xsl:stylesheet}"set my text item delimiters to "{"set xslt to text items of xsltset my text item delimiters to "<"set xslt to xslt as textset my text item delimiters to "}"set xslt to text items of xsltset my text item delimiters to ">"set xslt to xslt as text-- Write XSLT to temporary locationset xslt_path to do shell script "mktemp -t evernote_enml"tell application "Finder" to write xslt to xslt_path-- Initialize some listsset hash_values to {}set pdf_list to {}set title_list to {}tell application "Evernote" -- Loop over every attachment in every note -- Note order follows the visible sort order in Evernote OS X Desktop Client v5.7.2 set noteList to selection repeat with n in noteList set the end of title_list to title of n -- Write the ENML to a temporary file and extract the en-media hash values set enml_text to (ENML content of n) as text set enml_path to do shell script "mktemp -t evernote_enml" tell application "Finder" to write enml_text to enml_path -- Extract the hash values from the ENML temporary file using the XSLT set hash_values to paragraphs of (do shell script "xsltproc --novalid " & (quoted form of xslt_path) & " " & (quoted form of enml_path)) -- Delete the temporary ENML file do shell script "rm " & (quoted form of enml_path) -- Export each attachment in the order that it appears in the note repeat with hash_value in hash_values -- Get the attachment that has this hash set a to item 1 of (attachments of n whose hash is hash_value) -- Write the attachment to the temporary folder set pdf_path to temp_folder & "/" & (do shell script "uuidgen") & ".pdf" write a to pdf_path -- Save the filepath for later set the end of pdf_list to pdf_path end repeat end repeat -- We'll join PDF filepaths so that they're single-quoted and space-delimited set my text item delimiters to "' '" -- Join PDFs do shell script (quoted form of "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py") & " --output " & (quoted form of output_filepath) & " " & ("'" & (pdf_list as text) & "'") -- Create a new note with a title constructed from the titles of the selected notes set my text item delimiters to title_separator set new_note to create note from file output_filepath title (title_list as text) -- Open the newly created note in a new window so the user doesn't have to wonder -- where the thing is and if it was actually created. open note window with new_note -- Delete all of the remaining temporary files do shell script "rm -r " & quoted form of temp_folder do shell script "rm " & quoted form of xslt_pathend tell
  7. I found a page with some more information and a script for clipping Mail message URLs into Evernote. If anyone wants something more tailored to their needs I'll see what I can cook up.
  8. It seems like a pretty serious omission from the keyboard shortcuts. If you get a better answer I'll be very interested. The best method I've found so far is: CMD+Option+F to Search Notes Return to move focus to Notes listIf you don't modify the search results then the search will be populated with the search for your current set of notes, and the focus will be left on the same note. To go the other way, I have to do something similar to get into the note, because I can't stand hitting FN to hit the function keys. You can do this: CMD+F to Search This Note Escape to move focus to note body (really)Or, you can do this CMD+L to edit note title Tab to move to note body
  9. I really love the idea. I store code snippets in Evernote already, but they lose all formatting and syntax highlighting, and *sometimes* indentation. We know ENML can handle it since syntax highlighted code you clip from the web comes through with the same formatting. What might work as a patch is a web app based on the existing javascript syntax highlighting libraries out there. You could repurpose an existing app to clip to Evernote, or if somebody puts some real elbow grease into it, Evernote Cloud API could be used.
×
×
  • Create New...