Skip to main content
Known Participant
October 18, 2008
Question

[JS][CS3] Method failing in palette

  • October 18, 2008
  • 5 replies
  • 452 views
Hi,

Although I experience the problem in Illustrator CS/Win, I suspect someone might have been through a similar problem in InD, and it might expose some sort of bug. I seek to either have such a bug confirmed or grasp a solution. That's why I'm posting also on this forum.

I wrote a method to check whether the active document's selection is exactly two vertical guides, and it works well when isolated, run from either Scripts menu or from ESTK. But once attached this method to a button in ScriptUI palette, it continuously fails to do its job. Again, it works OK from a modal dialog (which however is not a solution to me, since it does not allow interaction).

It claims that "there is no document", although it is there and has the expected selection. I tried a whole bunch of try/catch, if'fing tests, referring to activeDocument as well as documents, passing a ready-to-use docref, repeating the #target directive, restarting Ai/ESTK, but it stubbornly claims there is no document.

Anyone having a workaround? It's a showstopper 😞 I have to stick with palette type of window. :(
This topic has been closed for replies.

5 replies

moniuchAuthor
Known Participant
October 18, 2008
:)
quoting myself: "referring to activeDocument as well as documents"

Apparently this is a known issue:
http://www.adobe.com/devnet/illustrator/scripting/IllustratorCS3_Scripting_Readme.txt
and a palette causes the script to lose context, unlike a modal dialog.

But I somehow can't get even simplest BridgeTalk message to work...
Inspiring
October 18, 2008
Inspiring
October 18, 2008
Hi Moniuch,

instead of app.activeDocument try app.documents[0].

Martin
moniuchAuthor
Known Participant
October 18, 2008
Yes, Dave, I do this kind of debug all the time, writing either to console or showing alerts, but what good does it when you see that there IS a document but an alert shows that you fell into if(!app.activeDocument) ?

Try to attach to a button any function referring to a selection, for instance: returning width of the selected object. Try both types of window frame: 'dialog' and 'palette'. I'd be curious what results you'd get.

Unless I'm doing something wrong, I think there might be some problem with window layering.

Art
Inspiring
October 18, 2008
Without seeing the code, it's very hard to know what might be wrong. If an error of any sort occurs in a ScriptUI handler, the handler just terminates so that life can go on.

When this happens to me, I insert alerts to let me see how far through the handler I got before the error.

Dave