Author Topic: Need Mac Guru  (Read 1822 times)

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Need Mac Guru
« on: September 11, 2009, 01:31:59 PM »
I'm teaching myself a little applescripting, and I've hit a roadblock.  I need a way to extract speakable text from an rss feed.  For example if I open this feed http://rss.weather.com/weather/rss/local/75409?cm_ven=LWO&cm_cat=rss&par=LWO_rss in netnewswire there is a headline called Current Weather Conditions in Anna, TX (75409).  Under this headline there is a window with the text: Cloudy, and 77 ° F. For more details? if I could get just this text into a variable I know how to perform the operations that would allow text to speech to return an understandable response. 

I've tried using an FBA called parserTools but it returns a variable with the class "key value list" which I haven't been able to figure out how to use.  I've also tried scripting netnewswire but I can only find a way of calling currently selected headlines, and I don't want to have to do any gui scripting.

Any ideas?

Online ehowton

  • Colonel COURAGEOUS Member
  • *********
  • Posts: 7704
  • Fingering the Muse
    • http://ehowton.livejournal.com
Re: Need Mac Guru
« Reply #1 on: September 11, 2009, 01:40:25 PM »
What about an app?  You can configure WeatherDock to 'speak' the weather at set intervals.

Offline drax0r

  • Major FANTASTIC Member
  • *******
  • Posts: 3481
  • Muckraker Extraordinaire
    • Anna Texas Community Forum
Re: Need Mac Guru
« Reply #2 on: September 11, 2009, 01:47:48 PM »
What about an app?  You can configure WeatherDock to 'speak' the weather at set intervals.

E, you've become one of "those people"
Everything I say, do, imply, or infer is the sole representation and responsibility of the individual who owns this account and does not represent the opinion, policy, position, or intent of any organization or other entity, public or private.

Online ehowton

  • Colonel COURAGEOUS Member
  • *********
  • Posts: 7704
  • Fingering the Muse
    • http://ehowton.livejournal.com
Re: Need Mac Guru
« Reply #3 on: September 11, 2009, 01:54:13 PM »
Dude - have you ever used applescript?  It ain't bash.

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Re: Need Mac Guru
« Reply #4 on: September 11, 2009, 01:57:22 PM »
What about an app?  You can configure WeatherDock to 'speak' the weather at set intervals.

That could work, except WeatherDock has no scripting dictionary which I think means we're back to GUI scripting right?

should I be teaching myself bash and not applescript?

Offline drax0r

  • Major FANTASTIC Member
  • *******
  • Posts: 3481
  • Muckraker Extraordinaire
    • Anna Texas Community Forum
Re: Need Mac Guru
« Reply #5 on: September 11, 2009, 02:00:31 PM »
Dude - have you ever used applescript?  It ain't bash.

No, what I'm saying is that you've become one of those people who, in reply to someone looking for help for a specific problem, question why they're trying to do the thing they're trying to do in the first place rather than taking an entirely different approach.

If I'm not mistaken, that's always been one of your pet peeves.
Everything I say, do, imply, or infer is the sole representation and responsibility of the individual who owns this account and does not represent the opinion, policy, position, or intent of any organization or other entity, public or private.

Online ehowton

  • Colonel COURAGEOUS Member
  • *********
  • Posts: 7704
  • Fingering the Muse
    • http://ehowton.livejournal.com
Re: Need Mac Guru
« Reply #6 on: September 11, 2009, 02:03:53 PM »
I've only dabbled in it, so my opinion on the matter is clouded by unfamiliarity.  But because OSX is sitting atop a powerful kernel, the bourne-again shell seems to me, because I'm more familiar with it, much more dynamic.

In other news, I love logging onto my son's system in his bed room remotely and typing in a shell:

bash$> say daddy says he loves you.
bash$> say goodnight

Online ehowton

  • Colonel COURAGEOUS Member
  • *********
  • Posts: 7704
  • Fingering the Muse
    • http://ehowton.livejournal.com
Re: Need Mac Guru
« Reply #7 on: September 11, 2009, 02:07:14 PM »
Dude - have you ever used applescript?  It ain't bash.

No, what I'm saying is that you've become one of those people who, in reply to someone looking for help for a specific problem, question why they're trying to do the thing they're trying to do in the first place rather than taking an entirely different approach.

If I'm not mistaken, that's always been one of your pet peeves.

Yeah, I suck.  I just couldn't imagine trying to pull it off in applescript.

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Re: Need Mac Guru
« Reply #8 on: September 11, 2009, 02:14:03 PM »
Applescript seems much less intimidating because of the verbiage it uses.  In just a couple of hours work I've been able to write a script that can respond to my voice commands, with only some vaguely remembered highschool programing class and, of course the interwebs.  

I can run shell scripts from within an applescript, do shell scripts = bash? If so, do you know of a way to return text from an rss feed within bash?  

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Re: Need Mac Guru
« Reply #9 on: September 11, 2009, 02:19:01 PM »
As an aside, I'm trying to learn applescript, and applescript studio in turn to sort of prepare myself for learning Xcode. 

Offline drax0r

  • Major FANTASTIC Member
  • *******
  • Posts: 3481
  • Muckraker Extraordinaire
    • Anna Texas Community Forum
Re: Need Mac Guru
« Reply #10 on: September 11, 2009, 02:19:53 PM »
Applescript seems much less intimidating because of the verbiage it uses.  In just a couple of hours work I've been able to write a script that can respond to my voice commands, with only some vaguely remembered highschool programing class and, of course the interwebs.  

I can run shell scripts from within an applescript, do shell scripts = bash? If so, do you know of a way to return text from an rss feed within bash?  

I'm going to also be one of "those people" cause we're pretty far down the rabbit hole at this point.

What is it that you'd like your script or collection of scripts to do exactly?
Everything I say, do, imply, or infer is the sole representation and responsibility of the individual who owns this account and does not represent the opinion, policy, position, or intent of any organization or other entity, public or private.

Online ehowton

  • Colonel COURAGEOUS Member
  • *********
  • Posts: 7704
  • Fingering the Muse
    • http://ehowton.livejournal.com
Re: Need Mac Guru
« Reply #11 on: September 11, 2009, 02:22:06 PM »
drax0r is Script Master MC but presumably you could cron: wget [URL] && grep [string] [RSS file] | say

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Re: Need Mac Guru
« Reply #12 on: September 11, 2009, 02:26:32 PM »
I just want to ask my computer for the current weather conditions and have it speak them back to me.  I'd like to add this as a handler to an alarm clock script that I've already written.

Offline drax0r

  • Major FANTASTIC Member
  • *******
  • Posts: 3481
  • Muckraker Extraordinaire
    • Anna Texas Community Forum
Re: Need Mac Guru
« Reply #13 on: September 11, 2009, 02:54:36 PM »

VERY quick and dirty in bash:

say `wget --quiet -O - "http://rss.weather.com/weather/rss/local/75409?cm_ven=LWO&cm_cat=rss&par=LWO_rss"| grep "more details" |grep img|awk -F">" '{print $3}'|sed s/"For more details"//g|sed 's/&deg/degrees/g'|awk -F";" '{print $1}'
Everything I say, do, imply, or infer is the sole representation and responsibility of the individual who owns this account and does not represent the opinion, policy, position, or intent of any organization or other entity, public or private.

Offline filmnazi

  • Full Member
  • ***
  • Posts: 142
  • libertarian whipping boy
Re: Need Mac Guru
« Reply #14 on: September 11, 2009, 03:12:09 PM »

VERY quick and dirty in bash:

say `wget --quiet -O - "http://rss.weather.com/weather/rss/local/75409?cm_ven=LWO&cm_cat=rss&par=LWO_rss"| grep "more details" |grep img|awk -F">" '{print $3}'|sed s/"For more details"//g|sed 's/&deg/degrees/g'|awk -F";" '{print $1}'

ok so I open terminal type bash and press enter I get a prompt: bash-3.2$

I paste in your script and press enter and I get another prompt: >

what comes next?