Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Problems using widget.system

Author Message
graphophobic



Joined: 30 Apr 2005
Posts: 2

Posted: Sat Apr 30, 2005 - 7:19 pm    Post subject: Problems using widget.system Reply with quote

I'm trying to do something simple and display the output of a system call in a widget that I'm developing.

However I am constantly getting the following error in the Javascript console in Safari. "Can't find variable: widget undefined Line:0". I have added the AllowSystem key to the plist.

Background: I've taken the scroller sample widget, and I'm currently trying to add the system call to it. The system call is a straight copy from Apple's Doco. i.e. var output = widget.system("/usr/bin/id -un", null).outputString;
alert(output);

Can anybody offer any advice? My javascript knowledge is pretty limited.
View user's profile Send private message Send e-mail Widgets
toholio



Joined: 23 Apr 2005
Posts: 12

Posted: Sat Apr 30, 2005 - 8:08 pm    Post subject: Reply with quote

graphophobic wrote:
However I am constantly getting the following error in the Javascript console in Safari. "Can't find variable: widget undefined Line:0". I have added the AllowSystem key to the plist.


The "widget" object is only available when you're running the widget using dashboard. I.e. you can't use calls to "widget" when you're using Safari.

Also, Safari doesn't know or care about the plist.
View user's profile Send private message Send e-mail Widgets
graphophobic



Joined: 30 Apr 2005
Posts: 2

Posted: Sat Apr 30, 2005 - 8:20 pm    Post subject: Reply with quote

Sorry, should have added that it doesn't work in the Daskboard either. In Dashboard I don't get any useful feedback in the Console Log.

That said it isn't doing what I want, but at least it now shows the results in the console log. I don't know what I missed but it must have been something.

Thanks for the suggestion
View user's profile Send private message Send e-mail Widgets
toholio



Joined: 23 Apr 2005
Posts: 12

Posted: Sat Apr 30, 2005 - 8:37 pm    Post subject: Reply with quote

graphophobic wrote:
In Dashboard I don't get any useful feedback in the Console Log.


If you need to peek at the value of variables or results of expressions in dashboard call alert(), the output appears in the console log. Do something like alert("value of someVar is " + someVar);
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group