Skip to content

Instantly share code, notes, and snippets.

View fractaledmind's full-sized avatar

Stephen Margheim fractaledmind

View GitHub Profile
@fractaledmind
fractaledmind / Python and Pasteboard.py
Last active July 9, 2019 00:07
Interact with the Pasteboard via Python
import subprocess
def getClipboardData():
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
retcode = p.wait()
data = p.stdout.read()
return data
def setClipboardData(data):
p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)
p.stdin.write(data)
@fractaledmind
fractaledmind / xml to Evernote for Peek
Created October 11, 2013 17:23
This Applescript will take .xml data files from the Dickinson College Commentaries Greek and Latin Core Vocabulary lists and import each term into Evernote for use with Evernote Peek. Each term becomes a single note. The script will, if necessary, create new notebooks ("Greek Vocab" or "Latin Vocab", depending upon which list you are importing).…
--27.5 minutes to upload to Evernote the entire Latin Core Vocab list (997 terms)
--7.5 minutes to upload to Evernote the entire Greek Core Vocab list (515 terms)
property tid : AppleScript's text item delimiters
property alphaList : "abcdefghijklmnopqrstuvwxyz"'s items & reverse of "ABCDEFGHIJKLMNOPQRSTUVWXYZ"'s items
--get xml file from clipboard and clean up
set t to my RemoveListFromString(the clipboard, {"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", "<nodes>", "</nodes>"})
@fractaledmind
fractaledmind / EXPORT ALL SKIM NOTES TO EVERNOTE WITH DEVONTHINK HYPERLINKS
Created October 18, 2013 19:05
This script will (as the title suggests) export all of you Skim notes directly to Evernote with hyperlinks to redirect you to the item in your DEVONthink database. REQUIRED PROGRAMS: - Skim (pdf viewer and annotator) - Evernote (cloud based note app) - DEVONthink (database program)
@fractaledmind
fractaledmind / PDFPen URL Handler
Created October 20, 2013 03:43
This is the Applescript-based url handler for the Mac that handles PDFPen urls from iOS.
on run
display dialog "This script applet will respond to hyperlinks beginning with:" & return & return & "pdfpen:///pdf_title.pdf?pg=2" & return & return & "It will open your custom URLs in Skim" buttons {"OK"} default button 1 with title "Custom URL Helper" with icon 1
tell application "Finder" to update (path to me)
end run
on open location this_URL
-- Extract Title and Page Number
set x to offset of "?" in this_URL
set y to offset of "=" in this_URL
set z to offset of ":" in this_URL
@fractaledmind
fractaledmind / Export Skim Annotations with PDFPen urls
Last active August 31, 2018 05:57
REQUIRED PROGRAMS: - Skim (pdf viewer and annotator) - Evernote (cloud based note app) - works with PDFPen for iPad and iPhone This script will (as the title suggests) export all of you Skim notes directly to Evernote with hyperlinks.
(* EXPORT ALL SKIM NOTES TO EVERNOTE WITH IOS HYPERLINKS
-- Stephen Margheim
-- 10/16/13
-- open source
REQUIRED PROGRAMS:
- Skim (pdf viewer and annotator)
- Evernote (cloud based note app)
- works with PDFPen for iPad and iPhone
@fractaledmind
fractaledmind / Convert customurls to pdfpen urls
Created October 20, 2013 04:46
This script will convert previously created Evernote notes with Skim annotations that had the old "customurl" scheme into my new, iOS friendly "pdfpen" urls.
property tid : AppleScript's text item delimiters
property LF : (ASCII character 32) & (ASCII character 32) & (ASCII character 10)
tell application id "com.evernote.evernote"
set Evernote_Selection to selection
if Evernote_Selection is {} then display dialog "Please select a note."
set noteLink to ""
repeat with i from 1 to the count of Evernote_Selection
set noteName to title of item i of Evernote_Selection
@fractaledmind
fractaledmind / Check Modifier Keys
Created October 22, 2013 16:22
This script uses a simple utility called "checkModifierKeys", which can be found here: http://macscripter.net/viewtopic.php?pid=114479#p114479, to determine whether or not one of the modifier keys is being pressed. This proves very helpful for adding deeper functionality to your Applescripts
(* CHECK MODIFIER KEYS
REQUIREMENTS:
- the checkModifierKeys utility, which needs to be in your Utilities folder. To download, visit here: http://macscripter.net/viewtopic.php?pid=114479#p114479
*)
set buttonOptions to {"cmd", "option", "control", "shift", "capslock"}
set p2u to POSIX path of (path to utilities folder)
@fractaledmind
fractaledmind / Get Evernote URL
Created October 22, 2013 16:42
This Applescript will get the local url for the currently selected Evernote note.
tell application "Evernote"
set x to selection
repeat with i from 1 to count of x
set theurl to note link of item i of x
end repeat
end tell
@fractaledmind
fractaledmind / Skim Page Splitter
Last active May 31, 2019 17:08
This little program uses the Mac app Skim to split scanned PDFs that have two pages layed out on a single PDF page in landscape mode.
(* SPLIT TWO-PAGE PDFS
--Stephen Margheim
-- 11/2/13
-- open source
VERSION 3.0
--Version 3 adds a feature for OCR'd PDFs. If your PDF has been OCR'd, the script now automatically crops the individual pages so that the text field is centered.
This little program uses the Mac app Skim to split scanned PDFs that have two pages layed out on a single PDF page in landscape mode:
@fractaledmind
fractaledmind / CriticMarkup Review
Created November 3, 2013 04:39
DEPENDENCIES: - the Satimage Applescript addition This script allows you to accept or reject, keep or alter the 5 forms of CriticMarkup syntax: Additions, Deletions, Substitutions, Hightlights, and Comments. It depends upon the free and powerful Satimage Applescript addition pack, which you can download [here](https://www.macupdate.com/app/iphon…
(* CRITIC MARKUP REVIEW
--Stephen Margheim
--11/3/13
--open source
DEPENDENCIES:
- the Satimage Applescript addition
This script allows you to accept or reject, keep or alter the 5 forms of CriticMarkup syntax: Additions, Deletions, Substitutions, Hightlights, and Comments. It depends upon the free and powerful Satimage Applescript addition pack, which you can download [here](https://www.macupdate.com/app/iphone/16798/satimage-osax).