| Author |
Message |
graphophobic
Joined: 30 Apr 2005 Posts: 2
|
| Posted: Sat Apr 30, 2005 - 7:19 pm Post subject: Problems using widget.system |
|
|
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. |
|
| |
|
| |
toholio
Joined: 23 Apr 2005 Posts: 12
|
| Posted: Sat Apr 30, 2005 - 8:08 pm Post subject: |
|
|
| 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. |
|
| |
|
| |
graphophobic
Joined: 30 Apr 2005 Posts: 2
|
| Posted: Sat Apr 30, 2005 - 8:20 pm Post subject: |
|
|
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 |
|
| |
|
| |
toholio
Joined: 23 Apr 2005 Posts: 12
|
| Posted: Sat Apr 30, 2005 - 8:37 pm Post subject: |
|
|
| 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); |
|
| |
|
| |