Re: Scripting in PiggyBank

From: David Huynh <dfhuynh_at_csail.mit.edu>
Date: Thu, 01 Dec 2005 22:09:48 -0500

Chung Le wrote:

> David Huynh wrote:
>
>> Chung Le wrote:
>>
>>> David Huynh wrote:
>>>
>>>> I'm afraid you are the first to attempt this. Try to see if you can
>>>> access the browser's chrome window from within Chickenfoot.
>>>> "document" or "top" might be the right object. From there, maybe
>>>> you can access Piggy Bank's script function hooked to the onclick
>>>> event of the data coin icon, or that of the Browse Tidbits on This
>>>> Page menu command. Let us know what you find.
>>>>
>>> With help from the Chickenfoot, especially Rob Miller, I was able to
>>> get Chickenfoot to recognize Piggybank's datacoin!
>>
>>
>>
>> Awesome! Perhaps you could tell the rest of us how you did that!
>
>
> In order to get Chickenfoot to find the PiggyBank's datacoin icon in
> the status bar at the bottom right of the window, you need to use an
> undocumented way to get a reference to the entire browser window:
> cf._window
>
> The datacoin icon has an ID called "piggyBank-datacoin", so the
> following command gets the hold of it:
> datacoin = cf._window.document.getElementById("piggyBank-datacoin")
> The method click() supported by piggyBank-datacoin activates the data
> collection process. So to put it together, here are the two lines of
> code you need to activate PiggyBank from Chickenfoot:
> datacoin = cf._window.document.getElementById("piggyBank-datacoin")
> datacoin.click()
> Please note again that the cf._window is an documented feature, and it
> could go away soon. When it gets replaced with a more official way, I
> hope to report back with a new solution.

Cool, thanks!

>
> As mentioned below in this email thread, I still experience a
> synchronization problem where Chickenfoot and PiggyBank get into a
> race condition. Currently, I do not have any work around for it. I
> tried window.setTimeout but that didn't work. Anybody has any
> suggestions, please reply.

You have access to Piggy Bank's source code and you can modify the
installed version directly, too. You can modify the function in Piggy
Bank that shows the data coin icon to call some function that your
Chickenfoot script hooks into the window object. That way, your script
gets the notification when Piggy Bank has shown the data coin icon. Good
luck!

David
Received on Fri Dec 02 2005 - 03:05:21 EST

This archive was generated by hypermail 2.3.0 : Thu Aug 09 2012 - 16:39:18 EDT