// Delete links to tagged text files // Peter Kahrel dir = getData( 'Type folder or * to pick folder from list' ); app.dialogs.everyItem().destroy(); f = Folder( dir ).getFiles( '*.inx' ) for( i = 0; i < f.length; i++ ) { // copy the inx file by adding 'x' to extension f[i].copy( f[i]+'x'); // and that's the infile inFile = File( f[i]+'x' ); outFile = File( f[i] ); inFile.encoding = outFile.encoding = 'BINARY'; inFile.open( 'r', undefined, undefined); outFile.open( 'w', undefined, undefined ); nextline = inFile.readln(); while( !inFile.eof ) { if( nextline.indexOf( 'InDesign Tagged Text' ) < 0 ) outFile.write( nextline ); nextline = inFile.readln(); } inFile.close(); inFile.remove(); outFile.close(); } function getData( dir ) { var subfolders, sourceButtons, ignoreErrors, destButtons, dropdown; var dlg = app.dialogs.add( { name : 'Delete links' } ); with(dlg) with( dialogColumns.add() ) { with( dialogColumns.add() ) staticTexts.add( { staticLabel : 'Folder:' } ); with( dialogColumns.add() ) dir = textEditboxes.add( { editContents : dir, minWidth : 235 } ) } if( dlg.show() == false ) destroyExit(); // if * pressed get folder from folder dialog // and display script dialog again if( dir.editContents == '*' ) { dir = Folder.selectDialog( 'Select a folder', dir ) if( dir == null ) destroyExit(); return getData( dir ) } return dir.editContents } function destroyExit() { app.dialogs.everyItem().destroy(); exit() }