Author Topic: Problems with Scripts and Email to Twitter and Facebook  (Read 12361 times)

meteoperugia

  • Gentle Breeze
  • **
  • Posts: 79
    • DW0950
    • IPERUG54
    • MeteoPerugia
  • Station Details: Davis Vantage Pro2, iMac (Retina 5K, 27-inch, Late 2015), WeatherCat 3
Re: Problems with Scripts and Email to Twitter and Facebook
« Reply #15 on: November 12, 2013, 06:55:50 AM »
Fine Edouard! Thats could be the solution!  [tup]

The shortway could be publish messages directly to FaceBook but I supopose this is not so easy...
Federico
Perugia, Italy


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Solution mocked up (Re: Problems with Scripts to Twitter and Facebook)
« Reply #16 on: November 12, 2013, 10:19:59 PM »
Dear Federico, Steve, and WeatherCat script fans,

That sounds pretty interesting, Edouard! You need to duct tape the MPB to the dash of teh Buick so you can enjoy both hobbies at the same time! :)

Well, I don't get the feeling the poor old Buick is going to be getting much driving for a while.  There are new leaks and just to add insult to injury the company "fixing" the windshield wiper motor didn't find anything wrong.  However, they did break my extension I made to their switch so the original 1965 knob would work.  So now I fix that . . . . . . . .  just never seems to quit.    [banghead]


Fine Edouard! Thats could be the solution!  [tup]

Okay, I just finished mocking up a solution to that.  Here is a test of uploading the WeatherCat short forecast web tag to Twitter:

https://twitter.com/EdouardLagache/status/400376520209727488

Let me polish it a little and I'll let you'all play with it.

The shortway could be publish messages directly to FaceBook but I supopose this is not so easy...

Sorry, I'm an open-source kind of guy and refuse to have anything to do with FaceBook.  I didn't even really want to have anything to do with Twitter, but at least Twitter isn't claiming to want to reinvent the Internet.  So, you would need to find somebody else for FaceBook troubles.

Cheers, Edouard  [cheers1]

meteoperugia

  • Gentle Breeze
  • **
  • Posts: 79
    • DW0950
    • IPERUG54
    • MeteoPerugia
  • Station Details: Davis Vantage Pro2, iMac (Retina 5K, 27-inch, Late 2015), WeatherCat 3
Re: Solution mocked up (Re: Problems with Scripts to Twitter and Facebook)
« Reply #17 on: November 13, 2013, 02:54:01 PM »

Okay, I just finished mocking up a solution to that.  Here is a test of uploading the WeatherCat short forecast web tag to Twitter:

https://twitter.com/EdouardLagache/status/400376520209727488

Let me polish it a little and I'll let you'all play with it.

Thanks Edouard. Could be fine and I can custom the script with different WC web tags is the answer to my original question.  [tup]
Waiting for you news, many thanks again!  [cheers1]

Quote
Sorry, I'm an open-source kind of guy and refuse to have anything to do with FaceBook.  I didn't even really want to have anything to do with Twitter, but at least Twitter isn't claiming to want to reinvent the Internet.  So, you would need to find somebody else for FaceBook troubles.

Facebook is just a way to write/read informations and news. I'm not even a FaceBook's fan but there are many people who feel more comfortable reading weather data such as temperature wind or rain, as the trend and forecasts directly from the phone in a FB page rather than opena web page with a lot of data and often poorly displayed on the small display of a smartphone. So I made ​​a FB profile where these data are updated at regular intervals and the only way I know in order to do that automatically is through Twitter (I don't like it more than FaceBook and Twitter is less frequented than FB….at least in Italy). I was asking (and asking to Stu especially) if there is a way to send the automatic weather updates as simple text strings (WC web tags based) directly from WeatherCat to FaceBook as I do to CWOP, Weather Underground or other weather websites, but with different customizable data at different times and days (every hour or every monday or every 1st day of month etc…).
I believe that this could be a useful integration to WeatherCat also for the enormous spread of FB platform and extensive use that if people can do, including read the temperature and tomorrow's weather forecast….

Cheers  [cheers1]
Federico
Perugia, Italy


Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1558
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 14, WeatherCat 3.2
Re: Problems with Scripts and Email to Twitter and Facebook
« Reply #18 on: November 13, 2013, 10:05:45 PM »
Edouard,

This looks fantastic! Will this be one that cam be duplicated, so that I could, say, have a daily and weekly summary? All I'd need to do would be copy, change tags, and wait time?

 --Daily script
-- Daily text file

--Weekly Script
--Weekly text file

--Alert (temp, wind, etc.)
--Alert text file
(launched by WeatherCat Alert)

Ah, the possibilities!

Thanks,
Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS - CoCoRaHS
PWSweather - WeatherCloud - Twitter - Facebook

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Nah, could be!! (Re: Scripts to Twitter)
« Reply #19 on: November 13, 2013, 11:30:47 PM »
Howdy Steve and WeatherCat script fans,

This looks fantastic! Will this be one that cam be duplicated, so that I could, say, have a daily and weekly summary? All I'd need to do would be copy, change tags, and wait time?

Well, you might need to put back the J.C. Computing libraries after making a copy.  I just tried my copies and didn't get what I expected at first.  But if you replace the libraries like you might have to do with WC Twitter Uploader, then the AppleScript works for sure.

Then you can upload anything that you can create as a WC webtag to Twitter.  Just create a WeatherCat web template that has the webtags you want converted into text and allow WeatherCat to process the template.  It is that text file that the AppleScripts will then upload.  You then modify the AppleScript to have the path to the file you want uploaded to Twitter.  Then you run the AppleScript.  If you want an automated operation just use Cronnix to set the time when the AppleScripts are launched.  Also, indeed custom alerts could be uploaded to Twitter.

There is one "gotcha" that just tripped me up.  WeatherCat tried to produce HTML formatting.  Twitter wants very plain text.  My latest test failed because the string I was trying to upload to Twitter had characters that Twitter doesn't support.  So stay tuned.  I'm closing in on this but as usual, lots of things on my plate.

Cheers, Edouard  [cheers1]

P.S. In the latest twist on my poor station wagon, the brand new alternator just died  . . . . . . . Ahhhhhhhhhhhhhh!!!!!!!  [banghead]

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1558
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 14, WeatherCat 3.2
Re: Nah, could be!! (Re: Scripts to Twitter)
« Reply #20 on: November 14, 2013, 01:31:47 AM »
P.S. In the latest twist on my poor station wagon, the brand new alternator just died  . . . . . . . Ahhhhhhhhhhhhhh!!!!!!!  [banghead]

That's just crazy! Did you source these parts, or has your builder cheaped out on you? As you know, I'm having an MGA engine built, and I'm gonna mix modern and vintage components. I've had the carburetors rebuilt, and am having the water pump and dizzy rebuilt. (new water pumps are pot metal castings, while my original is cast iron, which will be resleeved.) But I'm buying a modern geared starter, and may switch to a GM alternator instead of my generator. I finally decided to stick with the 4-speed 3-synchro (not synched in 1-2 or R) instead of swapping in a British Ford full synchro 5-speed.

Good luck,
Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS - CoCoRaHS
PWSweather - WeatherCloud - Twitter - Facebook

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
You'll be sorry!! - Hopefully not! (Re: Scripts to Twitter)
« Reply #21 on: November 14, 2013, 10:27:25 PM »
Howdy Steve and WeatherCat automotive enthusiasts,

P.S. In the latest twist on my poor station wagon, the brand new alternator just died  . . . . . . . Ahhhhhhhhhhhhhh!!!!!!!  [banghead]

That's just crazy! Did you source these parts, or has your builder cheaped out on you?

In this case it was an off the shelf production part made by a performance parts manufacturer: Tuff Stuff Performance:

http://www.tuffstuffperformance.com/index.cfm/page/ptype=product/product_id=8312/category_id=270/home_id=-2/mode=prod/prd8312.htm

Their products are American made and have a good reputation.  However, it only had a 1 year warranty and was installed back in August 2012.  Lucky me, this company does stand behind their products and they are going to let me return it for repairs.

As you know, I'm having an MGA engine built, and I'm gonna mix modern and vintage components.

 ;) . . . .  Don't do that!!  Da' gremlins will get ya' for sure!!  . . .

I've had the carburetors rebuilt, and am having the water pump and dizzy rebuilt. (new water pumps are pot metal castings, while my original is cast iron, which will be resleeved.) But I'm buying a modern geared starter, and may switch to a GM alternator instead of my generator. I finally decided to stick with the 4-speed 3-synchro (not synched in 1-2 or R) instead of swapping in a British Ford full synchro 5-speed.

Seriously, that is very similar to the new engine for my trusty wagon.  I'm going more with modern components than you are, but there is plenty of stuff that had to be rebuilt.

What has been really scary for me that a company's past reputation just doesn't seem to be the reliable indicator that it used to be.  One of the reasons I went with an aftermarket electronic fuel injection system is that I was having a lot of trouble getting carburetors rebuilt properly.  The same rebuilder that had done a good job for me around 2000 started giving me junk.  One of my car collector friends had a nightmare when trying to restore his own first car: a 1957 Chevy Bel Air.  The restorer he chose had several strong recommendations, but the guy flaked out.  The fellow who built the engine for my wagon is still considered one of the best in the business, but even he has to admit he made an error in the head gaskets he selected for Biquette's engine.

So best of luck in your rebuild.  Still, do try to keep a close check on the project as much as possible!

Cheers, Edouard  [cheers1]

P.S. AppleScripts are coming along!

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Can't "twit" from a CronniX job. (Re: Scripts to Twitter and Facebook)
« Reply #22 on: November 16, 2013, 10:30:02 PM »
Dear WeatherCat AppleScript fans,

Unfortunately, I've run into a snag on trying to make the AppleScripts I proposed to solve this problem.  My test scripts work just fine if run them manually.  However, when run as a cron (Cronnix) job nothing gets posted to Twitter.  Worse, trying to run the AppleScript from a WeatherCat custom alert has the same null outcome.  I suspect this is a problem with the authentication strategy to make sure that "you are you" to Twitter.  I've sent an email to Jesse Almanrode to see if he has any thoughts.  However, this could be a deal breaker.

Sorry, we'll just have to see.

Cheers, Edouard

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1558
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 14, WeatherCat 3.2
Re: Problems with Scripts and Email to Twitter and Facebook
« Reply #23 on: November 17, 2013, 03:54:32 AM »
Thanks for giving it a go, Edouard. having it run every X seconds like the existing Twitter script doesn't work?

Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS - CoCoRaHS
PWSweather - WeatherCloud - Twitter - Facebook

meteoperugia

  • Gentle Breeze
  • **
  • Posts: 79
    • DW0950
    • IPERUG54
    • MeteoPerugia
  • Station Details: Davis Vantage Pro2, iMac (Retina 5K, 27-inch, Late 2015), WeatherCat 3
Re: Problems with Scripts and Email to Twitter and Facebook
« Reply #24 on: November 17, 2013, 09:04:29 PM »
Twitter Authentication: that's my original issue. Scripts I showed and Cronnix are running perfectly but Twitter wants new rules of authentication and I can't guess the right way…  :'(
Federico
Perugia, Italy


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Control problem. (Re: Problems with Scripts to Twitter and Facebook)
« Reply #25 on: November 17, 2013, 11:17:18 PM »
Dear Steve, Federico, and WeatherCat Twitter fans,

I haven't heard back from J.A. Computing yet, so the jury is out as to whether or not there is a way out of this.

Thanks for giving it a go, Edouard. having it run every X seconds like the existing Twitter script doesn't work?

Well, yes you could do that, but then the problem is - how to you know when you want to post the message?  For example, you suggested that you wanted the message to be launched when WeatherCat triggers a custom alert.  I don't know of an easy way to get a custom alert to communicate with an AppleScript that is running all the time.  As I understood it, people wanted to have additional weather information posted when something happened or say at specific times of the day (like the forecast text.)  The other thing that worries me a bit is creating some more of these 24/7 AppleScripts.  They use a lot of computing resources for what they accomplish.

Let's see if there is if J.A. comes up with an answer.  The simplest solution would be some way for these AppleScripts to be able to authenticate themselves when run from WeatherCat alert triggers or what-not.

Cheers, Edouard  [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Another way to skin this cat(fish!) (Re: Scripts to Twitter)
« Reply #26 on: November 18, 2013, 09:52:55 PM »
Dear WeatherCat Twitter fans,

While I was removing the tails off some shrimp for yesterday's dinner - I got an idear!!

I had forgotten that AppleScripts can script each other.  I use that trick to get the web tags from all the other AppleScripts to WC AppleScript Tags Processor.  I can use the same programming strategy to use WC Twitter Uploader to pull double-duty.  In addition to processing the overall conditions messages, I could have other AppleScripts "hand-over" additional text strings to  WC Twitter Uploader and have this AppleScript upload these as well.  Since this AppleScript does work now, it should be able to simply work a little harder.

It is going to take me a while to come up with this, but we are expecting a little rain (hurray! ) this week, so perhaps I can make some headway on the AppleScript upgrade.

Take tuned!

Cheers, Edouard  [cheers1]

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1558
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 14, WeatherCat 3.2
Re: Control problem. (Re: Problems with Scripts to Twitter and Facebook)
« Reply #27 on: November 18, 2013, 10:35:22 PM »
Well, yes you could do that, but then the problem is - how to you know when you want to post the message?  For example, you suggested that you wanted the message to be launched when WeatherCat triggers a custom alert.

Correct. What I tried last year was simply a daily summary set at XXXX seconds, but ran into no tags available for whatever I was trying then as well as problems getting two Twitter AppleScripts to work. I mentioned alerts as another interesting possibility.

Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS - CoCoRaHS
PWSweather - WeatherCloud - Twitter - Facebook

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Solved . . . . meybe? . . . . (Re: Control problem for Scripts to Twitter)
« Reply #28 on: November 19, 2013, 10:11:09 PM »
Howdy Steve and WeatherCat scripters and twitters . . . . .

Correct. What I tried last year was simply a daily summary set at XXXX seconds, but ran into no tags available for whatever I was trying then as well as problems getting two Twitter AppleScripts to work. I mentioned alerts as another interesting possibility.

Well, as I watched the raindrops fall, I spliced into my WC Twitter Uploader script  new handler to receive strings sent from other AppleScripts.   I modified the idle loop to check once a minute for any strings that might have been forwarded from other scripts to be uploaded to Twitter.  Once a minute WC Twitter Uploader uploads to Twitter any strings that has been forwarded to it.

Then I hacked up a test call to forward a string to be sent to Twitter and . . . . . . . .

https://twitter.com/EdouardLagache/status/402891973838663680

It isn't "Hello World" but it will due in a pinch.

Okay, building on that success, I modified the main AppleScript library file to provide a consistent way for other AppleScripts to send strings over to be queued up for uploading to Twitter.  Having done this, I retooled my test WC Forecast Twitter script and ran a second test . . . . . .

https://twitter.com/EdouardLagache/status/402914054328426496

So, . . . . . . . . . . . .  so far so good!!  [bounce]

This is a more substantial revision of the AppleScript package, so it may take me a while to get this all ready for "showtime," but the overall scheme is looking good at the moment!

Stay tuned!

Cheers, Edouard  [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Update - cron jobs working okay. (Re: Scripts to Twitter)
« Reply #29 on: November 20, 2013, 09:46:22 PM »
Dear WeatherCat Twitter fans,

Just a quick update.  I have been running my modified WC Twitter Uploader for about a day and so far all is well.  In particular, the tests of launching AppleScripts via cron (CronniX) are getting text uploaded to Twitter at least most of the time (there was one failure this morning.)  I need to run a test of an AppleScript running from a WeatherCat custom alert.  I had modified my temperature AppleScripts, but the temperature has been fluctuating so little that none of my standard alerts have been triggered.

Today I had to put this on the back-burner to deal with wagon issues, but I'll try to get back to this soon.

So stay tuned!

Cheers, Edouard  [cheers1]