Skip to main content
bagonterman
Inspiring
December 31, 2012
Question

Auto Click your own button.

  • December 31, 2012
  • 1 reply
  • 1596 views

I have created a pallette with a button that I want to click when I drop a file to a folder from bridge.

I have tried something like this but it did not work. So I am wondering if it is possible?

var mySFolder=app.document.presentationPath.slice(44,61);

var myMacHotFolder=(Folder(["/Volumes/Hotfolders/xxxxx/xxxxxx+mySFolder+".pdf"]).exists);

var myClick=iButton.addEventListener('click', function(){var myItems =app.document.thumbnail.children.length-2;myCountText.text=parseInt(myCountText.text)+myItems;});

if(myMacHotFolder==true){myClick.click();}

obviosly this is not a working chunk but all the pieces are here. I am just wondering aside from .click() what might work to enitiate the click.

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
December 31, 2012

A button has an onClick() event listener so..

myButton.onClick = function(){

//do something

}

to click the button would be...

myButton.onClick();

bagonterman
Inspiring
January 1, 2013

Thanks Paul, I will give it a try tomorrow. I was close .click()  vs. onClick();.

bagonterman
Inspiring
January 2, 2013

Ok I tried it and I got the rainbow pinwheel. I had to force quit the program so I am not totally sure what is happening but it did not work like I had hoped.