From 327d69fcd6dc066b4047aaf4c473478e6d5f1b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stian=20H=C3=A5klev?= Date: Fri, 2 Mar 2012 10:35:33 -0500 Subject: [PATCH] moving skim url from skim-tools to dokuwiki, to be able to access more chrome functions --- dokuwiki.rb | 17 +++++++++++++ skim-tools.rb | 23 +++--------------- .../Contents/Resources/Scripts/main.scpt | Bin 1236 -> 1232 bytes 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dokuwiki.rb b/dokuwiki.rb index effee9a..9b35a1b 100644 --- a/dokuwiki.rb +++ b/dokuwiki.rb @@ -21,6 +21,23 @@ def clean_bibtex pbcopy(cleanup_bibtex_string(pbpaste)) end +# opens a given reference as passed by skimx:// URL in Skim +# launched by skimx:// url in Chrome (skimx.app must be registered first) +def url(argv) + arg = argv[8..-1] + arg.gsub!("#","%23") + pdf, page = arg.split("%23") + fname = "#{PDF_path}/#{pdf}.pdf" + if File.exists?(fname) + skim = Appscript.app('skim') + dd = skim.open(fname) + dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil + skim.activate + else + growl("File not found", "Cannot find PDF #{fname}") + end +end + #### keyboard commands #### # if Ctrl+Cmd+Alt+G is invoked, and current tab is not Google Scholar, assume that it is a foreign wiki, and try to diff --git a/skim-tools.rb b/skim-tools.rb index aa83ce4..7f7b9b8 100644 --- a/skim-tools.rb +++ b/skim-tools.rb @@ -6,23 +6,6 @@ require 'utility-functions' require 'appscript' -#### utility functions #### -# opens a given reference as passed by skimx:// URL in Skim -# launched by skimx:// url in Chrome (skimx.app must be registered first) -def url(argv) - arg = argv[8..-1] - arg.gsub!("#","%23") - pdf, page = arg.split("%23") - fname = "#{PDF_path}/#{pdf}.pdf" - if File.exists?(fname) - dd = Skim.open(fname) - dd.go({:to => dd.pages.get[page.to_i-1]}) unless page == nil - Skim.activate - else - growl("File not found", "Cannot find PDF #{fname}") - end -end - # stores a link to the last screenshot taken, and the current PDF page. when export to the wiki happens, the picture is # moved to the wiki media folder, and linked to the notes def screenshot @@ -37,7 +20,7 @@ def screenshot # pops up a dialogue which asks how many pages, and runs a CLI command (pdfmanipulate) which extracts a piece of the current # PDF starting with the current page and the number of pages indicated forwards. Useful for extracting articles out of -# proceedings, etc. +# proceedings, etc. def splitpdf require 'pashua' include Pashua @@ -46,7 +29,7 @@ def splitpdf page = Document.get[0].current_page.get.index.get # configuring Pashua dialogue - config = " + config = " *.title = researchr fb.type = textfield fb.default = 1 @@ -58,7 +41,7 @@ def splitpdf db.tooltip = Closes this window without taking action\n" pagetmp = pashua_run config - exit if pagetmp['cancel'] == 1 + exit if pagetmp['cancel'] == 1 startpage = page.to_i tmppage = pagetmp['fb'].to_i diff --git a/skimx.app/Contents/Resources/Scripts/main.scpt b/skimx.app/Contents/Resources/Scripts/main.scpt index 578e94596b758ab4332a12b5964571a1ae7f74b3..2855d5cfda3b9ef77c207ef0b95277083ce5cc90 100644 GIT binary patch delta 36 pcmcb@d4Y4oKPGWC20b9uXGmelXUJwKWhiIJ1k#zCC7E|K0syvB2_XOg delta 40 scmcb>d4+SsKPG7{20b9uXDDXKX2@j7Wzc0PVaNx<9ERe}qRhJ)0oY~<&;S4c