New Approaches in Automation
Total Page:16
File Type:pdf, Size:1020Kb
Automation Boost your productivity a thousand times Allen Lam, IT Manager HKU Libraries [email protected] 1 Automation Automate Innopac by Expect Automate Millennium by AutoIt New ways to program Expect New ways to program AutoIt Sierra automation 2 Usage of automation 1 Create review list (of bib, item, patron, etc) 2 Updating records (when global/rapid updates cannot help) 3 Loading/Exporting records 4 Generating statistics files, reports, etc 5 FTP upload/download 6 *Any* repeating tasks 3 Tools Automate Innopac by Expect Automate Millennium by AutoIt Expect is a Unix automation and testing tool, an extension to the Tcl scripting language, for interactive applications such as telnet, ftp, ssh… 4 Tcl & Expect Tool For controlling command and extending language applications Expect is an extension of Tcl 5 expect – automates “talks” to servers expect script send command wait for response 6 Bibles of Tcl and Expect 7 Ways to write Expect-style programs expect • reliable, in a less popular language (Tcl) • http://www.nist.gov/el/msid/expect.cfm expect4j • Excellent • http://code.google.com/p/expect4j/ (Java) expectj • works for light duty tasks only • http://expectj.sourceforge.net/ (Java) 8 Ways to write Expect-style programs enchanter • Excellent (Python, Ruby, • http://code.google.com/p/enchanter/ BeanShell) expect in • http://php.net/manual/en/ php (PECL book.expect.php extension) Expect.pm • http://search.cpan.org/~rgiersig/ Expect-1.15/Expect.pod (perl expect module) 9 Expect programmers, don’t limit yourself to Tcl Tcl . Java Delphi php Expect .NET Perl C# Ruby c/c++ Python 10 Java JVM > Tcl interpreter Multi-Threads Light weight Excellent IDE OO No compile Rich Lib Multi-platforms Pre-installed Garbage collection Community support Tcl/Expect Cannot spawn in DOS Cannot run in Windows Can run everywhere 11 Weakness in Mill Create Review File ONLY by Boolean search 12 Missing feature in Mill Create Review File by a given list of numbers ISSN/ISBN Bib rec# Call numbers Item rec# Barcodes Patron rec# Card numbers Order rec# Invoice numbers …… Course codes ….. 13 Demo For creating review files from rec#, ISN, BC A Java program with GUI Using expect4j to control Innopac Wrapped in exe Runs directly in Windows 14 Howto 1: Search by rec# SSH connection Innopac login Search by rec# Expect dialogue - Expect () Append to review list - Send () - … disconnect end﹜ 15 Gen Review File using Rec# 16 Gen Review File using Rec# 17 Gen Review File using Rec# Loop 18 Indexed fields other than Rec# 19 OPAC search to build review file 20 Howto 2: OPAC search SSH connection Innopac login OPAC Search Capture rec# Expect dialogue - Expect () Search by rec# - Send () - … Append to review list ﹜ disconnect end 21 Tools Automate Innopac by Expect Automate Millennium by AutoIt AutoIt is a freeware scripting language designed for automating the Windows GUI. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation… 22 automate Millennium by AutoIt (Windows Only) But q Slow automating q Unpredictable response time linear sequential tasks is good q Bad for long sequence of iterative actions 23 Automation in the Sierra era web services/ API Custom Programs Create Access right= Read Update Delete 24 Automation in the Sierra era web services RW access to DB layer? Patron WS Item WS Bib WS Comprehensive enough? ReviewFile WS Price? Admin WS etc ?? 25 Char-based UI (Innopac) replaced by Command line UI? We wish… Every single command can be accomplished equally by different interfaces Command line UI GUI WS/API 26 Make Sierra an Open Platform Let community programmers contribute to Sierra 27 Summary 1 Automate Innopac by Expect Automate Millennium by AutoIt Expect can be written in many languages AutoIt has limitations AutoIt works well with Java AutoIt works best with non-iterative solutions 28 Summary 2 Methods to create review files from list Demo programs Sierra’s WS allows another form of automation • Can Sierra also give us a command-line interface? • Open platform is the trend 29 30 .