Presented as a HANDS ON! session at Eastern Great Lakes Innovative Users Group 2009 conference. I will add the links to the example scripts once they are loaded to the conference web site.
Program description:
AutoIt is a freeware Windows automation program that has helped many libraries automate Millennium workflows. Its flexibility and power allows users to build scripts that go well beyond automating keystrokes in cataloging, ordering, and in other processes. This hands-on session will introduce the participants to the basics of AutoIt programming (such as variables, conditional statements, and functions) and provide several examples where AutoIt has been utilized in Millennium workflows. The session will be geared towards those who have limited programming or OCLC Connexion macro scripting experience.
Hello, fellow PowerPoint folks! If you can read this then you’re good to go. Look in notes section for the accompanying text for the corresponding slides.
This is a short disclaimer stating: 1) The purpose of this tutorial is to make you familiar with the basics of AutoIt in order for you to start thinking of the possibilities of using AutoIt in your library 2) I did not get paid by AutoIt to lead this session.
AutoIt is an automation scripting language designed exclusively for the Microsoft Windows environment. The language, along with the software tools that you would download from the AutoIt homepage (shown in slide) are distributed under a freeware license. This means while you do not need to pay to use AutoIt, there are certain restrictions in using the software. Read the license before use. Some of the more basic features of AutoIt: 1) BASIC like syntax: Since OML is also structured like VB, AutoIt will be easier to learn once past the syntax differences (see handout for some examples) Even if you do not have OML/VB experience, AutoIt follows the same general programming logic like other languages. 2) Automation of multiple program workflows: AutoIt has the ability of automating tasks in multiple programs, unlike program specific macro tools, like OML in Connextion. 3) GUI Creation: Since AutoIt was built for the Windows environment, AutoIt is able to take advantage of several features in Windows. For example, AutoIt allows users to create their own graphical user interfaces (GUIs). Menus, toolbars, buttons, input windows, text editors – if you have seen it in Windows, you could probably build it using AutoIt. 4) Regular Expressions Support: AutoIt recently added Regular Expression support, making AutoIt more flexible when you need to look for patterns in data/variables. 5) Compiling scripts to standalone .exe files: AutoIt allows you to compile AutoIt files to .exe files, meaning that you do not need AutoIt installed in order to run AutoIt scripts on multiple computers.
There are three basic types of functions in AutoIt: 1) Built-in: These are functions that can be used without any special conditions, etc. For example, if I want to send text to notepad, I would just write Send(“hello world”) in my script and the program will know what to do. 2) User defined functions (UDFs): Since AutoIt has a thriving online community of developers and programmers, many of the functions included in the later versions of AutoIt come from the community. However, they are not written into the program like the built in functions. UDFs can be used within a script as long as you call up the corresponding function library that tells the program what that specific UDF does. (see example in slide) 3) Declare your own: A given. Can be done in two ways: either by using the Func()… EndFunc function to declare functions within a script or build your own function library to use the same functions in different scripts. Declare the function library you are using and you should be able to use your own functions like a UDF.
Several examples of how AutoIt is being used in other libraries: 1) Cataloging/DB maintenance: These examples come from my own scripts. If you would like a copy of my scripts, please contact me at yoosebj@muohio.edu so I can email you a copy. Demo: http://screencast.com/t/THTw1n9ty This is my first major script with AutoIt. We had a few thousand music LP MARC records that had an invalid |h in the 240 field. However, after closer inspection, there were also some other consistent issues: corrupted 007 fields and older 262/305 fields that needed to be converted to 028/260/300 fields. Because a good portion of the list contained records that had other unique issues, we could not use a batch update to fix the following issues. The script does the following: 1]Copy the bib # from the MS Word list. 2] Paste bib # in Millennium and search for the bib record. 3] Grabs the OCLC # from the bib record and searches OCLC. 4]The db staff person has two choices at this point: 4a] If the record is in bad shape (aka it has more problems beyond the core described above), she can then select “a la cart” and address the issues one step at a time. 4b]If the record only has the core problems, she can then select the express option, which, after clicking on the 001 field, the script will automatically fix the 007, 240/245 |h, 262, and 305 fields. 5] After the record is fixed, the macro saves and closes the records, and brings you back to the main menu. [end script] Please note that the demo does have a Persian Flaw of sorts. The 305/300 field did not have the word “discs” so I had to go back and enter that after the script was done correcting everything else. Otherwise, if it was a “clean” record, the record would have been fixed within 35 seconds. ************** Review lists/create lists, Circulation, Others (Harvey Hahn): http://research.ahml.info/oml/AutoIt.html I highly recommend that you read Hahn’s web site about scripting with AutoIt and III. He does a great job in documenting the trials and errors in dealing with III Millennium’s various quirks when it comes to scripting. I also mention a couple of the major issues when scripting for Millennium on the handout. ************** Loading vendor records: (Christina Hennessey, Systems Librarian, Loyola Marymount University): http://library.lmu.edu/departments/administration/SCIUG_2007_Conference_Presentation_on_Scripting.htm ************** Other uses: RSS feeds for new titles (in conjunction with Perl scripts) – Alan Brown, Libraries System Liaison Officer, Bury Libraries: http://www.burysac.org.uk/iug.php
Time to get our hands dirty! Example scripts are on the EGL-IUG website…
End The corresponding handout for this presentation can be found at http://slidesha.re/4fEhdf