2 Replies Latest reply on Apr 21, 2016 6:06 PM by Matt Finlay

    Display path of chosen folder as statictext

    Matt Finlay Level 1

      Hi All,

       

      I'm trying to display a path to the chosen folder in some static text. But it does not seem to update the text.

       

      according to this the text property should be r/w...

       

      Can anyone see what i am doing wrong?

       

      var myWindow = new Window('dialog', 'Output Window');

      myWindow.orientation = 'column';

      myDocument = null;

      myDocument = app.activeDocument;

      var myDocName = myDocument.name;

      myDocName =  myDocName.replace('.indd', '');

      var myOutputPath;

      var myDecodedOutputPath;

      try

      {

          myOutputPath = app.activeDocument.filePath;

          myDecodedOutputPath = Folder.decode (myOutputPath);

      }

      catch (e)

      {

          myOutputPath = Folder.selectDialog ("Select a folder");

          myDecodedOutputPath = Folder.decode (myOutputPath);

      }

      var myGroup = myWindow.add('group');

      myGroup.orientation = 'column';

      myGroup.alignChildren = 'left';

      var myButtonGroup = myWindow.add('group');

      myWindow.outputPathTextLabel = myGroup.add('statictext', undefined, 'Save Location:'); 

      myWindow.outputPath = myGroup.add('statictext', undefined, myDecodedOutputPath); 

      myWindow.changeSaveLocationButton = myGroup.add('button', undefined, 'Change Save Location'); 

      // CHANGE THE SAVE LOCATION ON BUTTON CLICK

      myWindow.changeSaveLocationButton.onClick = function()

      {

          myOutputPath = Folder.selectDialog("Select a folder");

          myDecodedOutputPath = Folder.decode (myOutputPath);

          myWindow.outputPath.text = myDecodedOutputPath;

          alert(myDecodedOutputPath);

      }

      myWindow.buttonOK = myButtonGroup.add('button', [0,0,150,20], 'Cancel'); 

      myWindow.buttonCancel = myButtonGroup.add('button', [0,0,150,20], 'OK');

      shownWindow = myWindow.show();

       

       

      Thanks!