Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Can I use python for this .. ??

Reply
Thread Tools

Can I use python for this .. ??

 
 
san
Guest
Posts: n/a
 
      05-04-2006
Hi

I am using windows xp and have installed python and win32. I am
familiar with basic Python. I wanted to control some of the
applications via python script.

I would like to write a python script to say:
1. Open firefox and log on to gmail
2. Another firefox window to visit slickdeals
3. Open winamp and tune in to a shoutcast station
4. Open groupwise ...
etc ..

These are the task I do every day whenever I log on my computer .. it
just seems repetitive and hence probably can be coded in python.

Can I do this in python? Where do I find the COM objects/interfaces for
all these different programs? Are there any sample codes ?

Thanks.
Santosh.

 
Reply With Quote
 
 
 
 
san
Guest
Posts: n/a
 
      05-04-2006
btw i got the firefox to open and access some webpage and winamp
running ..

code below
----------
import os
import os.path
import subprocess

# Web pages
ffox_exe = r'C:\Program Files\Mozilla Firefox\firefox.exe'
assert os.path.exists(ffox_exe)
# open gmail
url = "http://www.gmail.com"
child = subprocess.Popen( (ffox_exe, url), executable = ffox_exe)
rc = child.wait()

# Winamp
wamp_exe = r'C:\Program Files\Winamp\winamp.exe'
assert os.path.exists(wamp_exe)
url = "http://64.236.34.97:80/stream/1040"
child = subprocess.Popen( (wamp_exe, url), executable = wamp_exe)

------------

now is there anyway i can enter user name and password and then click
okay .. (not for gmail but for other similar webpages which require
loggin) .. ??

how to open pages in tabs .. ??

San

 
Reply With Quote
 
 
 
 
BartlebyScrivener
Guest
Posts: n/a
 
      05-04-2006
For starters, you need the os and webbrowser modules

import os
import webbrowser

webbrowser.open("http://mail.google.com/mail")

# need to know the shell keyword for starting the app
os.system('start ' + 'Winword')

# the equivalent of double-clicking on the doc or file
os.startfile("c:/MyFiles/MyTextFile.txt")

If you actually want to log onto password-protected sites it gets
gnarly fast (beyond me). You can read about by perusing the urllib2
module or search this list at groups.google.com/group/comp.lang.python

Hope this helps.

rick

 
Reply With Quote
 
Petr Jakes
Guest
Posts: n/a
 
      05-04-2006
Why using Python?
What about?
1. Open Power Options in Control Panel. (Click Start, click Control
Panel, and then double-click Power Options.)
2.Click the Hibernate tab, select the Enable hibernate support check
box, and then click Apply.
(If the Hibernate tab is unavailable, your computer does not support
this feature.)

then:
1: Click Start and Shut Down,
2: Point the standby button and maintain the shift key pushed,
3: A new hibernation button appears: click it while still holding the
shift key: voila your PC will hibernate (it mens computer will save
your current setting and will switch off).

Petr Jakes

 
Reply With Quote
 
san
Guest
Posts: n/a
 
      05-04-2006
Petr I dont want hibernation .. its more like starting a list of
programs when i want to have fun time on my pc...

but thanx for ur reply ..

 
Reply With Quote
 
san
Guest
Posts: n/a
 
      05-04-2006
Rick

Thanks for your reply .. didnt quite get your point in loggin into
password protected site.
Will try to seach this group for more ..

Still looking for tab browsing and logging in password protected site
...

can i use ctype or something like that .. some modute that will
introduce key strokes .. so that i can do "username" "tab" "password"
"enter" so that i can log in .. ??

 
Reply With Quote
 
BartlebyScrivener
Guest
Posts: n/a
 
      05-04-2006
san,

Take a look at this thread which features some smart and helpful people
and good links.

http://tinyurl.com/ggn5e

I'm wagering you'll make more sense of it than I did. I have my hands
full just making my way through tutorials and books at the moment.

rick

 
Reply With Quote
 
Martin P. Hellwig
Guest
Posts: n/a
 
      05-04-2006
san wrote:
> Hi
>
> I am using windows xp and have installed python and win32. I am
> familiar with basic Python. I wanted to control some of the
> applications via python script.
>
> I would like to write a python script to say:
> 1. Open firefox and log on to gmail
> 2. Another firefox window to visit slickdeals
> 3. Open winamp and tune in to a shoutcast station
> 4. Open groupwise ...
> etc ..
>
> These are the task I do every day whenever I log on my computer .. it
> just seems repetitive and hence probably can be coded in python.
>
> Can I do this in python? Where do I find the COM objects/interfaces for
> all these different programs? Are there any sample codes ?
>
> Thanks.
> Santosh.
>


What you want looks like a way to automate the windows gui using python.
Since I never done this myself I gave google a try with this query:
http://www.google.com/search?hl=en&q...=Google+Search

It looks like pywinauto seems to be a good candidate.

hth

--
mph
 
Reply With Quote
 
placid
Guest
Posts: n/a
 
      05-05-2006

Petr Jakes wrote:
> Why using Python?
> What about?
> 1. Open Power Options in Control Panel. (Click Start, click Control
> Panel, and then double-click Power Options.)
> 2.Click the Hibernate tab, select the Enable hibernate support check
> box, and then click Apply.
> (If the Hibernate tab is unavailable, your computer does not support
> this feature.)


When you hibernate/boot up/hibernate for a long time without a clean
reboot, Windows becomes unstable...


>
> then:
> 1: Click Start and Shut Down,
> 2: Point the standby button and maintain the shift key pushed,
> 3: A new hibernation button appears: click it while still holding the
> shift key: voila your PC will hibernate (it mens computer will save
> your current setting and will switch off).
>
> Petr Jakes


 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      05-05-2006

"placid" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
..)
>
> When you hibernate/boot up/hibernate for a long time without a clean
> reboot, Windows becomes unstable...


This seems to depend on the system. I have gone at least a week, maybe
two, with nightly hibernations and no problems. Maybe you meant much
longer than that. But installs and updates often require reboots anyway.

tjr



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Python use a special home-made parser, or does it use Yacc? Robert Python 1 04-16-2008 07:56 PM
If I use the WAP add-on, can I not use GridView paging and sorting? Chris S ASP .Net 0 12-13-2006 10:03 PM
How can I use switch -s and 'use strict' at the same time Ting Wang Perl Misc 5 10-06-2005 02:03 PM
Can I use use Microsoft Masked Edit Control in ASP.NET web form =?Utf-8?B?ZGF2aWQ=?= ASP .Net 1 04-19-2005 01:12 AM
Can I use XPath or something to a remote Mac or Linux box and just query an xml file, not using web services and use encyrption? jake ASP .Net 0 07-06-2004 02:16 PM



Advertisments