Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 04:03
Show Gist options
  • Save kuyseng/2792123 to your computer and use it in GitHub Desktop.
Save kuyseng/2792123 to your computer and use it in GitHub Desktop.
javascript: indesign show dialog to open next file
function show_dialog(message, opened_number) {
// update it v 0.1.1
var defaultScriptPreference = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
var myDialog = app.dialogs.add({name:"Continue with another file or finish?",canCancel:true});
var all_messages = [];
with(myDialog){
with(dialogColumns.add()){
with(dialogRows.add()) {
with(dialogColumns.add()) {
with(dialogRows.add()) { staticTexts.add({staticLabel: "* Note:" }); };
with(dialogRows.add()) { staticTexts.add({staticLabel: "- To continue generate with other file click \"OK\" button" });};
with(dialogRows.add()) { staticTexts.add({staticLabel: "- To finish the task click \"Cancel\"." }); };
with(dialogRows.add()) {
staticTexts.add({staticLabel: "You have finished generate with " + opened_number + " files as below: " });
};
};
};
with(dialogRows.add()) {
all_messages = message.split("\n");
with(borderPanels.add()) {
with(dialogColumns.add()) {
for (var i = 0, len = all_messages.length; i<len; i++) {
with(dialogRows.add({minWidth:400})) {
staticTexts.add({staticLabel: (i+1) +". " + all_messages[i] });
};
};
with(dialogRows.add({})) {staticTexts.add({minWidth:300})}; // for decorating
};
};
};
};
};
var myResult = myDialog.show();
var defaultScriptPreference = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = defaultScriptPreference;
myDialog.destroy();
return myResult;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment