Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Intralink scripting help needed

clbell

New member
Hi folks,
I am trying to take an existing list of part numbers that need to be inactivated and
inactivate them using scripting. The problem is the script fails when a search results
in either no items or items that have already been inactivated. Since I don't have an
API for this, I don't know how to integrate a check. So far, I have taken a basic
recorded macro and added file reading and a while loop. I need it to somehow skip to the
next search when a search does not have any results.
Here's the code:

private void run0 () throws Exception {

String fileName = "d:\\Home\\Filelist.txt";
String line;
FileInputStream in = new FileInputStream(fileName);
BufferedReader br = new BufferedReader(new
InputStreamReader(in));

while ((line = br.readLine()) != null) {

IL.select( "NotInactivated", "Local" );
IL.clearFilter( );
IL.addFilter( "Name", "=", new Object[]{line + "*" });
IL.addFilter( "Revision", "Latest", new Object[]{"" });
IL.addFilter( "Version", "Latest", new Object[]{new java.lang.Integer(0) } );
IL.addFilter( "Release Level", "!=", new Object[]{"Inactive" } );
IL.applyFilter( );
IL.selectAll( "PIV" );
IL.openWindow( "Promote", "", "" );
IL.updateDependents( "None", "latest", 528 );
IL.selectAll( "PIV" );
IL.setAttribute( "Promote To", "Inactive" );
IL.deselectAll( "PIV" );
IL.ok( );

}
}
Edited by: clbell
 
I found the solution after more searching. Here's the changed block of code:

IL.select( "NotInactivated", "Local" );
IL.clearFilter( );
IL.addFilter( "Name", "=", new Object[]{line + "*" } );
IL.addFilter( "Revision", "Latest", new Object[]{"" } );
IL.addFilter( "Version", "Latest", new Object[]{new java.lang.Integer(0) } );
IL.addFilter( "Release Level", "!=", new Object[]{"Inactive" } );
IL.addFilter( "Release Level", "!=", new Object[]{"Obsolete" } );
IL.applyFilter( );
IL.selectAll( "PIV" );

String workobjects[] = IL.getSelectedObjects ( "PIV" );

if (workobjects.length != 0)
{
IL.openWindow( "Promote", "", "" );
IL.updateDep endents( "None", "latest", 528 );
IL.selectAll ( "PIV" );
IL.setAttrib ute( "Promote To", "Inactive" );
IL.setRTPFor mInfo( "Mass_inact_8_12_2010_" + line, "", "Root Folder/Admin/RTPforms", false,
true );
IL.deselectA ll( "PIV" );
IL.ok( );
}
 

Sponsor

Articles From 3DCAD World

Back
Top