
Re: script to send sms via google voice
I went though and deleted all the modules and reinstalled using just these two commands:
sudo easy_install-2.5 simplejson
sudo easy_install-2.5 -U pygooglevoice
What I found out was that Google made a change and what is included in the pygooglevoice file does not work anymore. After it installed, I unzipped the pygooglevoice-0.5-py2.5.egg located in /Library/Python/2.5/site-packages. It will unzip two folders: EGG-INFO and googlevoice.
Inside the googlevoice folder, edit the settings.py and change the:
LOGIN = 'https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral'
to
LOGIN = 'https://accounts.google.com/ServiceLogin?service=grandcentral'
Save the file, then re-zip both folders and rename the archive pygooglevoice-0.5-py2.5.egg. Replace the original .egg file with the new one.
I then created a file called gv.py with the following contents:
- Code: Select all
#!/usr/bin/env - python
from googlevoice import Voice
import os,sys,string
mobileNumber = sys.argv[1]
smsMessage = ' '.join(sys.argv[2:])
# make sure the phone number isn't too bogus
for digit in mobileNumber:
if digit not in string.digits:
usage()
if len(mobileNumber) < 10: # 10 digits works with google voice
usage()
# the google voice "magic"
voice = Voice()
voice.login()
voice.send_sms(mobileNumber, smsMessage)
voice.logout()
In order to test this out, I created a new action group with the following AppleScript:
do shell script "python2.5 /Users/Indigo/gv.py 5175551212 'This is neat!'"
It worked!
What's the best way to use it? I don't want Indigo to hang while it's waiting for the script to finish. Would creating a plugin be best or is there another way?
Thanks,
Chris