OCR & Active Directory Automation

by Donna Horton, in Ask an ASE, posted 2/7/12
image for article

Business Problem

A popular retail company has high-employee turnover for the busy holiday season.  Each new employee’s information must be entered into an HR administration system to keep up-do-date records.  Currently, they are manually entering the data which is both time consuming and can be rife with errors.  Other alternatives that include chartering a coding effort, or purchasing expensive Optical Character Recognition (OCR) technologies, are expensive and difficult to maintain just for the holiday-shopping months.  They need a solution that can read directly from hiring documents that can be scanned in; they need to use the new OCR actions available in AutoMate and BPA Server 9.

Background Summary

The new OCR actions have the ability to read, extract and convert ANY type of image, such as a bitmap, jpeg, png, pdf or tiff file, into text for electronic automation and importation. Once AutoMate OCR Actions are used, individual text fields in the form can be read and processed as data items. But data-item recognition is only the first step.  Once the OCR Actions have completed their work, more automation can be engaged by using Windows Active Directory. You have the ability to automate creating, modifying and managing any type of Active Directory Object, User or Group. 

In this blog post we will go over how to integrate OCR automation with Active Directory automation for a new hire’s application.  We will explore reading a name, address and telephone number from an application image, and creating an Active Directory User with AutoMate’s OCR, Active Directory, Loop and Flow Control Actions.

The BPA 9 workflow below, (Figure 1), contains a Hotkey trigger and three tasks.  Upon pressing “Ctrl A”, an employee application in a PDF file is read, the new employee’s information is extracted and an Active Directory User is created in the “OCR & Active Directory” task.  The two remaining tasks contain a simple step to send an email to notify IT Administrators if the process executed successfully in the “Successful Email Notification” task or if the workflow incurred problems in the “Failure Email Notification” task.  Our focus for the remainder of the blog is on the “OCR and Active Directory” Task. 

Figure 1

Figure 1

Solution

OCR and Active Directory Task

The OCR and Active Directory task reads an employee's application PDF file with the OCR Action, and then extracts the information in the application, utilizing variables, the loop list and Flow Control IF actions.  In the last steps, we create an Active Directory user with the last name, first name, and variables.  See the task steps in Figure 2 below.  (Note: the regions in blue are used to section off and enclose the variables and some of the, If-Then flow control actions for task organization and a compressed view.)

Figure 2

Figure 2

Optical Character Recognition (OCR)

The OCR action allows selection of an entire image or a portion of the image to extract data for use within the task.  In this task, OCR works in conjunction with a variable called “VAR_text” as a placeholder for temporarily storing the data from the application pdf file.  The image file is called “NA_JOB_APPL.pdf”.   In Figure 3, the OCR action default setting gets the entire image file and places the image contents into the variable called VAR_text.

We only want to select a portion or pick a region within the image.  In order to select an area within the application image, click the “Specified region (improves accuracy)” option and “Pick Region” to open the choice window.  See Figure 3.

Figure 3

Figure 3

Defining Data

Click the Pick Region option. The Load Image screen opens to allow further defining of the area to select as shown in Figure 4.

Selecting the “Load Image” option loads the “NA_JOB_APPL.pdf” file for regional selection as shown in Figure 4.  Once the image is loaded, select the region to use within the task, by dragging the mouse from the top of the area to the right.  Since we are using the information from the application to create an Active Directory user, we only need to select the name, address, city, state, zip and phone number region under the Applicant Information area.  A red border placed around the selected text indicates the chosen region. (You can test the selected area for accuracy by clicking on the “Test OCR” option. The information will populate in the right verification window.) 

Figure 4

Figure 4

Figure 6

Figure 6

Employee Data Set to Variables for Active Directory

After closing the Pick Region window, the OCR action populates with the Top, Left, Width and Height pixel parameters as shown in Figure 6 (above).

The next set of steps in the task, No. 15 through No. 38 as shown below in Figure 7, is where the employee data from the application pdf file is set to variables for use in setting up the Active Directory user information. 

Figure 7

Figure 7

Loop List Action

The task utilizes a “Loop List” action to loop through the contents of the VAR_text variable and detaches each set of employee information by a comma delimiter.  The Loop List action separates the last name; first name, middle initial; date; street address, city, and state; telephone number and email address data and assigns it to the VAR_item variable one loop at a time.  See Figure 8.

Figure 8

Figure 8

Within the loop, a counter variable called VAR_counter determines the number within the loop assigned to each time the list loops through the employee information.  For example, VAR_counter, No. 1 is assigned to the last name, since it is the first item in the VAR_text variable list. Thus, No. 2 in the VAR_counter is the first name; No. 3 is the middle initial, etc.

IF Flow Control Actions

In Figure 9, the “IF” Flow Control actions specify the variable number to count and set up, based on each component planned for use in creating the Active Directory user. A Mid String Function is used with the Set Variable value to return everything after the semicolon from the VAR_item value.   The Mid Function is a VBScript function used to return a specified number of characters in a string.  For example, the last name returned in VAR_item is “Last Name: Doe”.  The string extracts “Last Name:” from the variable and returns “Doe” only as the VAR_lastname value. 

Figure 9

Figure 9

Note: In the bottom variables tab of Figure 10, each variable is set to the employee information extracted from the OCR applications and VAR_text populate the information into the VAR_item variable when the task is run.

Figure 10

Figure 10

Active Directory Integration

In the next steps of the task, each one of the components from the employee application stored in the defined variables is used to create the new user in the Active Directory.  The Active Directory actions utilize the variable names specified in Figure 10 for creating the user and setting the user object address and telephone number.  Our actions simulate the Active Directory Administrator Center functionality.

In Figure 11, the “Create User” activity action specifies the Active Directory LDAP User Path to define the area to create the Jane Doe user in applying the VAR_firstname and VAR_lastname variables.  The Select Container option opens the Active Directory and all of the Organizational Units for selection.  Obviously, showing our Active Directory organizational units and containers presents a security breach. 

Figure 11

Figure 11

In Figure 12, the “Set object property” action is used to setup the Address object in the Active Directory for the newly created user with the address, city and zip code variables.  Enter the first and last name variables in the LDAP Path to set the address to the correct, Jane Doe user. When a user is selected with the Active Directory action, everything associated with the user is populated under property name for selection.

Figure 12

Figure 12

The last action in the task sets the telephone number into the Active Directory object property, as shown in Figure 12, except the variable assigned to the phone number is used, and the property name, and telephone number are used instead of the street address.

Success!

So there you have it!  The creative forces of automation have done it for you.  Giving you blow-by-blow instructions of how to automate adding new users to the Active Directory upon hire, using the initial application filled out in the interview.

The OCR actions can integrate with a multitude of applications, not just Active Directory.

Send this link to your IT and HR managers for a competitive advantage.  If you do not have AutoMate or BPA Server 9 yet, download a free, trial version, import the task into AutoMate 9 or the Workflow into BPA 9, and start automating the OCR and Active Directory actions today!

Stay tuned for more information on how to save time automating your business IT processes. 

                                                                        * * *

Have an idea for the next Ask an ASE blog post? Send them to askanase@networkautomation.com