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

Bridge Script UI referenceError stringIDToTypeID is not a funtcion

Engaged ,
Nov 05, 2022 Nov 05, 2022

Copy link to clipboard

Copied

 

In Photoshop and Bridge, I am testing a script UI dialog.

In Photoshop the script UI displays correctly and remembers the radiobox and checkbox user values. 

In Bridge, the script UI dialog fails to display completely and throws a

refrecneError on line 192. stryingIDToTypeID is not a function

 

Can someone help me figure out how to avoid the referenceErorr ?

The idea is to display the dialog in Bridge with the last user settings.

 

Below are the two sample scripts for Photoshop and Bridge.

 

Photoshop script correct dialog

Screen Shot 2022-11-05 at 4.27.07 PM.png

 

 

 

 

#target photoshop;
// #include "../Hero__Functions-1.2.0.jsx";
// #include "../Hero__FileBuilderSettingsRead-5.2.2.jsx";

app.bringToFront();

cTID = function(s) { return cTID[s] || (cTID[s] = app.charIDToTypeID(s)); };
sTID = function(s) { return app.stringIDToTypeID(s); }; 

///////////////////////////////////////////////////////
// UI Dialog
///////////////////////////////////////////////////////

function showDialog () {

// DIALOG
// ======
var dialog = new Window("dialog"); 
  dialog.text = "Project Timeline"; 
  dialog.orientation = "row"; 
  dialog.alignChildren = ["left","top"]; 
  dialog.spacing = 10; 
  dialog.margins = 10; 

// GROUP1
// ======
var group1 = dialog.add("group", undefined, {name: "group1"}); 
  group1.orientation = "column"; 
  group1.alignChildren = ["left","top"]; 
  group1.spacing = 10; 
  group1.margins = 10; 
  group1.alignment = ["left","center"]; 

// GROUP2
// ======
var group2 = group1.add("group", undefined, {name: "group2"}); 
  group2.orientation = "row"; 
  group2.alignChildren = ["left","center"]; 
  group2.spacing = 10; 
  group2.margins = 0; 
  group2.alignment = ["fill","top"]; 

// PANEL1
// ======
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"}); 
  panel1.text = "Panel 1"; 
  panel1.orientation = "column"; 
  panel1.alignChildren = ["left","top"]; 
  panel1.spacing = 10; 
  panel1.margins = 10; 
  panel1.alignment = ["left","fill"]; 

  dialog.checkbox1 = panel1.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
  dialog.checkbox1.text = "Checkbox";
  dialog.checkbox1.value = checkbox1; 

  dialog.checkbox2 = panel1.add("checkbox", undefined, undefined, {name: "checkbox2"}); 
  dialog.checkbox2.text = "Checkbox";
  dialog.checkbox2.value = checkbox2; 

  dialog.checkbox3 = panel1.add("checkbox", undefined, undefined, {name: "checkbox3"}); 
  dialog.checkbox3.text = "Checkbox";
  dialog.checkbox3.value = checkbox3; 

// PANEL2
// ======
var panel2 = group2.add("panel", undefined, undefined, {name: "panel2"}); 
  panel2.text = "Panel 2"; 
  panel2.orientation = "column"; 
  panel2.alignChildren = ["left","top"]; 
  panel2.spacing = 10; 
  panel2.margins = 10; 
  panel2.alignment = ["left","fill"]; 

  dialog.radiobutton1 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton1"}); 
  dialog.radiobutton1.text = "RadioButton";
  dialog.radiobutton1.value = radiobutton1; 

  dialog.radiobutton2 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton2"}); 
  dialog.radiobutton2.text = "RadioButton";
  dialog.radiobutton2.value = radiobutton2; 

  dialog.radiobutton3 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton3"}); 
  dialog.radiobutton3.text = "RadioButton";
  dialog.radiobutton3.value = radiobutton3; 

// PANEL3
// ======
var panel3 = group2.add("panel", undefined, undefined, {name: "panel3"}); 
  panel3.text = "Panel 3"; 
  panel3.orientation = "column"; 
  panel3.alignChildren = ["left","top"]; 
  panel3.spacing = 10; 
  panel3.margins = 10; 
  panel3.alignment = ["left","fill"]; 

  dialog.radiobutton4 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton4"}); 
  dialog.radiobutton4.text = "RadioButton";
  dialog.radiobutton4.value = radiobutton4; 

  dialog.radiobutton5 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton5"}); 
  dialog.radiobutton5.text = "RadioButton";
  dialog.radiobutton5.value = radiobutton5; 

  dialog.radiobutton6 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton6"}); 
  dialog.radiobutton6.text = "RadioButton";
  dialog.radiobutton6.value = radiobutton6; 

  // GROUP3
  // ======
  var group3 = dialog.add("group", undefined, {name: "group3"}); 
  group3.orientation = "column"; 
  group3.alignChildren = ["left","top"]; 
  group3.spacing = 10; 
  group3.margins = 0; 

  var ok = group3.add("button", undefined, undefined, { name: "ok" });
  ok.text = "OK";

  var reset = group3.add("button", undefined, undefined, { name: "reset" });
  reset.text = "Reset";

  var cancel = group3.add("button", undefined, undefined, { name: "cancel" });
  cancel.text = "Cancel"; 


  //update the params and save them off on close
  function updateParams() {
    checkbox1 = dialog.checkbox1.value;
    checkbox2 = dialog.checkbox2.value;
    checkbox3 = dialog.checkbox3.value;
    radiobutton1 = dialog.radiobutton1.value;
    radiobutton2 = dialog.radiobutton2.value;
    radiobutton3 = dialog.radiobutton3.value;
    radiobutton4 = dialog.radiobutton4.value;
    radiobutton5 = dialog.radiobutton5.value;
    radiobutton6 = dialog.radiobutton6.value; 

  };

  reset.onClick = function() {
    dialog.checkbox1.value = false;
    dialog.checkbox2.value = false;
    dialog.checkbox3.value = false;
    dialog.radiobutton1.value = false;
    dialog.radiobutton2.value = false;
    dialog.radiobutton3.value = false;
    dialog.radiobutton4.value = false;
    dialog.radiobutton5.value = false;
    dialog.radiobutton6.value = false;
  }

  ok.onClick = function () {
    updateParams();
    saveSettings();
    dialog.close(1);
  };

  dialog.center();
  return dialog.show();

}

//showDialog()


///////////////////////////////////////////////////////
// UI Dialog Save Parameters
///////////////////////////////////////////////////////

  // Settings.
  var checkbox1 = false;
  var checkbox2 = false;
  var checkbox3 = false;
  var radiobutton1 = false;
  var radiobutton2 = false;
  var radiobutton3 = false;
  var radiobutton4 = false;
  var radiobutton5 = false;
  var radiobutton6 = false;

  //IDs for custom option saving / loading
  const settingsID = "exportOptions";

  const checkbox1ID = stringIDToTypeID("checkbox1");
  const checkbox2ID = stringIDToTypeID("checkbox2");
  const checkbox3ID = stringIDToTypeID("checkbox3");
  const radiobutton1ID = stringIDToTypeID("radiobutton1");
  const radiobutton2ID = stringIDToTypeID("radiobutton2");
  const radiobutton3ID = stringIDToTypeID("radiobutton3");
  const radiobutton4ID = stringIDToTypeID("radiobutton4");
  const radiobutton5ID = stringIDToTypeID("radiobutton5");
  const radiobutton6ID = stringIDToTypeID("radiobutton6");


  //try and load previous settings
  //var testDoc = app.activeDocument;
  var exportSettings;

  try {
    exportSettings = app.getCustomOptions(settingsID);
  } catch (e) {
    saveSettings();
  }

  if(typeof exportSettings == "undefined") {
    saveSettings();
  }


///////////////////////////////////////////////////////
// FUNCTIONS
///////////////////////////////////////////////////////

function loadSettings() {
  //alert('step 1b')
  // check for previously saved dialog options
  // exclude layer group name and feather value
  exportSettings = app.getCustomOptions(settingsID);

  if(exportSettings.hasKey (checkbox1ID))
  checkbox1 = exportSettings.getBoolean (checkbox1ID);

  if(exportSettings.hasKey (checkbox2ID))
  checkbox2 = exportSettings.getBoolean (checkbox2ID);

  if(exportSettings.hasKey (checkbox3ID))
  checkbox3 = exportSettings.getBoolean (checkbox3ID);


  if(exportSettings.hasKey (radiobutton1ID))
  radiobutton1 = exportSettings.getBoolean (radiobutton1ID);
  
  if(exportSettings.hasKey (radiobutton2ID))
  radiobutton2 = exportSettings.getBoolean (radiobutton2ID);

  if(exportSettings.hasKey (radiobutton3ID))
  radiobutton3 = exportSettings.getBoolean (radiobutton3ID);
  
  if(exportSettings.hasKey (radiobutton4ID))
  radiobutton4 = exportSettings.getBoolean (radiobutton4ID);

  if(exportSettings.hasKey (radiobutton5ID))
  radiobutton5 = exportSettings.getBoolean (radiobutton5ID);  

  if(exportSettings.hasKey (radiobutton6ID))
  radiobutton6 = exportSettings.getBoolean (radiobutton6ID);  

}

function saveSettings() {
  //save defaults
  var newExportSettings = new ActionDescriptor();
  newExportSettings.putBoolean (checkbox1ID, checkbox1);
  newExportSettings.putBoolean (checkbox2ID, checkbox2);
  newExportSettings.putBoolean (checkbox3ID, checkbox3);

  newExportSettings.putBoolean (radiobutton1ID, radiobutton1);
  newExportSettings.putBoolean (radiobutton2ID, radiobutton2);
  newExportSettings.putBoolean (radiobutton3ID, radiobutton3);
  newExportSettings.putBoolean (radiobutton4ID, radiobutton4);
  newExportSettings.putBoolean (radiobutton5ID, radiobutton5);
  newExportSettings.putBoolean (radiobutton6ID, radiobutton6);

  app.putCustomOptions(settingsID,newExportSettings,true);
}



//UI parameters
loadSettings();
var result = showDialog();

if(result != 2) {

  alert('test');

}





















 

 

 

 

Bridge script with referenceError

 

Screen Shot 2022-11-05 at 4.22.52 PM.png

 

 

 

 

#target bridge   

cTID = function(s) { return cTID[s] || (cTID[s] = app.charIDToTypeID(s)); };
sTID = function(s) { return app.stringIDToTypeID(s); }; 

if( BridgeTalk.appName == "bridge" ) {  
addInfo = new MenuElement("command", "Menu UI Test", "at the end of Tools");
}
addInfo .onSelect = function () { 
   myFunction();
}
function myFunction(){

   alert('Test')

///////////////////////////////////////////////////////
// UI Dialog
///////////////////////////////////////////////////////

function showDialog () {

   // DIALOG
   // ======
   var dialog = new Window("dialog"); 
     dialog.text = "Project Timeline"; 
     dialog.orientation = "row"; 
     dialog.alignChildren = ["left","top"]; 
     dialog.spacing = 10; 
     dialog.margins = 10; 
   
   // GROUP1
   // ======
   var group1 = dialog.add("group", undefined, {name: "group1"}); 
     group1.orientation = "column"; 
     group1.alignChildren = ["left","top"]; 
     group1.spacing = 10; 
     group1.margins = 10; 
     group1.alignment = ["left","center"]; 
   
   // GROUP2
   // ======
   var group2 = group1.add("group", undefined, {name: "group2"}); 
     group2.orientation = "row"; 
     group2.alignChildren = ["left","center"]; 
     group2.spacing = 10; 
     group2.margins = 0; 
     group2.alignment = ["fill","top"]; 
   
   // PANEL1
   // ======
   var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"}); 
     panel1.text = "Panel 1"; 
     panel1.orientation = "column"; 
     panel1.alignChildren = ["left","top"]; 
     panel1.spacing = 10; 
     panel1.margins = 10; 
     panel1.alignment = ["left","fill"]; 
   
     dialog.checkbox1 = panel1.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
     dialog.checkbox1.text = "Checkbox";
     dialog.checkbox1.value = checkbox1; 
   
     dialog.checkbox2 = panel1.add("checkbox", undefined, undefined, {name: "checkbox2"}); 
     dialog.checkbox2.text = "Checkbox";
     dialog.checkbox2.value = checkbox2; 
   
     dialog.checkbox3 = panel1.add("checkbox", undefined, undefined, {name: "checkbox3"}); 
     dialog.checkbox3.text = "Checkbox";
     dialog.checkbox3.value = checkbox3; 
   
   // PANEL2
   // ======
   var panel2 = group2.add("panel", undefined, undefined, {name: "panel2"}); 
     panel2.text = "Panel 2"; 
     panel2.orientation = "column"; 
     panel2.alignChildren = ["left","top"]; 
     panel2.spacing = 10; 
     panel2.margins = 10; 
     panel2.alignment = ["left","fill"]; 
   
     dialog.radiobutton1 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton1"}); 
     dialog.radiobutton1.text = "RadioButton";
     dialog.radiobutton1.value = radiobutton1; 
   
     dialog.radiobutton2 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton2"}); 
     dialog.radiobutton2.text = "RadioButton";
     dialog.radiobutton2.value = radiobutton2; 
   
     dialog.radiobutton3 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton3"}); 
     dialog.radiobutton3.text = "RadioButton";
     dialog.radiobutton3.value = radiobutton3; 
   
   // PANEL3
   // ======
   var panel3 = group2.add("panel", undefined, undefined, {name: "panel3"}); 
     panel3.text = "Panel 3"; 
     panel3.orientation = "column"; 
     panel3.alignChildren = ["left","top"]; 
     panel3.spacing = 10; 
     panel3.margins = 10; 
     panel3.alignment = ["left","fill"]; 
   
     dialog.radiobutton4 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton4"}); 
     dialog.radiobutton4.text = "RadioButton";
     dialog.radiobutton4.value = radiobutton4; 
   
     dialog.radiobutton5 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton5"}); 
     dialog.radiobutton5.text = "RadioButton";
     dialog.radiobutton5.value = radiobutton5; 
   
     dialog.radiobutton6 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton6"}); 
     dialog.radiobutton6.text = "RadioButton";
     dialog.radiobutton6.value = radiobutton6; 
   
     // GROUP3
     // ======
     var group3 = dialog.add("group", undefined, {name: "group3"}); 
     group3.orientation = "column"; 
     group3.alignChildren = ["left","top"]; 
     group3.spacing = 10; 
     group3.margins = 0; 
   
     var ok = group3.add("button", undefined, undefined, { name: "ok" });
     ok.text = "OK";
   
     var reset = group3.add("button", undefined, undefined, { name: "reset" });
     reset.text = "Reset";
   
     var cancel = group3.add("button", undefined, undefined, { name: "cancel" });
     cancel.text = "Cancel"; 
   
   
     //update the params and save them off on close
     function updateParams() {
       checkbox1 = dialog.checkbox1.value;
       checkbox2 = dialog.checkbox2.value;
       checkbox3 = dialog.checkbox3.value;
       radiobutton1 = dialog.radiobutton1.value;
       radiobutton2 = dialog.radiobutton2.value;
       radiobutton3 = dialog.radiobutton3.value;
       radiobutton4 = dialog.radiobutton4.value;
       radiobutton5 = dialog.radiobutton5.value;
       radiobutton6 = dialog.radiobutton6.value; 
   
     };
   
     reset.onClick = function() {
       dialog.checkbox1.value = false;
       dialog.checkbox2.value = false;
       dialog.checkbox3.value = false;
       dialog.radiobutton1.value = false;
       dialog.radiobutton2.value = false;
       dialog.radiobutton3.value = false;
       dialog.radiobutton4.value = false;
       dialog.radiobutton5.value = false;
       dialog.radiobutton6.value = false;
     }
   
     ok.onClick = function () {
       updateParams();
       saveSettings();
       dialog.close(1);
     };
   
     dialog.center();
     return dialog.show();
   
}
   
//showDialog()

   try {
         
      ///////////////////////////////////////////////////////
      // UI Dialog Save Parameters
      ///////////////////////////////////////////////////////

      // Settings.
      var checkbox1 = false;
      var checkbox2 = false;
      var checkbox3 = false;
      var radiobutton1 = false;
      var radiobutton2 = false;
      var radiobutton3 = false;
      var radiobutton4 = false;
      var radiobutton5 = false;
      var radiobutton6 = false;

      //IDs for custom option saving / loading
      const settingsID = "exportOptions";

      const checkbox1ID = stringIDToTypeID("checkbox1");
      const checkbox2ID = stringIDToTypeID("checkbox2");
      const checkbox3ID = stringIDToTypeID("checkbox3");
      const radiobutton1ID = stringIDToTypeID("radiobutton1");
      const radiobutton2ID = stringIDToTypeID("radiobutton2");
      const radiobutton3ID = stringIDToTypeID("radiobutton3");
      const radiobutton4ID = stringIDToTypeID("radiobutton4");
      const radiobutton5ID = stringIDToTypeID("radiobutton5");
      const radiobutton6ID = stringIDToTypeID("radiobutton6");


      //try and load previous settings
      //var testDoc = app.activeDocument;
      var exportSettings;

      try {
      exportSettings = app.getCustomOptions(settingsID);
      } catch (e) {
      saveSettings();
      }

      if(typeof exportSettings == "undefined") {
         saveSettings();
      }


      ///////////////////////////////////////////////////////
      // FUNCTIONS
      ///////////////////////////////////////////////////////

      function loadSettings() {
         //alert('step 1b')
         // check for previously saved dialog options
         // exclude layer group name and feather value
         exportSettings = app.getCustomOptions(settingsID);
      
         if(exportSettings.hasKey (checkbox1ID))
         checkbox1 = exportSettings.getBoolean (checkbox1ID);
      
         if(exportSettings.hasKey (checkbox2ID))
         checkbox2 = exportSettings.getBoolean (checkbox2ID);
      
         if(exportSettings.hasKey (checkbox3ID))
         checkbox3 = exportSettings.getBoolean (checkbox3ID);
      
      
         if(exportSettings.hasKey (radiobutton1ID))
         radiobutton1 = exportSettings.getBoolean (radiobutton1ID);
         
         if(exportSettings.hasKey (radiobutton2ID))
         radiobutton2 = exportSettings.getBoolean (radiobutton2ID);
      
         if(exportSettings.hasKey (radiobutton3ID))
         radiobutton3 = exportSettings.getBoolean (radiobutton3ID);
         
         if(exportSettings.hasKey (radiobutton4ID))
         radiobutton4 = exportSettings.getBoolean (radiobutton4ID);
      
         if(exportSettings.hasKey (radiobutton5ID))
         radiobutton5 = exportSettings.getBoolean (radiobutton5ID);  
      
         if(exportSettings.hasKey (radiobutton6ID))
         radiobutton6 = exportSettings.getBoolean (radiobutton6ID);  
      
      }
      
      function saveSettings() {
         //save defaults
         var newExportSettings = new ActionDescriptor();
         newExportSettings.putBoolean (checkbox1ID, checkbox1);
         newExportSettings.putBoolean (checkbox2ID, checkbox2);
         newExportSettings.putBoolean (checkbox3ID, checkbox3);
      
         newExportSettings.putBoolean (radiobutton1ID, radiobutton1);
         newExportSettings.putBoolean (radiobutton2ID, radiobutton2);
         newExportSettings.putBoolean (radiobutton3ID, radiobutton3);
         newExportSettings.putBoolean (radiobutton4ID, radiobutton4);
         newExportSettings.putBoolean (radiobutton5ID, radiobutton5);
         newExportSettings.putBoolean (radiobutton6ID, radiobutton6);
      
         app.putCustomOptions(settingsID,newExportSettings,true);
      }

   

      //UI parameters
      loadSettings();
      var result = showDialog();

      if(result != 2) {

      alert('test');

      }
         
   } catch (e) {
      alert(e + ' ' + e.line)
   }

}





 

 

 

 

TOPICS
Actions and scripting

Views

80

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Nov 06, 2022 Nov 06, 2022

I recommend downloading and reading the Bridge JavaScript Reference - https://developer.adobe.com/console/servicesandapis

 

In this case, we are not talking about ScriptUI, but about the special functions of Photoshop. They won't work in Bridge. If you want to write a script that works simultaneously in Photoshop and Bridge, then you should use another way to store settings - for example, writing to a text xml file.

 

You can also use BridgeTalk to get parameters and otherwise interact with Phot

...

Likes

Translate

Translate
Engaged ,
Nov 06, 2022 Nov 06, 2022

Copy link to clipboard

Copied

Following the reference error, I commented out the reference statements and got the UI dialog to display. The thing is that the UI does not retain the last used values.  

What can be done to achieve this functionality in a Bridge dialog UI?

 

Below is the Bridge script with the comments outlines and reference alert errors.

 

Screen Shot 2022-11-06 at 9.01.26 AM.png

Screen Shot 2022-11-06 at 9.10.42 AM.png

 

 

 

 

 

 

 

Screen Shot 2022-11-06 at 9.13.35 AM.png

Screen Shot 2022-11-06 at 9.36.23 AM.png

 

 

#target bridge   

cTID = function(s) { return cTID[s] || (cTID[s] = app.charIDToTypeID(s)); };
sTID = function(s) { return app.stringIDToTypeID(s); }; 

if( BridgeTalk.appName == "bridge" ) {  
addInfo = new MenuElement("command", "Menu UI Test", "at the end of Tools");
}
addInfo .onSelect = function () { 
   myFunction();
}
function myFunction(){

   alert('Test')

///////////////////////////////////////////////////////
// UI Dialog
///////////////////////////////////////////////////////

function showDialog () {

   // DIALOG
   // ======
   var dialog = new Window("dialog"); 
     dialog.text = "UI Test"; 
     dialog.orientation = "row"; 
     dialog.alignChildren = ["left","top"]; 
     dialog.spacing = 10; 
     dialog.margins = 10; 
   
   // GROUP1
   // ======
   var group1 = dialog.add("group", undefined, {name: "group1"}); 
     group1.orientation = "column"; 
     group1.alignChildren = ["left","top"]; 
     group1.spacing = 10; 
     group1.margins = 10; 
     group1.alignment = ["left","center"]; 
   
   // GROUP2
   // ======
   var group2 = group1.add("group", undefined, {name: "group2"}); 
     group2.orientation = "row"; 
     group2.alignChildren = ["left","center"]; 
     group2.spacing = 10; 
     group2.margins = 0; 
     group2.alignment = ["fill","top"]; 
   
   // PANEL1
   // ======
   var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"}); 
     panel1.text = "Panel 1"; 
     panel1.orientation = "column"; 
     panel1.alignChildren = ["left","top"]; 
     panel1.spacing = 10; 
     panel1.margins = 10; 
     panel1.alignment = ["left","fill"]; 
   
     dialog.checkbox1 = panel1.add("checkbox", undefined, undefined, {name: "checkbox1"}); 
     dialog.checkbox1.text = "Checkbox";
     dialog.checkbox1.value = checkbox1; 
   
     dialog.checkbox2 = panel1.add("checkbox", undefined, undefined, {name: "checkbox2"}); 
     dialog.checkbox2.text = "Checkbox";
     dialog.checkbox2.value = checkbox2; 
   
     dialog.checkbox3 = panel1.add("checkbox", undefined, undefined, {name: "checkbox3"}); 
     dialog.checkbox3.text = "Checkbox";
     dialog.checkbox3.value = checkbox3; 
   
   // PANEL2
   // ======
   var panel2 = group2.add("panel", undefined, undefined, {name: "panel2"}); 
     panel2.text = "Panel 2"; 
     panel2.orientation = "column"; 
     panel2.alignChildren = ["left","top"]; 
     panel2.spacing = 10; 
     panel2.margins = 10; 
     panel2.alignment = ["left","fill"]; 
   
     dialog.radiobutton1 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton1"}); 
     dialog.radiobutton1.text = "RadioButton";
     dialog.radiobutton1.value = radiobutton1; 
   
     dialog.radiobutton2 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton2"}); 
     dialog.radiobutton2.text = "RadioButton";
     dialog.radiobutton2.value = radiobutton2; 
   
     dialog.radiobutton3 = panel2.add("radiobutton", undefined, undefined, {name: "radiobutton3"}); 
     dialog.radiobutton3.text = "RadioButton";
     dialog.radiobutton3.value = radiobutton3; 
   
   // PANEL3
   // ======
   var panel3 = group2.add("panel", undefined, undefined, {name: "panel3"}); 
     panel3.text = "Panel 3"; 
     panel3.orientation = "column"; 
     panel3.alignChildren = ["left","top"]; 
     panel3.spacing = 10; 
     panel3.margins = 10; 
     panel3.alignment = ["left","fill"]; 
   
     dialog.radiobutton4 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton4"}); 
     dialog.radiobutton4.text = "RadioButton";
     dialog.radiobutton4.value = radiobutton4; 
   
     dialog.radiobutton5 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton5"}); 
     dialog.radiobutton5.text = "RadioButton";
     dialog.radiobutton5.value = radiobutton5; 
   
     dialog.radiobutton6 = panel3.add("radiobutton", undefined, undefined, {name: "radiobutton6"}); 
     dialog.radiobutton6.text = "RadioButton";
     dialog.radiobutton6.value = radiobutton6; 
   
     // GROUP3
     // ======
     var group3 = dialog.add("group", undefined, {name: "group3"}); 
     group3.orientation = "column"; 
     group3.alignChildren = ["left","top"]; 
     group3.spacing = 10; 
     group3.margins = 0; 
   
     var ok = group3.add("button", undefined, undefined, { name: "ok" });
     ok.text = "OK";
   
     var reset = group3.add("button", undefined, undefined, { name: "reset" });
     reset.text = "Reset";
   
     var cancel = group3.add("button", undefined, undefined, { name: "cancel" });
     cancel.text = "Cancel"; 
   
   
     //update the params and save them off on close
     function updateParams() {
       checkbox1 = dialog.checkbox1.value;
       checkbox2 = dialog.checkbox2.value;
       checkbox3 = dialog.checkbox3.value;
       radiobutton1 = dialog.radiobutton1.value;
       radiobutton2 = dialog.radiobutton2.value;
       radiobutton3 = dialog.radiobutton3.value;
       radiobutton4 = dialog.radiobutton4.value;
       radiobutton5 = dialog.radiobutton5.value;
       radiobutton6 = dialog.radiobutton6.value; 
   
     };
   
     reset.onClick = function() {
       dialog.checkbox1.value = false;
       dialog.checkbox2.value = false;
       dialog.checkbox3.value = false;
       dialog.radiobutton1.value = false;
       dialog.radiobutton2.value = false;
       dialog.radiobutton3.value = false;
       dialog.radiobutton4.value = false;
       dialog.radiobutton5.value = false;
       dialog.radiobutton6.value = false;
     }
   
     ok.onClick = function () {
       updateParams();
       saveSettings();
       dialog.close(1);
     };
   
     dialog.center();
     return dialog.show();
   
}
   
//showDialog()

   try {
         
      ///////////////////////////////////////////////////////
      // UI Dialog Save Parameters
      ///////////////////////////////////////////////////////

      // Settings.
      var checkbox1 = false;
      var checkbox2 = false;
      var checkbox3 = false;
      var radiobutton1 = false;
      var radiobutton2 = false;
      var radiobutton3 = false;
      var radiobutton4 = false;
      var radiobutton5 = false;
      var radiobutton6 = false;

      //IDs for custom option saving / loading
      const settingsID = "exportOptions";

      // const checkbox1ID = stringIDToTypeID("checkbox1");
      // const checkbox2ID = stringIDToTypeID("checkbox2");
      // const checkbox3ID = stringIDToTypeID("checkbox3");
      // const radiobutton1ID = stringIDToTypeID("radiobutton1");
      // const radiobutton2ID = stringIDToTypeID("radiobutton2");
      // const radiobutton3ID = stringIDToTypeID("radiobutton3");
      // const radiobutton4ID = stringIDToTypeID("radiobutton4");
      // const radiobutton5ID = stringIDToTypeID("radiobutton5");
      // const radiobutton6ID = stringIDToTypeID("radiobutton6");


      //try and load previous settings
      //var testDoc = app.activeDocument;
      var exportSettings;

      try {
      exportSettings = app.getCustomOptions(settingsID);
      } catch (e) {
      saveSettings();
      }

      if(typeof exportSettings == "undefined") {
         saveSettings();
      }


      ///////////////////////////////////////////////////////
      // FUNCTIONS
      ///////////////////////////////////////////////////////

      function loadSettings() {
         //alert('step 1b')
         // check for previously saved dialog options
         // exclude layer group name and feather value
         //exportSettings = app.getCustomOptions(settingsID);
      
         // if(exportSettings.hasKey (checkbox1ID))
         // checkbox1 = exportSettings.getBoolean (checkbox1ID);
      
         // if(exportSettings.hasKey (checkbox2ID))
         // checkbox2 = exportSettings.getBoolean (checkbox2ID);
      
         // if(exportSettings.hasKey (checkbox3ID))
         // checkbox3 = exportSettings.getBoolean (checkbox3ID);
      
      
         // if(exportSettings.hasKey (radiobutton1ID))
         // radiobutton1 = exportSettings.getBoolean (radiobutton1ID);
         
         // if(exportSettings.hasKey (radiobutton2ID))
         // radiobutton2 = exportSettings.getBoolean (radiobutton2ID);
      
         // if(exportSettings.hasKey (radiobutton3ID))
         // radiobutton3 = exportSettings.getBoolean (radiobutton3ID);
         
         // if(exportSettings.hasKey (radiobutton4ID))
         // radiobutton4 = exportSettings.getBoolean (radiobutton4ID);
      
         // if(exportSettings.hasKey (radiobutton5ID))
         // radiobutton5 = exportSettings.getBoolean (radiobutton5ID);  
      
         // if(exportSettings.hasKey (radiobutton6ID))
         // radiobutton6 = exportSettings.getBoolean (radiobutton6ID);  
      
      }
      
      function saveSettings() {
         //save defaults
         // var newExportSettings = new ActionDescriptor();
         // newExportSettings.putBoolean (checkbox1ID, checkbox1);
         // newExportSettings.putBoolean (checkbox2ID, checkbox2);
         // newExportSettings.putBoolean (checkbox3ID, checkbox3);
      
         // newExportSettings.putBoolean (radiobutton1ID, radiobutton1);
         // newExportSettings.putBoolean (radiobutton2ID, radiobutton2);
         // newExportSettings.putBoolean (radiobutton3ID, radiobutton3);
         // newExportSettings.putBoolean (radiobutton4ID, radiobutton4);
         // newExportSettings.putBoolean (radiobutton5ID, radiobutton5);
         // newExportSettings.putBoolean (radiobutton6ID, radiobutton6);
      
         //app.putCustomOptions(settingsID,newExportSettings,true);
      }

   

      //UI parameters
      loadSettings();
      var result = showDialog();

      if(result != 2) {

      alert('test');

      }
         
   } catch (e) {
      alert(e + ' ' + e.line)
   }

}






 

Likes

Translate

Translate

Report

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 ,
Nov 06, 2022 Nov 06, 2022

Copy link to clipboard

Copied

I recommend downloading and reading the Bridge JavaScript Reference - https://developer.adobe.com/console/servicesandapis

 

In this case, we are not talking about ScriptUI, but about the special functions of Photoshop. They won't work in Bridge. If you want to write a script that works simultaneously in Photoshop and Bridge, then you should use another way to store settings - for example, writing to a text xml file.

 

You can also use BridgeTalk to get parameters and otherwise interact with Photoshop.

Likes

Translate

Translate

Report

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
Engaged ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

LATEST

Thank you for the clarification. The UI needs to work on thr Bridge aapo only. I will search for a Bridge and XML aample script for reference.

Likes

Translate

Translate

Report

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