Jump to content
smarg19

Skimmer: PDF actions for Skim

Recommended Posts

Thanks for the new Skimmer, its my biggest time saver.

 

If any students out there desire to use this for pdf generated powerpoints I've taken snippets from smarg19's previous versions (nothing original from me), so that exports have indentation, bullets, and colors (colors are either from users favorite colors, or a hex value). Can be found here.

@DrLulz, this is a great example of taking advantage of the Skimmer's extensibility. I'm sure it will be a great help to people. For future clarification, could you explain what Skim's "favorite colors" are and how to set them. This script is great, but works off Skim's favorite colors, not the user's colors as specified in the Help PDF. While I think this is a fine alternative, people will likely need to know this important functional difference.

stephen

Share this post


Link to post

For future clarification, could you explain what Skim's "favorite colors" are and how to set them. 

 

Sure thing.

 

The default favorite colors in Skim, after a fresh install, are equal to the colors shown above (in smarg19's 2.0 update post), so if you like those colors then there is nothing that needs to be done to use this script

 

 

However, some might find Skim's default highlight colors too strong, where the color distracts from the text. If the user chooses to change these colors (shown below), then the script I posted will use these colors instead (no Applescript changes needed unless you want to change a bullet style, or the orange and red text for favorite colors 5 and 6; see below).

 

The leftmost color is the main bullet,

The 2nd color is the first indented bullet,

The 3rd color is the second indentation,

The 4th color is text under said bullets

The 5th color I use for Pharmacology, so I have a pill as a bullet, and have colored the text orange

The 6th color I use for lecture tips, so there is a red exclamation point for a bullet, and red text after export. (see my earlier post)

 

 

These are the favorite colors:

 

rKZ1dNz.png

 

 

 

If you don't see this color bar then:

 

LtsMjp5.png

 

 

If you want to change these Favorite Colors then:

 

MFA2Ah9.png

 

 

If you want to change the exported text color seen in Evernote (Has nothing to do with Skim's favorite colors) then change this line in the script:

 

(Note: This is what I use for Pharmacology)

 

--Highlight Note HTML FAV5

property highlight5_prefix : "<p>"

property highlight5_title_wrap_front : "<strong>"

property highlight5_title_wrap_back : "</strong>"

property highlight5_body_wrap_front : "<font color=\""

property highlight5_body_text_color : "#CC7A29" ---------------- CHANGE THIS

property highlight5_end_quote : "\">"

property highlight5_body_wrap_back : "</font> "

property highlight5_page_wrap_front : ""

property highlight5_page_abbr : ""

property highlight5_page_wrap_back : ""

 

 

If you want to change the bullets then change these in the script:

 
v8QgqLW.png
 
 
hope that clarifies. I've said it before, and probably will again, but thank you x1000 smarg19 for this amazing utility. 
 
 
 
EDIT: I just remembered that if a person is reading this then they're more than likely using Alfred (duh!), so if a person wishes to speed up the switching between favorite colors then set up a workflow with 6 hotkeys (I use ⌥+1, ⌥+2, ⌥+3, ⌥+Q, ⌥+W, ⌥+E;  = Option) linked to 6 run scripts (osascript). The Applescript is below.
 
q7rX8gH.png
 
 
Applescript:
 

tell application "Skim"

activate

 

set rgba to favorite colors

set theColor to item 1 of rgba ------ CHANGE THE 1 TO 2 FOR THE SECOND FAVORITE COLOR, ETC, ETC

 

if (count of documents) is 0 then

return

end if

 

set theTool to the tool of the front document

 

if theTool is highlight note tool then

set default note colors to {highlight note color:theColor}

else

beep

end if

end tell

 
Edited by DrLulz

Share this post


Link to post

That was a wonderful explanation. Thank you. I'm sure your fork will be used by many.

And you're welcome for the utility. I wrote it to scratch my own itch, but I'm happy that others find it useful as well. As you know, once you jump down the scripting rabbit-hole, it's actually kind of fun :)

Share this post


Link to post

thank you x1000 smarg19 for this amazing utility.

I was reading thru your script and saw a few places where it could be cleaned up. Nothing really changed, just an example of your script cleaned up. I only do this because someone once did something similar with me and it greatly helped me to see a way forward for becoming better at scripting. I forked your Gist with my slightly updated version. Read through it and see the (very) few places I made changes; hopefully it will be as helpful to you as this was once to me.

https://gist.github.com/smargh/ea15a72df99debae411c

Share this post


Link to post

I was reading thru your script and saw a few places where it could be cleaned up.

https://gist.github.com/smargh/ea15a72df99debae411c

 

Excellent. So thats how you call a handler inside a handler (I think I got that right), and the way you did the spacers was something I tried to do but couldn't figure out. When I see it like that it makes sense, so thank you yet again  :) .

 

Having one issue though, for some reason when I try to export it doesn't make it to Evernote. With your other script, when the export is successful, the Results section in Applescript Editor displays "Exported notes to Evernote as HTML," but here it displays the text of the first highlight. 

Share this post


Link to post

Whoops. Left in a line I was using for testing. I updated the Gist. You can get the new version.

 

nice. much obliged.

Share this post


Link to post

@smarg19

 

I've been playing with tags during the export, and I've found myself in uncharted water regarding Alfred (uncharted for me of course). I've made it so that when I export from Skim my list of current Evernote tags is displayed. From here I can choose from this list, or create a new tag(s). Thus far I've been successful using "choose from list" and "display dialog" with Applescript, but I would like to now move these functions to Alfred, so that after I key in "export" I can see a list of my current tags in Alfred's results, or type in a new tag. I'm pretty sure I should be using the qWorkflow to display results in Alfred, but what I really want to know is the difficulty level of what I'm trying to attempt?

 

Applescript

Share this post


Link to post

Difficulty level = 6 out of 10.

The most basic issue is that Alfred has one main limitation: it can only do one thing at a time with its interface. This means that when you pop up Alfred and key in export and it runs the associated script, it will run that script to completion before doing anything else. So, you couldn't really export the note and then assign tags to it. This is because it would be overly difficult to assign those tags to the note because the old Run Script function is done running, so you would have to go and get that new note before assigning tags. That's why your current setup works well. It is assigning tags during the exporting script.

So, what option do you have? You could create a Script Filter that presents all of your Evernote notes (and you can filter search down using keywords). Run this first and save the Tag you choose. Then run the export script and get that tag and assign it. Note, however, that this also has a limitation because you could only choose one tag via Alfred's interface. You can't select multiple items.

All that to say, I would def stick with your current Applescript set up.

Share this post


Link to post

All that to say, I would def stick with your current Applescript set up.

 

Thanks for the insight. I'll keep the Applescript as time is currently my biggest enemy. Maybe when classes are over in a few weeks I'll get acquainted with Alfred, but it'll have to be in between beer and fishing. I plan on doing copious amounts of both.

Share this post


Link to post

I just want to say: thank you smarg19 for making this script, this is exactly what I was looking for. And also thanks for DrLulz for the fork, the bullets are perfect for annotating articles.

 

I'm having problems with opening hyperlinks in Evernote, I get the following message and I'm not sure what to do. It doesn't seem like anyone else is having this issue, and I apologize in advance if it's something very basic that I missed.

 

Thanks again for this!

 

XCTN4Ls.png

Share this post


Link to post

I'm having problems with opening hyperlinks in Evernote, I get the following message and I'm not sure what to do. It doesn't seem like anyone else is having this issue, and I apologize in advance if it's something very basic that I missed.

Can you open up the workflow folder and take a screenshot of the contents?

Share this post


Link to post

Thank you for the reply Stephen, here's my workflow folder:

 

vfCENYK.png

 

(Currently just using export on a PDF on the desktop, haven't tried it with Devonthink-filed PDFs yet.)

Share this post


Link to post

I meant the actual Finder folder. Try sk:bug then select "Root". That's the workflows root folder.

Share this post


Link to post

When that dialog box appears. Click "Choose Application". Then find and select that first item in the workflow folder titled _skimmer. That's the app that interprets the urls

Share this post


Link to post

What an strange issue, it started to give another error about how it couldn't launch _skimmer. But after I ran the  _skimmer application from the workflow folder manually (and of course, got an informational message about what the app does), all my hyperlinks now function as intended.

 

Good god, it even works perfectly with files managed with Devonthink (which makes sense I guess, since DT really just buries files in its own structure). This is friggin amazing

 

Going to try to set up DrLulz's fork as well, each are definitely useful in different scenarios. With this, it's time to move from Onenote to Evernote, and can't wait to incorporate an iPad into the workflow eventually too. 

 

Thanks again for your help and the script!

Share this post


Link to post

Not a problem. I'm glad it's working for you now. If you're interested in having this work on the iPad as well, you'll need to tweak some things. Read the post about my Mac + iOS PDF workflow on my blog: hackademic.postach.io

Share this post


Link to post

This was very valuable use case tho. It appears that the app doesn't register the URL scheme with the OS until you run it. I'll need to add this to the README. Thanks for the helpful info.

Share this post


Link to post

It's definitely a strange problem, I'm glad it's somewhat useful for improving the program!

 

The error with not being able to open _skimmer happened again today, and was again fixed by running the _skimmer program manually, so it doesn't seem to be a permanent problem/solution (for me).

Share this post


Link to post

Sorry for the late reply. I've been trying to reproduce the error message, but it just hangs now without the error message. The Skimmer app shows up in the status bar, for example:

 

83Nbu3Y.png

 

(not pictured: spinning beachball). Also it's really not a big deal, I never restart the computer anyways.

Edited by nonchalance

Share this post


Link to post

I'm not sure what's up. I've tested a few things, and it's working well for me. Without that error message, I'm not sure I can guess at what the problem is.

Share this post


Link to post

I just love this idea.  I have been looking for this for years.  I installed it and ran the _skimmer.app standalone.  I am now able to open PDFs from evernote in Skim,  annotate and receive the annotations in Evernote.  The problem I have is when I try to go to the pages from the links in the synopsis I get the error from Skim  File could not be opened.  The file doesn’t  exist.  

Can you help?

Also,  I assume if look through the workflows I will find a way to disable the index page prompt.  Is that correct?

Thanks

ED

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×