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 Design

help with osascript and dashboard dev

Author Message
wififun



Joined: 09 May 2005
Posts: 1

Posted: Mon May 09, 2005 - 4:50 pm    Post subject: help with osascript and dashboard dev Reply with quote

This my be just my lack of understanding of java script, but I need a little assistance. A widget I am working on runs a small apple script to access content from another app. Using osascript to do this is pretty straightforward. What is not, however, is how to get a result back from it. Example: running an one line osascript from the command line returns a comma separated list of items from the running app. I need to get this list back, and can't figure it out. It will eventually populate a drop down form list, but I think I have that part figured out.
I looked at the itunes widget, but it seems to access iTunes via a method other than applescript, so it did me little good.
View user's profile Send private message Send e-mail Widgets
ryand



Joined: 14 May 2005
Posts: 8
Location: Rochester

Posted: Mon May 16, 2005 - 12:12 am    Post subject: Reply with quote

var obj = widget.system("ps -aux | grep Dashboard", null);
alert(obj.outputString);

That should do the trick Smile
_________________
Thanks
RyanD
http://www.rit.edu/~rpd9803/showTime/
View user's profile Send private message Send e-mail AIM Address Widgets
Chris



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

Posted: Mon May 16, 2005 - 6:15 am    Post subject: Reply with quote

Ryan, I think he meant to get the stuff from AppleScript to such a way that you can see it in outputString - as in, getting it to stdout.

I'm not much of an AppleScripter, but a quick way I found of doing it was to just use

Code:

do shell script "echo " & variable


or whatever it is. I imagine someone will show us a better solution, but that's how I did it for my iChat widget in the VS widget pack.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
johnpenn



Joined: 29 May 2005
Posts: 5
Location: RI

Posted: Mon May 30, 2005 - 11:12 am    Post subject: Reply with quote

probably a bit late, but here's what I found works with Hula Girl:

Code:
var isPlaying = widget.system("/usr/bin/osascript itunesrunning.scpt", null).outputString;


note that itunesrunning.scpt resides at the root of the widget.
View user's profile Send private message Send e-mail Visit poster's website 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