Reply
Visitor
Posts: 1
Registered: ‎08-29-2012
0

Automate Endnote

Hello everyone,

 

I am new here and wanted to both request help and at the same time share something I have found helpful. A quick background, I work extensively with both Microsoft Excel and Endnote for managing references. One of the missing features from Endnote X5 is the ability to update references automatically (for each reference you have to indicate whether you want to update all fields or just the missing fields and then save the changes). This takes a couple of really boring, wasted days starring in front of a blinking screen for the tens of thousands of references I have to update. Therefore I have put together a standalone Excel macro that uses the Microsoft Windows API to control Endnote. Simply it just keeps searching for the window asking to update the Endnote references and clicks on the Update all fields button and the save changes button and then keeps looping until it finds another similar window, and so on. It runs smoothly in the background and can be found on the last post on this page (http://www.excelforum.com/excel-programming-vba-macros/855299-windows-api-powershell-repeat-keystrok...

 

I hope this will help others... now I could use some help Smiley Happy. If anyone has compiled the Endnote API commands in a format compatible with Excel VBA then I would be grateful if you could share it with me. I want to tap into the features available in the EndNote API but no experience with C++, but am very fluent in Excel VBA (if that helps any).

 

Thanks in advance.

 

abousetta

 

Disclaimer: The macro I linked to is provided as is. The code is all presented in the forum post and feel free to use it anyway you like without coming back to me. Use it at your own caution as I take no responsibility for any damage it causes, etc., etc. Of course, if you like it then I would love to hear back from you Smiley Wink. Good luck.

Frequent Contributor
Posts: 58
Registered: ‎03-15-2012
0

Re: Automate Endnote

I also wrote a script for automating updating of records in endnote in autohotkey:

 

Return ; Stop the startup lines otherwise #r will run on startup

#r:: ; [Win]+r to start script
SetTitleMatchMode,1 ; title must begin with String
IfWinExist,EndNote X7
{
   WinActivate
   Send !t ; send alt t to access the tools menu
   Send {c 2} ; send to c keystrokes to access the change submenu
   Send {ENTER} ; send enter key to choose menu
   Send {c 7} ; send the c key 7x to choose the Custom 8 field
   Send {TAB 2} ; send the tab kay twice to position in change area
   Send {Down 2} ; send down key twice to choose "replace whole field with:"
   Send {TAB} ; to get to text field
   InputBox, excludes, Enter exclusions for selected records, Excludes:,,,,,,,,aftergrant2012_09 after2014SFURequest after2014Progressreport
   Send  %excludes% ; enter text for excludes in custom 8 field
   Send {TAB}
   Send {ENTER 2}
   sleep 5000 ; sleep 5 seconds to allow updating
   Send {Enter}
; finished section 1 - entering excludes
sleep 1000 ; sleep for 1 second
   Send !t ; send alt t to access the tools menu
   Send {c 2} ; send to c keystrokes to access the change submenu
   Send {ENTER} ; send enter key to choose menu
   Send {r 4} ; send the r key 4x to choose the Reviewed Item field
   Send {TAB 2} ; send the tab kay twice to position in change area
   Send {Down 2} ; send down key twice to choose "replace whole field with:"
   Send {TAB} ; to get to text field
   InputBox, pubsource, Enter publication source:, Publication Source:,,,,,,,,2014 from Pubmed
   Send %pubsource% ; enter text in Reviewed Item field
   Send {TAB}
   Send {ENTER 2}
   sleep 5000 ; sleep 5 seconds to allow updating
   Send {Enter}
; finished section 2 - entering origin of pub (pubmed) and date
sleep 1000 ; sleep for 1 second
   Send !t ; send alt t to access the tools menu
   Send {c 2} ; send to c keystrokes to access the change submenu
   Send {ENTER} ; send enter key to choose menu
   Send +{TAB} ; access menu one above
   Send {Right} ; move right one tab
   Send {TAB} ; move to from field
   Send {a 4} ; press a 4x to choose accession number
   Send {Tab}
   Send {L} ; choose label field
   Send {TAB}
   Send {Down 2} ; choose replace entire field
   Send {TAB 2} ; two tabs if the former field is chosen
   Send {Down} ; choose to copy field
   Send {TAB} ; to get to next field
   Send {ENTER}
   Send {ENTER}
   sleep 5000 ; sleep 5 seconds to allow updating
   Send {Enter}
; finished section 3 - copying pmid to label
sleep 1000 ; sleep for 1 second
   Send !t ; send alt t to access the tools menu
   Send {c 2} ; send to c keystrokes to access the change submenu
   Send {ENTER} ; send enter key to choose menu
   Send +{TAB} ; access menu one above
   Send {Right} ; move right one tab
   Send {TAB 4} ; go to move/copy selection
   Send {Down} ; ; choose to copy field instead of moving
   Send {TAB 4} ; move from copy field to from field
   Send {r 3} ; press r 3x to choose record number
   Send {Tab}
   Send {c 8} ; press c 8x to choose call number field
   Send {TAB}
   Send {Down 2} ; choose replace entire field
   Send {TAB 3} ; three tabs if the former field is chosen
   Send {ENTER 2}
   sleep 1000 ; sleep for 1 second
   Send {Enter}
; finished section 4 - copying record number to call number
}

 

and another for automating backup of any library

 

Return

#b:: ; assign [Win]+b to backup script
MsgBox, Have you opened your library yet, if not please do so, then click Okay.
SetTitleMatchMode,1 ; title must begin with String
IfWinExist,EndNote X7 - ; Endnote must have a library open to display the - after the title name
{
   WinActivate
   WinGetActiveTitle, title
   mytitle:=substr(title, instr(title, "["), -1) ; -1 is to end of line
   libname:=substr(mytitle, 2) ; basename of library
   Send !f ; send alt f to access the File menu
   Send {UP 2} ; send 2 up keystrokes to access the compressed file function
   Send {ENTER} ; send enter key to choose function
   Send {ENTER} ; send the enter key to continue with no changes
   sleep 1000
   Winactivate, Save Compressed Library (.enlx)
   ; ask for user input for where to save compressed file
   ; ---------------------------------------------------------------------------------------------
   ; The following commands access the endnote library on my computer in windows 7
   ;
   Send +{TAB 5} ; send shift tab 5 times to get to folder selection
   Send e ; go to endnote library entry
   ; --------------------------------------------------------------------------------------
   Send {Enter} ; choose endnote library folder
   sleep 1000
   Send {TAB 5} ; to get to file name field
   Send {Delete} ; in filename field delete anything that is currently there
   sleep 1000
   MyVar = %A_Year%%A_MM%%A_DD%_%A_Hour%%A_Min%_%libname% ; variable contains yyyymmdd_
   Send %MyVar% ; send this variable as the beginning of the filename
   Send {ENTER}
}
else
 MsgBox, No Open Library found

 

Thomas Zucker-Scharff
Systems Analyst
New User
Posts: 3
Registered: ‎10-30-2015
0

Re: Automate Endnote

very useful, many many thanks