8 Replies Latest reply on Dec 23, 2014 4:36 AM by Bernd Alheit

    code for select ok button

    pauloxoxe Level 1

      I have a javascript that applies a security police but it opens a confirmation dialog.

      What kind of javascript code can i use to automatically select the OK button.

       

      Can anyone help me?

       

      here's the script:

       

      var ApplySecurity = app.trustedFunction(

      function()

      {

      var oMyPolicy = null;

      var sPolicyName = "mySecurityPolice"; // my policy name

      app.beginPriv();

       

      // First, Get the ID of mySecurityPolice security policy

      var aPols = security.getSecurityPolicies();

       

      for(var i=0; i<aPols.length; i++)

      {

           if(aPols[i].name == sPolicyName)

           {

                oMyPolicy = aPols[i];

                break;

           }

      }

       

      if(oMyPolicy != null)

      {

           // Now, Apply the security Policy

           var rtn = this.encryptUsingPolicy({oPolicy: oMyPolicy });

       

            if(rtn.errorCode != 0)

            {

                 // Print error message into JavaScript Debugger Console

                 console.println("Security Error: " + rtn.errorText);

            }

      }

       

      app.endPriv();

      });

       

      ApplySecurity();