Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kb:exporting_from_endnote_with_pdfs [2009/08/14 15:06] – Code to perform the find/replace karneskykb:exporting_from_endnote_with_pdfs [2017/11/22 12:58] (current) bwiernik
Line 1: Line 1:
-=== How do I import my EndNote library, complete with attached PDFs? === +See [[importing_records_from_endnote|Importing Records from Endnote]].
- +
-Obviously, manually adding every PDF from a large EndNote library would be rather labor intensive. There is a trick to automating it, though. +
-  +
-Zotero's RIS import does have the ability to import PDFs and Endnote does export links to your PDFs in the RIS files it generates. The problem is that Endnote does not give the full path to the file. +
- +
-You should be able to import all the PDFs by using a single find and replace statement. In EndNote, you need to export your library using the RIS (Refman) style. It should be exported as a text document. +
- +
-In it, you will want to replace the 'internal-pdf://' links with 'file://' links. +
- +
-Os OS X and Linux, you may run:<code bash>sed -e 's/internal-pdf:\/\/.*\//file:\/\/[escaped-path-to-pdfs]\//g' [input.ris> [output.ris] +
-</code>On Windows, you may copy the following and paste it into notepad. Save as "ris-fix.vbs" or similar & run it:<code asp> +
-' RIS link fixer for windows +
-' transforms Endnote internal-pdf:// links into file:// links +
- +
-Dim FileName, objDialog, boolResult +
-Dim regEx, FileContents, modFileContents +
-Dim objShell, pdfFolder +
- +
-'choose RIS file +
-Set objDialog = CreateObject("UserAccounts.CommonDialog"+
-objDialog.Filter = "RIS (*.ris)|*.ris|All Files (*.*)|*.*" +
-objDialog.FilterIndex = 1 +
-boolResult = objDialog.ShowOpen +
-If boolResult = 0 Then +
-  WScript.Quit +
-Else +
-  FileName = objDialog.FileName +
-End If +
- +
-'regexreplacement +
-Set regEx = New RegExp +
-regEx.Pattern = "internal-pdf://.*/" +
-FileContents = GetFile(FileName) +
- +
-'choose folder containing PDFs +
-set objShell = CreateObject("Shell.Application"+
-set pdfFolder = objShell.BrowseForFolder(0, "Where are your PDFs?", 0) +
-If (not pdfFolder is nothing) then +
-  ReplaceWith  = "file://" + pdfFolder.self.Path +
-  modFileContents = regEx.replace(FileContents, ReplaceWith) +
-  If modFileContents <> FileContents Then +
-    WriteFile FileName, modFileContents +
-    Wscript.Echo "Finished chaning internal-pdf:// links to file:// links." +
-  Else +
-    Wscript.Echo "nope" +
-  End If +
-End If +
- +
-function GetFile(FileName) +
-  If FileName<>"" Then +
-    Dim FS, FileStream +
-    Set FS = CreateObject("Scripting.FileSystemObject"+
-    on error resume Next +
-    Set FileStream = FS.OpenTextFile(FileName) +
-    GetFile = FileStream.ReadAll +
-  End If +
-End Function +
- +
-function WriteFile(FileName, Contents) +
-  Dim OutStream, FS +
-  on error resume Next +
-  Set FS = CreateObject("Scripting.FileSystemObject"+
-  Set OutStream = FS.OpenTextFile(FileName, 2, True) +
-  OutStream.Write Contents +
-End Function +
-</code> +
-{{tag>kb}}+
kb/exporting_from_endnote_with_pdfs.1250276771.txt.gz · Last modified: 2009/08/14 15:06 by karnesky