3 Replies Latest reply on Oct 21, 2010 3:05 AM by tansk02

    Need fullpath for selected file in editbox

    tansk02

      Hi All,

       

      I've created below script. It is working fine.

       

      Here is my question:

       

      When I select my folder my edit box show my selected folder full path.

       

      Please help me.

       

      Thanks in advance.

       

       

      var myDialog = new Window('dialog',);

      myDialog.myPanel4 = myDialog.add('panel');

                myDialog.myPanel4.helpTip = "Choose text file";

                myDialog.myPanel4.Group15 = myDialog.myPanel4.add('group',undefined);

                myDialog.myPanel4.Group15.EditText5 = myDialog.myPanel4.Group15.add('edittext',undefined,"/mytextfile");

                myDialog.myPanel4.Group15.EditText5.preferredSize.width = 400;

                myDialog.myPanel4.Group15.Button5 = myDialog.myPanel4.Group15.add('button',undefined,"Select");

      myDialog.myPanel4.Group15.Button5.onClick = function ()

      {

      Folder.selectDialog ("Choose my text file");

      var myfilePath

      myfilePath=Folder.selectDialog

      }

      myDialog.show()

        • 1. Re: Need fullpath for selected file in editbox
          Marijan Tompa [tomaxxi] Level 4

          Hey!

           

          Try this:

           

          var myDialog = new Window('dialog',);
          myDialog.myPanel4 = myDialog.add('panel');
                    myDialog.myPanel4.helpTip = "Choose text file";
                    myDialog.myPanel4.Group15 = myDialog.myPanel4.add('group',undefined);
                    myDialog.myPanel4.Group15.EditText5 = myDialog.myPanel4.Group15.add('edittext',undefined,"/mytextfile");
                    myDialog.myPanel4.Group15.EditText5.preferredSize.width = 400;
                    myDialog.myPanel4.Group15.Button5 = myDialog.myPanel4.Group15.add('button',undefined,"Select");
          myDialog.myPanel4.Group15.Button5.onClick = function ()
          {
              var myfilePath = Folder.selectDialog();
              if(myfilePath != null)myDialog.myPanel4.Group15.EditText5.text = myfilePath.fsName;
          }
          myDialog.show();

           

          Also, I suggest you to rewrite your script, it's really messy!

           

          Hope that helps.

           

          --

          tomaxxi

          http://indisnip.wordpress.com/

          • 2. Re: Need fullpath for selected file in editbox
            Marijan Tompa [tomaxxi] Level 4

            OK, I changed it little bit

             

            var myDialog = new Window('dialog', 'Choose text file');
            var myPanel = myDialog.add('panel');
            var myTextField = myPanel.add('edittext',undefined,"/mytextfile");
            var myBrowse = myPanel.add('button',undefined,"Select...");

            myPanel.orientation = 'row';
            myPanel.helpTip = "Choose text file";
            myTextField.preferredSize = [400,20];

            myBrowse.onClick = function (){
                var myfilePath = Folder.selectDialog();
                if(myfilePath != null)myTextField.text = myfilePath.fsName;
            }

             

            myDialog.center();

            myDialog.show();

             

            Hope that helps.

             

            --

            tomaxxi

            http://indisnip.wordpress.com/

            • 3. Re: Need fullpath for selected file in editbox
              tansk02 Level 1

              Hi Tomaxxi,

               

              Thanx a ton for your correct answer and advice.

               

              you are such a great & talented guy.