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

Need help:my dialog can't work

Community Beginner ,
Mar 11, 2008 Mar 11, 2008
My dialog's code:

/*********

var myDialog = new Window('window', 'find',undefined);
myDialog.lstbx=myDialog.add("listbox");
myDialog.show();

/*********

It doesn't work.
Anybody can tell me why and give me some examples let it work?
TOPICS
Scripting
862
Translate
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 ,
Mar 11, 2008 Mar 11, 2008
I use type of 'window',not type of 'dialog'.
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
It does work, but it the window is displayed for the duration of the script. And as your script is pretty short, the window isn't going to stay on your screen very long. In this respect it "window"-type windows behave like palettes.

Peter
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
Hi,Peter,

Thanks for your reply.

How can I let the window stay on my screen long time?Can you give me some examples?

I can't use palettes type with JS in indesign .
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
>How can I let the window stay on my screen long time?

I guess that the window will stay on screen as long as the script is running -- just like a palette.

>I can't use palettes type with JS in indesign.

Why not?

Peter
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
Thanks,Peter,

My window can't stay on my screen for a long time,it only flashed short time.I don't know the reason.

Can you give me some examples like a 'pelette' or 'window'?

Best Regards

goldbridge
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
I use a message window (a palette) to display what a script is up to when it is running. A script that processes a bunch of files could display each file name in succession:

// create a message window
mess = create_mess (30, 'Example');
docs = // get a bunch of documents
for (i = 0; i < docs.length; i++)
{
app.open (docs);
// show the current file's name in the message window
mess.text = app.activeDocument.name;
...
...
app.activeDocument.close()
}

function create_mess (le, title)
{
dlg = new Window('palette', title);
dlg.alignChildren = ['left', 'top'];
var txt = dlg.add('statictext', undefined, '');
txt.characters = le;
dlg.show();
return txt
}
Translate
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 ,
Mar 12, 2008 Mar 12, 2008
Thanks Peter,I'll have a try!
Translate
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 ,
Mar 13, 2008 Mar 13, 2008
A new question!

I hope the "palette" always stay on my screen like a dialog,but I can't let it work so well.

I need a float window(it can switch to the application),but I can't get this effect.

My friends,anyone can give me the answer?
Translate
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
Guest
Mar 13, 2008 Mar 13, 2008
You're probably not using a persistent scripting engine.

If not, what ID does is start a new engine, run your script, then kill the engine. When this is the case, your window/palette will flash on the screen, but then your script ends, the engine is killed, and the window or palette goes away.

You must use a persistent scripting engine when using ScriptUI.

To do so, place these lines at the top of your script:

#target indesign
#targetengine "MyEngine"

Of course, MyEngine can be any name for your persistent scripting engine.

Regards

Bob
Translate
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 ,
Mar 13, 2008 Mar 13, 2008
LATEST
Hi,Bob

My friend,thanks a bunch.
Your answer is right and very detailed,my code does work great.

Best Regards.

Goldbridge
Translate
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