2 Replies Latest reply: May 12, 2011 4:30 AM by John.Kordas RSS

    CS3 JS Running an JS within an Action?

    John.Kordas Community Member

      I realize that I can create a script that will through an alert as shown below and can be created as an action. So the process would be to run the action and the script will display the alert. If the user clicks the Yes button the script would run the next action. If they click No than the process would stop to allow the user to fix the issue.

       

      var myDialog = new Window('dialog', ' Details');
      myDialog.fDetails = myDialog.add('panel',undefined,'Has this file been processed correctly?');
      myDialog.fDetails.Btngroup = myDialog.fDetails.add('group');
      myDialog.fDetails.Btngroup.orientation = 'row';
      myDialog.fDetails.Btngroup.Ybtn = myDialog.fDetails.Btngroup.add('button', undefined, 'Yes');
      myDialog.fDetails.Btngroup.Nbtn = myDialog.fDetails.Btngroup.add('button', undefined, 'No');
      myDialog.fDetails.Btngroup.Ybtn.onClick = function() {
          //continue and run this action
          }
      myDialog.fDetails.Btngroup.Nbtn.onClick = function(){
         //does these changes
      }

       

      Would it be possible to add a script within an action and so if the result of the alert is Yes continue with the action is the result is No stop the action.

       

      Cheers, John.

        • 1. Re: CS3 JS Running an JS within an Action?
          c.pfaffenbichler Community Member

          I don’t know for sure.

          If you were to split the Action and end the first one with a Script that starts the second Action only on OK of its dialog that might be an option.

           

          But I think such a choice within an operation would best be done fully in the Script.

           

          Why do you use Actions in this case?

          • 2. Re: CS3 JS Running an JS within an Action?
            John.Kordas Community Member

            I do agree the logical process would be to have the entire process in a script.  What I'm doing is putting a workflow process in before an action the guys here use. Rather than take away the ability for them to adjust the action currently used, as they would not be able to edit the JS I thought having both could work. The work around has been to create an action from the JS that if they click on the Yes then the script will call the next action. I would of liked to have the users only click on one action and not risk then going to the second action first which checks the workflow.