Question:

Help with Applescript (or Perl or Python or Ruby)!!!?

by  |  earlier

0 LIKES UnLike

I need some help with some scripting that I'm doing:

I'm using Applescript to download stuff from Google Docs without actually having to click anything within the browser. I need to know what script to use to log in. This is essentially what I have so far:

tell application "Safari"

set the URL of tab 1 of window 1 to "https://www.google.com/accounts/Service...

set "username" of "https://www.google.com/accounts/Service... to the text returned of (display dialog "Username?" default answer "Login")

end tell

I need help since the web page won't let me log in, since I don't know what variable (username, etc.) to use. How do I do this? If you know a more efficient script in Perl, Python, or Ruby, that would help, too....

 Tags:

   Report

1 ANSWERS


  1. You can do this, but it'll take some doing.  First, you need to figure out how Google is accepting logins.  The best way to figure this out is using Mozilla Firefox, and the httpLiveHeader plugin.  That will let you watch VERY EXPLICITLY what web pages you're calling from Google, and let you observe exactly where your username and password are being sent.  From there, you just need to be able to request the specific pages that your browser is sending, and grab the login cookie that Google returns to you, sending it on any successive requests.  Knowing Google, they don't make this easy.

    The easier solution might be to look at your existing login session's cookies, and copy the cookie values into your program.  Then, you can send HTTP requests with that already-validated cookie, and Google with authenticate you automatically.  The catch is of course that Google will probably expire your login after sufficient time.  Again, this may take trial and error, but you may be able to write something that repeatedly makes calls that keep your cookie from expiring.  This is a much simpler task (since you don't have to process the stream back and forth from Google), but may not work long-term, given the issue with expiring cookies.  Again, Google's security is probably excellent, so there may be other hoops to jump through.  But that's where I'd start.

    DaveE

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions