Hi all.
I used the search function before asking so, sorry in advance if this a silly doubt
previously asked.
I'm writing an script to be used in Illustrator CS4, I have the "core functions" ready
in several small scripts, but this past days I found that I'm unable to achieve
something that I suposse must be pretty simple...
When I build a dialog in "palette" mode (I mean "no modal"), in orden to be able
to interact with the document's elements with the palette open, I found that
I'm unable to access the "document" object...
A small code snippet like the one I'm using:
Code: Select all#target illustrator
#targetengine another
var dlg1 = new Window("palette", "My palette", [100,100,200,200]);
btn1 = dlg1.add("button" , [10,10,100,30], 'Count textFrames');
btn1.onClick = function () {
docRef = activeDocument;
alert("There are " + docRef.textFrames.length + " text frames." );
}
dlg1.show();
When I execute my script I receive the error:
"There is no document".
But if I change the window type from "palette" to "dialog" the script works fine (has full access
to the document open in AI and all its contents, textFrames, Symbols, whatelse...), but obviously
I cannot interact with the document until I close the dialog...
So the question its simple, How can I access the document object from a dialog in "palette" type?
Thanks a lot in advance.
Best reagards.
b:.
How to access document from a "palette" AI CS4
How to access document from a "palette" AI CS4
I'm not sure about Illustrator but you can't have any ScriptUI dialog open, palette or modal, and be able to interact normally with the GUI.
To have that kind of dialog you need to create a panel. For CS4 or 5 Photoshop has the Panel SDK. For CS5 there is the new CS-SDK which works with several CS apps.
I'm not sure what is needed for Illustrator CS4.
To have that kind of dialog you need to create a panel. For CS4 or 5 Photoshop has the Panel SDK. For CS5 there is the new CS-SDK which works with several CS apps.
I'm not sure what is needed for Illustrator CS4.