title: How do I Wait With Extends Script (Adobe)
body: <p>i'm currently working on an extends script which is the technology that we can use to create extension for adobe softwares, its a javascript similar script language
  Im working on a script to automate some boring and repetitive tasks</p>
  <p>Here is my problem i've to wait the creation of a bin before use a variable which call this bin but i can't, i tried</p>
  <p>.then( Promise =&gt; { //Some Code }) ; setTimeout(Function(), time); nothing is working</p>
  <p>Can someone help me please ?
  Here is my code</p>
  <pre class="lang-js prettyprint-override"><code>    root = app.project.rootItem
      newFilesPath = &quot;Path&quot;
      newFilesBin = root.children[0]
      
      app.project.importFiles(newFilesPath, true, newFilesBin, false)
      
      app.project.save()
      
      for(i=0; i&lt;newFilesBin.children.numItems; i++){  //here is the problem it tells me that
          newFile = newFilesBin.children[i]            //newFilesBin is null, i think he has not the 
                                                       //time to create the file and then to put it 
                                                       //in the variable
          name = newFile.name
      
          newTiktokBin = root.createBin(name)
      
          root.children[i].children[0].moveBin(newTiktokBin)
      }
  
  </code></pre>