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

widget.system working for anyone?

Author Message
hofo



Joined: 27 Mar 2005
Posts: 2

Posted: Sun Dec 12, 2004 - 12:12 pm    Post subject: Imported from The Dashboader Reply with quote

Hey, the new Developing Dashboard Widgets page (http://developer.apple.com/macosx/tiger/dashboard.html) says that there is now a widget.system call that allows you to make calls to the Unix system. Does this work for anyone? I get no output in the Dashboard, but in the Console I get an error: "TypeError - Undefined value".

If this does work for someone, do widget.system("pwd",null) and let me know what the output is. I'm interested in if the widget's current working directory is inside the bundle.
View user's profile Send private message Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Sun Dec 12, 2004 - 12:12 pm    Post subject: Imported from The Dashboader Reply with quote

I haven't been able to get it to work either.

Doign somethign like: alert(document.getElementById); shows in the console: [function]. Doing alert(widget.preferenceForKey); shows function preferenceForKey(). however, alerting widget.system just gives undefined. I tried chowning the widget to root, and still no luck :/

Maybe it's something we have to add to Info.plist in order to have access to it?

I found something a bit weird with widgets. Try something like:

Code:

if (document.getElementById) {
    alert('yup');
} else {
   alert('hope');
}


and you'll get 'yup' as expected. Change it to document.getElementBySomethingElse and you'll get 'nope'. As expected.

However, try it with if (widget.system) and it shows 'yup' (as I suppose we should expect), but then try it with widget.anythingelseyoucanthinkof and you still get 'yup'. Not quite expected.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
grabberslasher



Joined: 27 Mar 2005
Posts: 24

Posted: Sun Dec 12, 2004 - 12:12 pm    Post subject: Imported from The Dashboader Reply with quote

Err... you did set it to allow widget.system use in the Plist? Just checking...

That was one of the things I saw on the new video, 'tis pretty cool

Edit:
Just read your whole post Chris... oops. Yeah, you need to add the plist key. I'll give it to you later.
View user's profile Send private message Send e-mail Widgets
crapper_man
Guest





Posted: Sun Dec 12, 2004 - 12:12 pm    Post subject: Imported from The Dashboader Reply with quote

It doesn't seem to work... I've added AllowFullAcces to the plist, to no avail! Just for kicks, I've also added everything else, but still to no avail! Maybe some working sample code would be nice...
Widgets
grabberslasher



Joined: 27 Mar 2005
Posts: 24

Posted: Sun Dec 12, 2004 - 12:12 pm    Post subject: Imported from The Dashboader Reply with quote

Hmm... sounds weird...
View user's profile Send private message Send e-mail Widgets
Jeremy
Administrator


Joined: 27 Mar 2005
Posts: 62
Location: Melbourne, Australia

Posted: Fri Apr 01, 2005 - 6:35 pm    Post subject: Reply with quote

Moving to Widget Development...
View user's profile Send private message Send e-mail Visit poster's website Widgets
iremembercliford



Joined: 27 Mar 2005
Posts: 32

Posted: Sat Apr 02, 2005 - 11:25 pm    Post subject: Reply with quote

If all you want to do is find a working directory, you can access it through the plugin with NSBundle or NSWorkspace.
View user's profile Send private message Send e-mail Widgets
collin



Joined: 02 May 2005
Posts: 17

Posted: Tue May 03, 2005 - 2:29 am    Post subject: Re: Imported from The Dashboader Reply with quote

hofo wrote:
...If this does work for someone, do widget.system("pwd",null) and let me know what the output is. I'm interested in if the widget's current working directory is inside the bundle.


You need to call commands using their full path...
the_dir = widget.system("/bin/pwd", null);

Note that there is a 4 KB limit on the data returned from synchronous widget.system calls.
View user's profile Send private message 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