12
Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Embed Size (px)

Citation preview

Page 1: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Automating MARC Extracts Using Expect

________________________________________________

MENA-IUG Annual Conference30-31 October 2011

Page 2: 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• Available for Windows – but scripts would

have to be changed

Page 3: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Expect

Why?• Pricing

• Easy to use

• Readily Available

• Run as cron job

• Examples for III available

Page 4: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Automation

• Shift time to lower server load/use

• Personnel considerations

Page 5: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Easy to Use

• Essentially a macro– Use the “expect” and “send” commands– Walk your way through the menus

• Example: expect “Choose*” {send “B”}

Page 6: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Scheduling/Date

Start Date

• User input?

• Reference to current date.

• Relation to cron job.

Page 7: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

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]}

Page 8: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Using Examples

• Use the existing examples as the starting point

• Most of the issues have been worked out

• Different approaches

Page 9: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Modules

• Expect can call other scripts – including other expect scripts

• Analyze tasks by function• Craft the necessary function for each task

Page 10: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

Annoyance

timeStamp=$( ls -l --time-style=+%y-%m-%d-%H-%M-%S $summon | awk '{print "zu-catalog-20"$6".marc"}' )

Page 11: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

ResourcesExploring 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 automatedIUG Clearinghouse: http://innovativeusers.org/iug-clearinghouse-menu

Page 12: Automating MARC Extracts Using Expect ________________________________________________ MENA-IUG Annual Conference 30-31 October 2011

ResourcesWikipedia

http://en.wikipedia.org/wiki/Expect

Shrew:http://code.google.com/p/shrew/

Expect for windowshttp://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