High-Volume Intralink Export – Use Scripts to Make Things Easier

OK, it’s been a while since I wrote for the CADminBlog (way too long), but thought about refreshing it with articles on CAD Admin tasks I’ve been dealing with lately.  First off, here’s a few notes on a recent bulk-export…

The aim was to pull out the latest versions of thousands of Pro/E files from an Intralink dataserver. Initially I thought, “Simply checkout everything to a workspace, then export it all to disk”. In the ideal world, this would probably work fine, but there were a number of errors with “import/export”. So, I needed a way to find out what exactly got exported and compare to what I needed.

I used a combination of batch file and UI scripting… because I didn’t fancy going through a list of 8000+ files manually!!  I based these on previous scripts from other jobs, and it turned out to be pretty easy to do… maybe I’m starting to get the hang of this, just as Intralink 3.x is going away!!  I’ll assume you know what to do with .bat and .java files… have fun!

The batch file does a few things:

  • navigates to a sub-folder (containing the exported CAD files so far)
  • calls the purge command (leaving only the latest versions)
  • takes directory of the contents (/B = bare format, filenames only)
  • stores list of filenames without number suffix (filename.prt.4 becomes filename.prt)
  • creates a batch file to rename the CAD files to .1 suffix (optional)

Then the UI script does a couple more:

  • reads in the filename list
  • sets “Hold” on each item

This makes it easy to see what items have been exported: simply sort by the column “To Hold”. The value equals the export status, eg: “TRUE” or “FALSE”. Then you can work on exporting those last few files that didn’t make it first time around.

Batch file: _purge_em.bat

@echo off

set /P FOLDER="Folder to purge? "

cmd /C purge
cd ..

dir %FOLDER% /b > Hold-.txt
find /C "."Hold.txt
echo cd %FOLDER%>_rename_em_%FOLDER%.bat
for /F "tokens=1,2,3 delims=." %%i in (Hold-.txt) do echo %%i.%%j>>Hold.txt&if not "%%k"=="1" echo ren %%i.%%j.%%k %%i.%%j.1>>_rename_em_%FOLDER%.bat

UI script: HoldEm.java

// Version: Intralink v.3.4.M020 (2006080-I6.0.0.412)
// Start Macro Recording
import com.ptc.intralink.client.script.*;
import com.ptc.intralink.script.*;
import javax.swing.JOptionPane;
import java.io.*;
import java.util.*;

import java.awt.*;
import com.ptc.intralink.event.ILEventManager;

public class HoldEm extends ILIntralinkScript {
 ILIntralinkScriptInterface IL = (ILIntralinkScriptInterface)getScriptInterface();

public void run0 () throws Exception {

 Window activewindow = ILEventManager.getActiveWindow();
 String wsN= "null";
 wsN = activewindow.findComponentAt(10,10).getAccessibleContext().getAccessibleName();
 String wsName = wsN.substring(12,wsN.length());

 BufferedReader br = null;
 String line;

 String fileName = "c:\ptc\Hold.txt";

 JOptionPane.showConfirmDialog(null,"Place a list of filenames @ " + fileName,"Hold Em",JOptionPane.PLAIN_MESSAGE);

  try {
   br = new BufferedReader(new FileReader( fileName ));
   IL.selectAll("NONE" );
   IL.openWindow( "Modify", "", "" );

   while ((line = br.readLine()) != null) {
    String obj2[] = line.split("t");
    try { IL.deselectAll("NONE" );
     IL.select("NONE", wsName + "/" + obj2[0] );
     IL.setAttribute( "To Hold", true );
    catch (Exception e2) {}
   IL.ok( );
  catch (Exception e) {

 public void run () throws Exception {
  run0 ();

Source: CADminBLog

Tags: , , , , , , , , , , , , , , , ,

No comments yet.

Leave a Reply