Re: Scripting in PiggyBank

From: Chung Le <chung_le_at_dslextreme.com>
Date: Thu, 01 Dec 2005 13:06:13 -0800

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.

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.

Cheers,
-- Chung --

>
>> However, there seems to be a synchronization problem. PiggyBank's
>> datacoin must wait until the new page has loaded before it can be
>> invoked. Is there a way in PiggyBank to tell it to wait for the
>> entire page to load before attempting to extracting data?
>
>
> Yes, we can do that but it is probably very tricky. In any case, I
> don't think we're going to fix that for now. Can your script do some
> polling until the data coin icon appears?
>
> David
>
>
>
Received on Thu Dec 01 2005 - 21:05:13 EST

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