Keith, we don't have the feature to get a result from executeScript()
yet, but you can workaround by having the script you execute send a
message back to the extension. For details, see:

http://code.google.com/chrome/extensions/messaging.html

- a

On Tue, Nov 24, 2009 at 3:34 PM, Nick Baum <nickb...@chromium.org> wrote:
> +chromium-extensions
>
> On Tue, Nov 24, 2009 at 3:28 PM, Keith Cirkel <keitha...@gmail.com> wrote:
>>
>> It wasn't for me at least... which is why I came to here.
>> On a similar note to my first problem, how I can I get a variable from the
>> executed script to the callback function? What I want to do is something
>> like execudeScript(tab.id,{code:'var i=10;'},function(i){console.log(i));
>> and it be 10. Is that possible?
>>
>> On Tue, Nov 24, 2009 at 11:23 PM, Nick Baum <nickb...@google.com> wrote:
>>>
>>> Is there any way we can make these errors point to the actual file & line
>>> where the error occurred?
>>> chrome/ExtensionProcessBindings:54 isn't very helpful...
>>> -Nick
>>>
>>> On Tue, Nov 24, 2009 at 2:17 PM, Erik Kay <erik...@chromium.org> wrote:
>>>>
>>>> (apologies for resend)
>>>> Your call to executeScript should use tab.id (an integer), not tab (an
>>>> object).
>>>> Erik
>>>>
>>>> On Tue, Nov 24, 2009 at 12:03 PM, Keithamus <keitha...@gmail.com> wrote:
>>>>>
>>>>> As the title suggests, I am trying to find a way to fill all of the
>>>>> password boxes on a page, while in a browser action. From what I can
>>>>> see the best way to do this is using chrome.tabs.executeScript();
>>>>>
>>>>> I'll show you my code so far:
>>>>>
>>>>> var script =
>>>>>                                        var script = function() {
>>>>>                                                var forms,i,form,n;
>>>>>                                                f = document.forms;
>>>>>                                                for(n=0; n<forms.length;
>>>>> ++n) {
>>>>>                                                        form = forms[n];
>>>>>                                                        for (i=0;
>>>>> i<form.length; ++i) {
>>>>>                                                                if
>>>>> (form[i].type.toLowerCase() == 'password') {
>>>>>
>>>>>  form[i].value=Passwd;
>>>>>                                                                }
>>>>>                                                        }
>>>>>                                                }
>>>>>                                        }
>>>>>
>>>>>
>>>>>  chrome.tabs.getSelected(null,function(tab) {
>>>>>
>>>>>  chrome.tabs.executeScript(tab,{code:script,allFrames:true})
>>>>>                                        });
>>>>>
>>>>> When I run this I get the following:
>>>>>
>>>>> Uncaught Error: Invalid value for argument 0. Expected 'integer' but
>>>>> got 'object'    chrome/ExtensionProcessBindings:54
>>>>>
>>>>> Which is infuriating as it tells me nothing.
>>>>>
>>>>> Am I just noobing this, or am I on the right path? If people could
>>>>> point me in the right direction that'd be great. Cheers
>>>>>
>>>>> --
>>>>>
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Chromium-extensions" group.
>>>>> To post to this group, send email to
>>>>> chromium-extensi...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> chromium-extensions+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/chromium-extensions?hl=en.
>>>>>
>>>>>
>>>>
>>>> --
>>>>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Chromium-extensions" group.
>>>> To post to this group, send email to
>>>> chromium-extensi...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> chromium-extensions+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/chromium-extensions?hl=en.
>>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensi...@googlegroups.com.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to