Jump to content

frogwell

Level 2
  • Posts

    29
  • Joined

  • Last visited

3 Followers

About frogwell

Recent Profile Visitors

1,877 profile views

frogwell's Achievements

17

Reputation

  1. Why change how the in-page bookmark hyperlink behave? <a href="#some-anchor">Text</a> It used to work as expected (clicking on the link jumps/scrolls to the labeled part of the note) and I have used it to implement in-note Table of Content and such. At that time clipping webpages with similarly structured TOC also worked well. But this is gone for some reason in 6.9 (still worked at 6.8) and I wonder why? Considering how universal this kind of bookmark/anchor is in the general world of HTML/XML, it's surprising to see it taken out suddenly. Edited: Instead of opening the marked "#some-anchor", a link like this is opened instead: file:///Applications/Evernote.app/Contents/Resources/common-editor-mac/mac.xhtml#toc:some-code Why this?
  2. Fantastic! It works very well in Mavericks (10.9.5) with EN Mac 6.0.7. Thank you so much for all your patience and quick responses to my posts. May I make one suggestion? Instead of pasting the link, how about just leaving it on the clipboard and displaying a popup dialog to that effect? Then the user to go to the desired location and paste it, rather than having to cut and paste. Thanks again. This is a huge addon feature for EN Mac. May I request another addon? Often this need for an internal link/bookmark comes up because it was originally setup as part of a real web page. Would it be possible to select a group of lines (like you would have in an internal TOC for a web page), and then convert them to the proper links needed to goto the anchors/bookmarks that, hopefully, already exist in the EN Note? Here is an example web page that contains a TOC at the top, with links to lots of anchors/bookmarks below: https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html#//apple_ref/doc/uid/TP40000983-CH218-SW2 Maybe you could do a EN web clip of this page, and then convert the TOC links? So here's a piece of JavaScript code that does a bit of "TOC clean up" (gist), I tried it with a clipped note from the webpage you provided and it seems to work fine. Short story is that the script invokes a subprocess in AppleScript to obtain the HTML content of target note, goes through the html and replace all links of the form "https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html#//apple_ref/doc/uid/TP40000983-CH218-SW1"to "#//apple_ref/doc/uid/TP40000983-CH218-SW1" if it finds another element that matches this link in the note, and then invoke another AppleScript subprocess to update the target note's HTML content. It should work with the two most commonly seen TOC implementation on web (one is a pair of <a> tags, the other is an <a> tag with href pointing to another element via the 'id' property). It's a command line tool (not an automator workflow). You don't need Yosemite for this, but you do need Node.JS, npm and a few node modules. Those are very popular javascript developer libraries so you should be able to find instructions on how to install them easily (this for example), if you really want to try it out. I would probably do: $ brew install node $ npm install -g temp $ npm install -g cheerio then download the en-toc-cleanup.js script and run $ node en-toc-cleanup.js <note link> with the <note link> replaced by the actual note link to your target note.
  3. Thanks. I'll give it a try. OK, I have tested on one Note in EN Mac 6.0.10 and 6.0.6, and both worked fine. FYI, I setup my Notes so that the Note I tested was NOT the first Note in the Note list to make sure that your code was using the correct Note for the "sanitizing". It worked! I'm still a bit concerned about the Note selection AppleScript code, but it worked OK in my limited testing. BTW, I renamed the Automator Service to "EN Create Bookmark" to help identify it as an Evernote service and to use the HTML "bookmark" term. Thanks again for sharing this Automator Workflow/service, and for all your help in making it work for my environment. Now that the basic code/process is working, are you open to enhancement requests? I would do them myself, but I know nothing about Ruby and the other code/scripts you used. But I would be glad to be your Beta tester. You are absolutely right about "selection". I sort of hastily scrawled the code earlier today without reading the documentation carefully. Still the code should work just fine, though. Because I put the "set currentNote to item 1 of notes of window 1" statement INSIDE an IF statement, so it will only be excuted if the frontmost Evernote window is a separate note window (which contains precisely one note). But since apparently "selection" refers to the frontmost window already, the IF statment is not necessary. I've updated the gist to reflect the change, but the workflow's behavior isn't really affected. I'll take a look at the dependencies of my scripts tomorrow before posting them. It doesn't really do the "select a bunch of lines" thing as you described, instead it runs through all links in the note and try to identify those linking to in-page bookmarks/anchors and format them so their href's start with "#", and making sure the destination has a proper <a name="label">destination text</a> tag.
  4. That's a very good idea, I missed that part about "selection" from the official document, thanks! I just updated the workflow with the snippet.
  5. Fantastic! It works very well in Mavericks (10.9.5) with EN Mac 6.0.7. Thank you so much for all your patience and quick responses to my posts. May I make one suggestion? Instead of pasting the link, how about just leaving it on the clipboard and displaying a popup dialog to that effect? Then the user to go to the desired location and paste it, rather than having to cut and paste. Thanks again. This is a huge addon feature for EN Mac. May I request another addon? Often this need for an internal link/bookmark comes up because it was originally setup as part of a real web page. Would it be possible to select a group of lines (like you would have in an internal TOC for a web page), and then convert them to the proper links needed to goto the anchors/bookmarks that, hopefully, already exist in the EN Note? Here is an example web page that contains a TOC at the top, with links to lots of anchors/bookmarks below: https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html#//apple_ref/doc/uid/TP40000983-CH218-SW2 Maybe you could do a EN web clip of this page, and then convert the TOC links? The problem with leaving link in the pasteboard is... the workflow would not be able to run the "sanitizing" process as it has to happen AFTER the link is pasted into Evernote, because Evernote adds the "evernote-html-snippet://" when the link is pasted. The trouble with the "restoring TOC" idea is it would require operating on the HTML and doing quite a few modification of the raw HTML content, and I'm a bit hesitant about the idea for general users, and more imporantly, I don't think this process could be implemented as a workflow or system service easily because we would need to traverse the html and do quite a few string replacements. With JavaScripts (NodeJS + cheeriojs + AppleScript) or Ruby (rails + Nokogiri + AppleScript) or Python it's simple enough (a few short scripts), but it's kind of another long story to talk about installing dev environments, various module dependencies, etc.
  6. I don't think it's the EN 6.0.10, it's probably due to the funkyness of the workflow itself (the implementation is far from ideal). A few things to check: 1. Is the note you are editing opened in a separate window? 2. If not, is the note shown as the first item in the note list in the main window? The awkwardness comes from the fact that I don't see a easy and definite way to get "the current note in the main window" via applescript. The workflow sort of assumes that use is editing the note in a separate window, or the note list in the main window is sorted by "updated time". I've updated the workflow (gist) to include a dialog asking user to confirm that the script has the right idea about which note is being editing currently.
  7. This workflow just doesn't seem to want to work for me. Your alternate version (no ruby) doesn't work either. It fails with a Javascript error. Apparently the Automator "Run Javascript" is a new Action added in Yosemite. I'm running Mavericks. Here's the Automator error msg: Sorry to be so much trouble. Any suggestions on what to do next? My bad again, totally didn't think of compatibility issues. I re-wrote the workflow in AppleScript which should be supported in Mavericks (I think? I don't have access to a Mavericks machine at this moment so I cannot verify) and updated the gist. Would you be interested in trying it out?
  8. Thanks for the fix. Before I try it, I had an idea I want to ask you about. I read in your ReadMe that "Since the Evernote client will automatically add evernote-html-snippet:// to links with href starting with #, use applescript to scan the whole note and get rid of all these redundant strings". What do you think about using "file:///" prefix? So, the link would be: <a href="file:///#label-text">Link text</a> Would that prevent the EN client from adding the "...snippet://" prefix? Well, yes, it would indeed prevent EN client from adding "evernote-html-snippet://", but it still wouldn't work. Because then Evernote removes the link all together (assuming we are using the general clipboard/pasteboard). Or, even if we successfully insert the link with "file:///#label-tet" (using the `pasteboard` ruby gem to specifically formulate data in pasteboard), clicking on the link will take you to Finder and will try to locate a file on your system. This is because links starting with "file:///" is supposed to point to a local file (wiki), and in OSX the default handler application for "file:///" is the Finder. Theoretically it's possible to change the handler, but I don't think that is easy or makes sense.
  9. What do I do now? Thanks for your help. Well apparently I did not take into consideration that most people would not have xcode and other dev dependencies installed, my apologies... So I made an alternate version that does not require any ruby gem... Would you mind giving it a try? It's not quite as smooth as the original one (you won't be able to easily undo the operation, etc.) but the basic functionalities are the same.
  10. @frogwell: I need help installing your workflow and supporting libraries. Specifically, how do I install pasteboard? I have never used Ruby or gem. I downloaded the pasteboard-master.zip from https://github.com/drbrain/pasteboard. I unzipped it. But when I run "gem install password", I get this error: Perhaps I need to move the pasteboard-master folder somewhere special? If so, where? Do I need to run the "gem" command from a specific folder? If you can, please provide specific, step-by-step instructions. I suspect others (non-programmers) will need this as well. Thanks. Ah sorry that the doc isn't very clear... In this case, you can run > sudo gem install pasteboard and then enter your password and hit enter. "sudo" means "super do", which requires you have the superuser/administrator privileges to run commands. It's similar to the pop up dialog you get when installing some softwares that would ask you for confirmation and password. P.S. I assume by "gem install password" you mean "gem install pasteboard"?
  11. @CoreParadox: I just use a link that starts with "#" (without the "file:///"), as in the usual HTML in-page linking technique: create a pair of <a> elements (the link and the anchor) and assign a label, and it would go like this: <a href="#a-label">This would be the link!</a> and <a name="a-label">This would be the destination!</a>
  12. @CoreParadox: May I ask why the link would start with "file:///"? I actually haven't got time to run your program yet, but I seem to remember that in the Evernote OSX client, a link of this form would take you to the "Finder".
  13. I already had something very similar, so I put together this OSX workflow/service (link to GIST repo with code and docs) and it works basically like how you described it (except that in step 3, instead of "pressing a key", you would right click and select "Services -> Create Cross Reference" -- and of course you can always assign a keyboard shortcut to the service... so yeah). Hope this helps! Here's a demo...
  14. Hi Gock, This editor is fantastic! I especially like the ability to customize css style for fenced code block. However, I would echo @MKR 's observation that the exported HTML file is missing altogether. And I've run into sync issue (server error) once in a while. The Evernote server seems to be fine when that happens, though. Cheers and congrats
×
×
  • Create New...