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

Select Last pattern

Contributor ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

I work in patterns. I have to make 1000 patterns a day. So I am troubled by selecting every time. Can the last pattern be selected?

TOPICS
Actions and scripting

Views

697
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

Community Expert , Jan 04, 2024 Jan 04, 2024

This should create a Pattern Layer with the last Pattern. 

// create pattern layer with last pattern;
// 2023, use it at your own risk;
if (app.documents.length > 0) {
try {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID ("property"), stringIDToTypeID("presetManager") ); 
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var presetManager = applicationDesc.getList(stringIDToTypeID("presetMa
...

Votes

Translate
Adobe
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

Selected where and how? What is the context?

 

Please describe in steps and add screenshots to help illustrate.

 

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Screenshot 2024-08-28 165735.pngexpand image

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
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Patterns, Options Bar, …) visible to illustrate what the point is, how you want to use that Pattern? 

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Screenshot 2024-08-28 165735.pngexpand image

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Please help me sir. I have been trying to solve the problem for a year.

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
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

This should create a Pattern Layer with the last Pattern. 

// create pattern layer with last pattern;
// 2023, use it at your own risk;
if (app.documents.length > 0) {
try {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID ("property"), stringIDToTypeID("presetManager") ); 
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var presetManager = applicationDesc.getList(stringIDToTypeID("presetManager"));
var patternNames = presetManager.getObjectValue(4).getList(stringIDToTypeID("name"));
var theNames = new Array;
for (m = 0; m < patternNames.count; m++) {
    theNames.push(patternNames.getString(m))
};
makePatternLayer (theNames[theNames.length-1], 100);
//brickFill (theNames[theNames.length-1], 0.1)
} catch (e) {};
};
////// make pattern layer //////
function makePatternLayer (thePatternName, theScale) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
	var desc3 = new ActionDescriptor();
	var idnull = charIDToTypeID( "null" );
		var ref1 = new ActionReference();
		var idcontentLayer = stringIDToTypeID( "contentLayer" );
		ref1.putClass( idcontentLayer );
	desc3.putReference( idnull, ref1 );
	var idUsng = charIDToTypeID( "Usng" );
		var desc4 = new ActionDescriptor();
		var idType = charIDToTypeID( "Type" );
			var desc5 = new ActionDescriptor();
			var idScl = charIDToTypeID( "Scl " );
			var idPrc = charIDToTypeID( "#Prc" );
			desc5.putUnitDouble( idScl, idPrc, theScale );
			var idPtrn = charIDToTypeID( "Ptrn" );
				var desc6 = new ActionDescriptor();
				var idNm = charIDToTypeID( "Nm  " );
				desc6.putString( idNm, "rust400x400" );
				var idIdnt = charIDToTypeID( "Nm  " );
				desc6.putString( idIdnt, thePatternName );
			var idPtrn = charIDToTypeID( "Ptrn" );
			desc5.putObject( idPtrn, idPtrn, desc6 );
		var idpatternLayer = stringIDToTypeID( "patternLayer" );
		desc4.putObject( idType, idpatternLayer, desc5 );
	var idcontentLayer = stringIDToTypeID( "contentLayer" );
	desc3.putObject( idUsng, idcontentLayer, desc4 );
executeAction( idMk, desc3, DialogModes.NO );
return app.activeDocument.activeLayer
};

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Ohh my God....it is working..THank U.. THank u SO Much..U are Great Sir..Thank U.

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
Community Expert ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

You’re welcome! 

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
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

@MJ ST 

 

You were not explicitly tagged in the last two replies, so may not be receiving notifications... Please let us know how the script from @c.pfaffenbichler works for you.

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
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

If you open the Patterns panel (Window > Patterns), then your most recently used pattern should appear as a small swatch at the to as well as a larger swatch below the other folders of swatches. You can click on a swatch and drag it to a selection on your canvas to apply it. Similarly, you can select a Pattern layer in the Layers panel and click on a different pattern swatch to have that pattern layer use that selected swatch instead.

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Very nice. This is a correct method but when I use it in action, the same pattern is repeating.

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
Community Expert ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

How you want to use that Pattern? 

What role is it supposed to play in the Action? 

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

I replayed you above sir

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
Contributor ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

Sorry sir. If you ever say something wrong.

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
Community Expert ,
Jan 09, 2024 Jan 09, 2024

Copy link to clipboard

Copied

quote

Sorry sir. If you ever say something wrong.

That seems a bit unclear; but should the Script need changes please elaborate. 

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
Contributor ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

No sir.this script is a best script.it is working...Thank u.

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
Contributor ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

LATEST

Sorry sir.
if i ever said something wrong to you

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