1 person found this helpful
The script even locks up InDesign ...
My guess is that your problem is related to the "modal" nature of the dialogs, that means users are locked out from clicking outside until the dialog is dismissed. As you found out, this only works once.
Can you eventually replace both "dialog" arguments with "palette" or "window" ? That way it works in ESTK, InDesign should behave the same way.
that is an interesting suggestion. I wonder why everything works as soon as the windows are palettes but not when they are dialogs.
The nature of the task at hand is modal so working with palettes is less than ideal. But unless someone can give me a hint as to how to do this with dialogs I shall go that route.
(I would love to understand the nuts and bolts here, though )
Apparently the layout manager gets confused when you call a modal
dialog a second time. I don't see any way around it off hand either.
You don't need to build the menu structure more than once though. Just
load it into a variable (or variables) the first time you need it, and
just use that variable when you construct the dialog the next time
But 20 seconds sounds like a long time either way. Are you sure
there's not a more efficient way of constructing that structure?
I don't really understand it but got lucky with my first tried workaround.
As you're having trouble with the menus, have you considered to first create a copy into plain JS and populate the tree from there? Ah, I see Harbs beat me with that idea. I remember that Ole's example script also took a similar time to walk the menus.
If the time is spent to populate the tree, then it might help if you only create the expanded parent nodes, and provide the others only on demand. The regular InDesign UI within palettes also works that way. ScriptUI may have a similar mechanism e.g. used by the data browser, so I'd watch out for a matching notification.
Very cool script! I like the idea very much indeed.
FWIW, You should be able to offer moving the entries around by
including an "up" and a "down" button which would internally change
the orders of the entries around...
glad you like it
I did not find anything like ListItem.move(). And without putting much thought into it the only idea I had to sort the list would be to duplicate and delete via script. That seemed so clumsy that I didn't want to put it in.
Have you got a better idea how to move list items?
Just use removeAll() and add them all back in in the correct order.
Very simple, and there's no noticeable time delay...
Nice script, Gerald! You can rmove the list and enter it agan, as Harbs said, but to move items up and down a list, you can also swap the selected item and the one one above or below it.
Peter I feel stupid. Of course. Thank you for pointing that out to me
I updated the zip in the mentioned post, in case anyone's interested.
Harbs, I save a lot of details in the list items themselves instead of maintaining an additional array. So removing all listitems would mean I lose e.g. the info which menu item is applied to which script.
So rebuilding the list would mean quite some changing of my datamodels. I will keep that in mind for future projects, though. Thank you
I like keeping the data separate, but to each his own.
If you want an easy way to associate list items with data objects, you
can add a "reference" property to the list items, and change that...