Advertisement
SturmB

Output data-gathering ScriptUI window

Nov 5th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var outputData = new Window("dialog", windowTitle);
  2.     outputData.orientation = "stack";
  3.     outputData.margins = 0;
  4.     var bgImagePrefix = artDeptFolderPrefix + "Product Templates/references/";
  5.     var bgImage = outputData.add("image", undefined, File(bgImagePrefix + "Job_Output_3.00.jpg"));
  6.     var stackGroup = outputData.add("group");
  7.         stackGroup.margins = [0, 48, 0, 0];
  8.         stackGroup.alignment = ["", "top"];
  9.         stackGroup.alignChildren = ["", "top"];
  10.         var textPanel = stackGroup.add("panel");
  11.             textPanel.orientation = "row";
  12.             textPanel.alignChildren = ["", "bottom"];
  13.             var staticGroup = textPanel.add("group");
  14.                 staticGroup.orientation = "column";
  15.                 staticGroup.alignChildren = "right";
  16.                 staticGroup.spacing = 16;
  17.                 staticGroup.graphics.foregroundColor = staticGroup.graphics.newPen(outputData.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);
  18.                 staticGroup.add("statictext", undefined, "&Order Number:");
  19.                 staticGroup.add("statictext", undefined, "&Ship Date:");
  20.                 staticGroup.add("statictext", undefined, "&Initials:");
  21.                 staticGroup.add("statictext", undefined, "Ove&rruns?");
  22.             var editGroup = textPanel.add("group");
  23.                 editGroup.orientation = "column";
  24.                 editGroup.alignChildren = "left";
  25.                 var orderNumText = editGroup.add("edittext");
  26.                     orderNumText.characters = 8;
  27.                     orderNumText.active = true;
  28.                     orderNumText.onChange = function ()
  29.                     {
  30.                         if (!/\b\d{6}\b/.test(orderNumText.text) && !/\bP\d{5}\b/i.test(orderNumText.text) && orderNumText.text != "")
  31.                         {
  32.                             // If the entered text does not contain exactly 6 digits.
  33.                             alert("The order number does not appear to conform to a standard order number.\n Please fix and try again.");
  34.                         }
  35.                         okButton.enabled = ifFieldsFilled();
  36.                     }
  37.                 var shipDateText = editGroup.add("edittext");
  38.                     shipDateText.characters = 8;
  39.                     shipDateText.onChange = function ()
  40.                     {
  41.                         dateValid = isDateValid();
  42.                         okButton.enabled = ifFieldsFilled();
  43.                     }
  44.                 var initialsText = editGroup.add("edittext");
  45.                     initialsText.characters = 3;
  46.                     initialsText.onChanging = function ()
  47.                     {
  48.                         okButton.enabled = ifFieldsFilled();
  49.                     }
  50.                     initialsText.onChange = function ()
  51.                     {
  52.                         okButton.enabled = ifFieldsFilled();
  53.                     }
  54.                 var overRunsBox = editGroup.add("checkbox");
  55.         var buttonGroup = stackGroup.add("group");
  56.             buttonGroup.orientation = "column";
  57.             var okButton = buttonGroup.add("button", undefined, "OK", {name: "ok"});
  58.                 okButton.enabled = ifFieldsFilled();
  59.             var cancelButton = buttonGroup.add("button", undefined, "Cancel", {name: "cancel"});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement