Forum Discussion

swati_nadage's avatar
swati_nadage
Contributor
10 years ago

Not able to click on button whose enabled proprty is false.

We have a button in our application whose enabled property is false hence not able to click on button. It's giving "The window is disabled. The action cannot be executed." I tried using keystrokes, ...
  • Ryan_Moran's avatar
    10 years ago

    There are a couple ways you could do this, but why on earth are you having it click a disabled window? :)

    Anyhow....you could try something like this...

     

    function main() {
      var object = //your button here
      clickobject(object);
    }
    
    function clickobject(object){
      var x = object.screenleft + (object.width / 2);
      var y = object.screentop + (object.height / 2);
      setparentfocus(object);
      LLPlayer.MouseDown(1, x, y, 0);
      LLPlayer.MouseUp(1, x, y, 0);
    }
    
    function setparentfocus(object) {
      while (object["parent"]) {
            if (propExists(object.parent, 'SetFocus')) {
                object.parent.SetFocus();
            }
            object = object.parent;
      }
    }