7 Replies Latest reply on Aug 5, 2014 2:12 AM by Dapeamel

    Problem with create a folder

    Dapeamel Level 1

      Hello guys,

       

      I wrote this code

       

      
      
      var myWindow = new Window ("dialog","Laredoute Strukturskapare");
      myWindow.orientation = "column";
      
      myWindow.add ("statictext", undefined, "write a number (example:342344)");
      var Jobnr = myWindow.add ("edittext", undefined, "");
      Jobnr.active = true;
      Jobnr.characters =40;
      
      
      
      myWindow.add ("button", undefined, "OK");
      myWindow.add ("button", undefined, "Avbryt");
      
      
      new Folder("/xxxx/xxx/xxx/" + Jobnr+ "/testcreatefolder").create(); ;   
      
      myWindow.show ();
      
      
      
      
      
      

       

      the problem is, the script creates a folder on correct location but the folder name is "[object EditText]"

       

      Could someone help me to correct the code?

       

      Thank you in advance

        • 1. Re: Problem with create a folder
          Chinnadk Level 4

          Modified

           

          var myWindow = new Window ("dialog","Laredoute Strukturskapare");
          myWindow.orientation = "column";
          
          myWindow.add ("statictext", undefined, "write a number (example:342344)");
          var Jobnr = myWindow.add ("edittext", undefined, "");
          Jobnr.active = true;
          Jobnr.characters =40;
          
          var ok = myWindow.add ("button", undefined, "OK");
          ok.onClick = function ()
          {
                  new Folder("/xxxx/xxx/xxx/" + Jobnr.text+ "/testcreatefolder").create();
              }
          myWindow.add ("button", undefined, "Avbryt");
          myWindow.show ();
          
          
          • 2. Re: Problem with create a folder
            Dapeamel Level 1

            the code is almost working

            just problem

             

            when I press "OK" or "Avbryt" nothing happens why?

             

            if I press ok then it creates the folder.

            if I press Avryt =cancel + close prompt

            • 3. Re: Re: Problem with create a folder
              Chinnadk Level 4

              Try this.

               

              var myWindow = new Window ("dialog","Laredoute Strukturskapare"); 
              myWindow.orientation = "column"; 
              
              myWindow.add ("statictext", undefined, "write a number (example:342344)"); 
              var Jobnr = myWindow.add ("edittext", undefined, ""); 
              Jobnr.active = true; 
              Jobnr.characters =40; 
              
              var ok = myWindow.add ("button", undefined, "OK"); 
              ok.onClick = function () 
              { 
                      new Folder("/xxxx/xxx/xxx/" + Jobnr.text+ "/testcreatefolder").create(); 
                      myWindow.close();
                  } 
              var Avbryt = myWindow.add ("button", undefined, "Avbryt"); 
              Avbryt.onClick = function ()
              {
                      myWindow.close();
                  }
              myWindow.show ();
              

               

              Regards,

              Chinna

              • 4. Re: Problem with create a folder
                Sajeev Sridharan Level 4

                var canc = myWindow.add ("button", undefined, "Avbryt"); 

                canc.onClick = function () 

                        myWindow.close(); 

                    } 

                myWindow.show ();

                 

                Vandy

                • 5. Re: Problem with create a folder
                  Dapeamel Level 1

                  it works like a charm but when I press ok the prompt its still there,

                  is it possible to make the prompt is closing too? but it still creating  the folder

                   

                  Thank you in advance.

                  • 6. Re: Problem with create a folder
                    Sajeev Sridharan Level 4

                    var ok = myWindow.add ("button", undefined, "OK"); 

                    ok.onClick = function () 

                            new Folder("/xxxx/xxx/xxx/" + Jobnr.text+ "/testcreatefolder").create();

                            myWindow.close(); 

                        } 

                    • 7. Re: Problem with create a folder
                      Dapeamel Level 1

                      Thank you guys all are solved!!!