|
Automation has always been a buzzword for Pro/ENGINEER customers and with good reason. Automated tasks are fast, efficient and always completed in the same manner every time. Although its worth cannot be directly measured, standardization contributes to improved quality as well as faster design and design changes. For companies, the bottom line is always time, quality and cost and automation at any level improves the bottom line.
Some of the earliest automations in Pro/ENGINEER involved mapkeys and trail files. Pro/INTRALINK 3.2 introduced a functionality called UI Scripting. Like Pro/ENGINEER trail files, UI Scripting was created to help debug Pro/INTRALINK. A user’s picks can be recorded and sent to PTC along with the customer’s database. PTC uses the UI Script file and database to reproduce the customer’s issue.
PTC also developed UI Scripting to behave like mapkeys. Users can play back recorded scripts just like mapkeys. These UI Scripts can even be added as dropdown menus to the Pro/INTRALINK user interface. The dual nature of UI Scripting makes it quite a bit more useful than Pro/ENGINEER trail files or mapkeys. All this functionality is supported by PTC Technical Support.
But there is one aspect of UI Scripting that makes it particularly powerful. UI Scripts are written in Java, which means they can be manually edited to take advantage of any Java function. While PTC Technical Support does not support editing of UI Scripts, a little thing like “unsupported” has seldom deterred Pro/ENGINEER users from taking full advantage of the available tools to automate products and processes.
Using UI Scripting in conjunction with Java functionality opens up a wide world of possibilities. The areas of interest include, but aren’t limited to, user, installation, and administrative tasks. Can you think of some Pro/INTRALINK processes you would want to automate?
If you’re worried because you don’t know Java, don’t be. For this foray into UI Scripting, the only prerequisite is a good working knowledge of Pro/INTRALINK.
Let’s walk through the process of recording and playing back a UI Script. We will use a script to open the COMMONSPACE and select the Root Folder. Finally, we will select every object in this folder. Your database won’t look like mine and production databases should never contain any objects in the Root Folder. Just choose a sub-folder that contains Pro/ENGINEER files.
1. After logging into Pro/INTRALINK, open the Scripting UI using [ctrl] + [s].
2. Switch to the Recording tab and enter a name for the Java script file to be recorded. Make sure that “Use Key Recording?” box is checked.

3. Click “Start” and record your picks within the Pro/INTRALINK UI.
4. Open a COMMONSPACE window and select your folder.
5. Now pick one object in the displayed list and use [ctrl] + [a] to select all displayed objects.
6. When finished, click “Stop”. When you record a script, it automatically
- saves the “.java” file to <.proi directory>\ .data\user.data\source directory
- compiles the script file and places the new .class file in <.proidirectory>\.data\user.data\lib (i.e.. it reads the .java file and makes a .class file).

- Switches to the Playback tab. Make sure “Use Watch Window?” is checked so you can watch each line execute for debugging purposes.

7. Click “Playback” and the Scripting UI will switch to the Watch tab. The commands are described in the table below.
|
Watch Window Buttons
|
|
Button
|
Description
|
|
Step
|
Executes one command.
|
|
Run
|
Executes all commands.
|
|
Pause
|
Temporarily stops a running script.
|
|
Abort
|
Cancels a script even if it is paused or stepping.
|
The status icons are described in the table below.
|
Watch Window Status Icons
|
|
Button
|
Description
|
|
=
|
the current command
|
|

|
not executed yet
|
|

|
executed successfully
|
|

|
failed execution
|
|

|
currently executing
|
8. Step through the program. After selecting Step twice, my Watch tab looks like this:

We only made three selections, so why are there four lines? Sometimes Pro/INTRALINK executes more than one command when we click a button. By setting the folder, the software automatically filtered the display to show only the latest versions. PIV stands for product instance version. Every line displayed in the COMMONSPACE table is a PIV.
9. Continue to step through the program. If the script fails for any reason switch to the Errors tab. If no errors are reported, switch to the Messages tab for any additional information.
Pro/INTRALINK scripts can be run from the Scripting UI using the Playback button as we did above. But this method requires users to understand the scripting interface. Fortunately, PTC took into account the mapkey scenario for UI Scripting. UI Script creators can add a custom dropdown menu to the WORKSPACE or COMMMONSPACE folders by simply copying the compiled “.class” file to the “<.proi Load Point>\.data\user.data\custom\WS” or “<.proi Load Point>\.data\user.data\custom\CS” directories as shown below.

A Pro/INTRALINK client command line argument lets you record everything from user login to session close. Record a script from the command line by calling the Pro/INTRALINK client startup command, followed by the option “-r” and the name of the file to record.
proiclient.bat -- -r test.java
The script can in turn be executed from the command line using the Pro/INTRALINK client command line switch “-p”. The class to run must be in the “lib” folder. Command line scripts can even be run in nongraphical mode just like a Pro/ENGINEER trail file. The Pro/INTRALINK startup command shown below puts all these elements together. It calls Pro/INTRALINK in nongraphical mode and runs a UI Script.
proiclient.bat -- -nographics p test.class
Although the above example isn’t very useful, there are numerous applications for UI Scripting. Incorporating the above functionality with a few manual edits can build very powerful automations. Have you thought of any applications for UI Scripting now?
UI Scripts can execute custom check-outs/ins, modify object attributes, and even produce custom reporting which helps focus on better-quality products. Administrative scripts can automate the purge process or export a Pro/INTRALINK BOM to an ERP/MRP system, reducing the time spent managing the data. Configuration scripts can be used to populate folders complete with permissions or to create users and groups in seconds.
Taking automation to the nth degree, UI scripting can be used in conjunction with a Pro/ENGINEER-driven configurator. It can automatically check out a configurable product and open that product in Pro/ENGINEER. After Pro/ENGINEER builds the product to a customer’s specifications and saves it to the WORKSPACE, UI Scripting can modify the attributes and check the configured product back into Pro/INTRALINKall without human interaction. Thus it can save valuable engineering time, increase quality by reducing user errors, and ultimately cut costs.
If you decide to delve deeper into UI Scripting, be sure to do all development and testing on a test server/client installation. Once completed and debugged, your scripts can be disseminated by copying them into each user’s .proi folder structure as described above.
Work through the entire process, practice your picks, and when you are ready, record your script. Always keep in mind the end goal. A script that saves time for every user every day may be just as valuable as the automation of a product line.
UI Scripting is a powerful tool available to everyone. Take advantage of it and make Pro/INTRALINK do the work for you. 
Matt Meadows is a solutions architect at Sequoia Etcetera. He can be reached by email at mattm@sequoiaetc.com.
|