0 Replies Latest reply on Jan 8, 2009 5:27 PM by (ABC_GREEN)

    JS CS4  Wait for menu item to close

      I am trying to open a dialog in indesign and continue my work after dialog was closed

      in vbs my code looks like this and works perfectly

      myMenu.invoke [opens Indesign Dialog]
      On error resume next
      do
      err.clear
      myIndesign.myFunction(variable1,variable2)
      loop while err.Number <> 0 [error while dialog is open andexicutes when dialog closes]
      On error Goto 0

      in js my codelooks like this

      myMenu.invoke [opens Indesign Dialog]
      var noError = false;
      do{
      noError = false;
      try{
      app.myFunction(variable1,variable2);
      }catch(err){
      noError = true;
      }while(noError==false)

      it would work but indesign dialog is not editable.

      it seems that vbs runs on seperate thread while js runs on indesigns thread.

      I tried addin sleep time into loop but it didn't help.
      my js uses its own #engine, if that makes a differance. Would it help if #engine used to invoke menu item was not mine? and would that be possible to maybe call a different js file which has its own engine.

      I need it for mac compatability. maybe applescript would solve my problem but I cant figure out how to loop and how to call function with to integer parameters

      Thank for any and all help.
      ABC GREEN