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

Palette can't access active document

Community Beginner ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

Hello !

 

I am working on a randomizer script for illustrator, and i am stubling on a problem.

I would like my script to be a palette, but when i change 

 

new Window("dialog", ...)

 

to 

 

new Window("palette", ...)

 

my script can no longer call app.activeDocument .

 

Here are the bits of code interesting :

 

#target illustrator
#targetengine "session"

var dialogUI = (function () {
	var palette = new Window("palette", undefined, undefined, {closeButton: true, resizeable: true}); 
	[...]
	var apply = group_button.add("button", undefined, undefined, {name: "apply"}); 
	apply.text = "apply"; 

	apply.addEventListener("click",function(){
		MyDoc = app.activeDocument;
		MySelection = MyDoc.selection;
		if(MySelection instanceof Array){
			if(tab_selectionnee == tab_fill_colour){
				random_background_color()
			}
		}
		app.redraw()
	})
	
	palette.show();
}());

 

The error is where MyDoc = app.activeDocument; is, and MySelection = ... is never called

 

Does anyone have an idea on how to solve this ?

TOPICS
Scripting

Views

260

Translate

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 , Nov 08, 2021 Nov 08, 2021

it's a known issue, you must use BridgeTalk to have a Palette talk to Illustrator and vice versa.

 

check this thread for a sample

https://community.adobe.com/t5/illustrator-discussions/got-an-error-using-palette-in-illustrator-script/m-p/11689893

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

it's a known issue, you must use BridgeTalk to have a Palette talk to Illustrator and vice versa.

 

check this thread for a sample

https://community.adobe.com/t5/illustrator-discussions/got-an-error-using-palette-in-illustrator-scr...

Votes

Translate

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 Beginner ,
Nov 09, 2021 Nov 09, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot !

I saw a  forum post from 2014 but i hoped Adobe would have solved this issue (is this an issue ?).

Anyway, it is working just fine even if it is a pain in the ass :D.

 

Have a great day sir.

Votes

Translate

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