120 likes | 272 Views
Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011. Expect. TCL extension – automate/manage interactive applications Use as a telnet/ ssh /ftp session manager Will not work in GUI environment
E N D
Automating MARC Extracts Using Expect________________________________________________MENA-IUG Annual Conference30-31 October 2011
Expect • TCL extension – automate/manage interactive applications • Use as a telnet/ssh/ftp session manager • Will not work in GUI environment • Available for Windows – but scripts would have to be changed
Expect Why? • Pricing • Easy to use • Readily Available • Run as cron job • Examples for III available
Automation • Shift time to lower server load/use • Personnel considerations
Easy to Use • Essentially a macro • Use the “expect” and “send” commands • Walk your way through the menus • Example: expect “Choose*” {send “B”}
Scheduling/Date Start Date • User input? • Reference to current date. • Relation to cron job.
Date Solutions • Set default • Allow for command line input • Example: set day [expr $cDay-1] ;# set default If {llength $argv} > 0} {set day [lindex $argv 0]}
Using Examples • Use the existing examples as the starting point • Most of the issues have been worked out • Different approaches
Modules • Expect can call other scripts – including other expect scripts • Analyze tasks by function • Craft the necessary function for each task
Annoyance timeStamp=$( ls -l --time-style=+%y-%m-%d-%H-%M-%S $summon | awk '{print "zu-catalog-20"$6".marc"}' )
Resources Exploring Expect by Don Libes O'Reilly Media, Inc., December 1, 1994 III Automated Export - Updates & Additions Script: http://community.summon.serialssolutions.com/index.php/III_Automated_Export_-_Updates_%26_Additions_Script Create List of New Items automated IUG Clearinghouse: http://innovativeusers.org/iug-clearinghouse-menu
Resources Wikipedia http://en.wikipedia.org/wiki/Expect Shrew: http://code.google.com/p/shrew/ Expect for windows http://www.activestate.com/activetcl/expect User guide: http://docs.activestate.com/activetcl/8.5/expect4win/ Tutorial: http://npg.dl.ac.uk/MIDAS/manual/ActiveTcl8.5.7.0.290198-html/expect4win/ex_tut.html