Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

app.doScript on clipping mask action creates unwanted rectangle

Explorer ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

Windows 10, Illustrator 26.0 
This is at least a bug but perhaps a security issue as well. 
When running this action manually, on a single jpg, I get the jpg nested in 2 clipping masks and 1 linked file on top (Desired).

AJJ22656695e0lw_0-1644443001059.png

When invoking via app.doScript, one clipping mask contains an unwanted rectangle that is filled with the default white w/black stroke. 

AJJ22656695e0lw_1-1644443367379.png

Why is this rectangle appearing and how can i get rid of it? 

Action, if it matters: 

AJJ22656695e0lw_2-1644443737023.png

Script, if it matters.

// https://gist.github.com/joonaspaakko/df2f9e31bdb365a6e5df

// Finds all .ai files from the input folder + its subfolders and converts them to the version given below in a variable called "targetVersion"

// Tested in Illustrator cc 2014 (Mac)
// Didn't bother to do a speed test with my macbook air...

#target illustrator

	// If set to false, a new file will be written next to the original file.
	// The new file will have (legacyFile) in the name.
	// Files with (legacyFile) in the file name are always ignored.
var overwrite = true, // boolean
	// Accepted values:
	// 8, 9, 10, 11 (cs), 12 (cs2), 13 (cs3), 14 (cs4), 15 (cs5), 16 (cs6), 17 (cc)
	targetVersion = 26;

if ( app.documents.length > 0 ) {

	alert("ERROR: \n Close all documents before running this script." );

}
// Run the script
else {

	var files,
		folder = Folder("O:/path//to//api//files");

	// If folder variable return null, user most likely canceled the dialog or
	// the input folder and it subfolders don't contain any .ai files.
	if ( folder != null ) {

		// returns an array of file paths in the selected folder.
		files = GetFiles( folder );

		// This is where things actually start happening...
		process( files );

	}

}


function process( files ) {

	// Loop through the list of .ai files:
	// Open > Save > Close > LOOP
	for ( i = 0; i < files.length; i++ ) {

		// Current file
		var file = files[i]

		// Open
		app.open( file );

		// If overwrite is false, create a new file, otherwise use "file" variable;
//		file = !overwrite ? new File( file.toString().replace(".ai", " (legacyFile).ai") ) : file;

		// Run your action
		app.doScript ("confidential", "confidential set");

	}

}

function GetFiles( folder ) {

	var i, item,
		// Array to store the files in...
		files = [],
		// Get files...
		items = folder.getFiles();

	// Loop through all files in the given folder
	for ( i = 0; i < items.length; i++ ) {

		item = items[i];

		// Find .ai files
		var fileformat = item.name.match(/\.jpg$/i);

		// If item is a folder, check the folder for files.
		if ( item instanceof Folder ) {

			// Combine existing array with files found in the folder
//			files = files.concat( GetFiles( item ) );


		}
		// If the item is a file, push it to the array.
		else if ( item instanceof File && fileformat ) {

			// Push files to the array
			files.push( item );

		}
	}

	return files;
}

 

TOPICS
Bug , Scripting

Views

157
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Feb 10, 2022 Feb 10, 2022

A mod can delete this post. 

There was an issue with the action. 

Troubleshot the action by turning steps off and running until a resolution was found.

Votes

Translate
Adobe
Explorer ,
Feb 10, 2022 Feb 10, 2022

Copy link to clipboard

Copied

LATEST

A mod can delete this post. 

There was an issue with the action. 

Troubleshot the action by turning steps off and running until a resolution was found.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines