[python-win32] Python Automation Question

McBuell c.steiner at pantherite.ch
Sun Feb 21 15:27:42 CET 2010



Hi !

just a few days ago, I've found the pywinauto module for python.
This awsome little script helps pressing menus and/or other windows controls
of other applications with only a few lines of python. 

So it should be possible for it to open the printer dialog box, and then
choose the correct printer.

Check it out at:  http://sourceforge.net/projects/pywinauto/
http://sourceforge.net/projects/pywinauto/ 

Check also the example directory that comes with the installer, it is a
quick way to get used
to the needed syntax.

Cheers



Roberts, Gregory (Contractor) wrote:
> 
> 
> We have decided to oset the default printer in a macro which we must run
> on the excel report and hope that all will work on Monday when in
> production.
> 
> I would like to find a python solution which I could refactor into the
> correct place.  Again, my wits with Python still have not formed.
> Also... I am unable to dedicate to much time to this task for the time
> being.
> 
> Thanks for the suggestions.  I will try and think outside the box using
> them as guidance.
> 
> Greg
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: python-win32-bounces+gregory.roberts=usmint.treas.gov at python.org
> [mailto:python-win32-bounces+gregory.roberts=usmint.treas.gov at python.org
> ] On Behalf Of python-win32-request at python.org
> Sent: Friday, February 19, 2010 6:00 AM
> To: python-win32 at python.org
> Subject: python-win32 Digest, Vol 83, Issue 21
> 
> Send python-win32 mailing list submissions to
> 	python-win32 at python.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mail.python.org/mailman/listinfo/python-win32
> or, via email, send a message with subject or body 'help' to
> 	python-win32-request at python.org
> 
> You can reach the person managing the list at
> 	python-win32-owner at python.org
> 
> When replying, please edit your Subject line so it is more specific than
> "Re: Contents of python-win32 digest..."
> 
> 
> Today's Topics:
> 
>    1. problems loading Windows services with pywin32 214 (Tim Brown)
>    2. Re: Python Automation Question (Dahlstrom, Roger)
>    3. Re: pywin32 documentation wiki (Tim Golden)
>    4. Re: win32gui and SysListView32 (Tim Roberts)
>    5. Re: win32gui and SysListView32 (Michel Claveau)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 18 Feb 2010 12:12:14 +0000
> From: Tim Brown <tbrown at snapsurveys.com>
> To: "'python-win32 at python.org'" <python-win32 at python.org>
> Subject: [python-win32] problems loading Windows services with pywin32
> 	214
> Message-ID:
> 	
> <A200C88FEF033240A639C84D4B947BF501D16F1A34 at snapserv05.snapsurveys.local
>>
> 	
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi,
> I'm using Python 2.5 and pywin32 build 212 to produce an application
> with services.
> The services load C++ DLLs, for example snap.pyd, to do some of the
> work.
> All working fine until a customer installed pywin32 build 214 then some
> of the services don't load, because some of the DLLs load others do not
> :(
> 
> The error I get in the Windows Event Viewer looks like this
> 
> Python could not import the service's module Traceback (most recent call
> last): 
> ...
> import snap
> ImportError: DLL load failed: Invalid access to memory location. %2: %3
> 
> The DLLs load fine in PythonWin and if the .py file which includes the
> import is run from the command line.
> The .py file only fails if run by PythonService.exe.
> 
> If there is someone out there who can say "yes that's because you have
> not done ....  "
> that would be wonderful. 
> Otherwise is there a list of the changes from build 212 which could
> break existing applications so that I can work out what I've got to
> change ?
> 
> I hope this has all made some sense 
> 
> Thanks Tim.
> 
> ------------------------------
> 
> Python Automation Question
> 
> 
> DISCLAIMER:
> This e-mail, and any attachments thereto, is intended only for use by
> the addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient of this
> e-mail, you are hereby notified that any dissemination, distribution or
> copying of this e-mail, and any attachments thereto, is strictly
> prohibited. If you have received this in error, please immediately
> notify me and permanently delete the original and any copy of any e-mail
> and any printout thereof.
> E-mail transmission cannot be guaranteed to be secure or error-free. The
> sender therefore does not accept liability for any errors or omissions
> in the contents of this message which arise as a result of e-mail
> transmission.
> 
> NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Direct Edge ECN LLC may, at
> its discretion, monitor and review the content of all e-mail
> communications.
> 
> www.directedge.com
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 18 Feb 2010 13:47:45 +0000
> From: Tim Golden <mail at timgolden.me.uk>
> Cc: python-win32 at python.org
> Subject: Re: [python-win32] pywin32 documentation wiki
> Message-ID: <4B7D4501.6060001 at timgolden.me.uk>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi, "le dahut". (Sorry; how would you prefer to be addressed?)
> 
> What would be really useful is one or two paragraphs outlining the
> problem you're solving with this solution :) I've more-or-less followed
> your posts here over the past year, and your code's quite readable so I
> can get an idea, but perhaps something along the lines
> of:
> 
>    The requirement: xxxx
> 
>    The problems: xxx
> 
>    The solution: xxx
> 
> would be helpful. No need for too much text; just an outline on which to
> hang your different pieces of code.
> 
> Thanks
> 
> TJG
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Thu, 18 Feb 2010 10:51:11 -0800
> From: Tim Roberts <timr at probo.com>
> To: Python-Win32 List <python-win32 at python.org>
> Subject: Re: [python-win32] win32gui and SysListView32
> Message-ID: <4B7D8C1F.8090509 at probo.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Michel Claveau wrote:
>>
>> I use a SysListView32 in a Window, for show a list of lists.
>> It is very good, but I have two questions :
>>  - The size is limited to 9999 lines ; how define more?
> 
> The number of items is limited only by available memory.  I know of apps
> that have used more than 100,000 items.  Why do you believe there is a
> 9,999 line limit?
> 
> 
>>  - I did not found how define alignment for columns (Left, Right,
>> Center) ; have you a sample?
> 
> You can do it when you add the column using LVM_INSERTCOLUMN, or you can
> do it afterwards by sending LVM_SETCOLUMN.  You set the "fmt" member of
> the LVCOLUMN structure to LVCFMT_RIGHT or LVCFMT_CENTER.  Be sure to set
> LVC_FMT in the "mask" member to indicate that you're changing the
> format.  If you use LVM_SETCOLUMN, you should probably do an
> LVM_GETCOLUMN first, then modify the current settings.
> 
> The leftmost column is ALWAYS left-justified.  This cannot be changed.
> 
> This seems like the hard way to write an application.  Have you
> considered using a GUI framework like Tkinter or Qt or (my favorite)
> wxPython?
> 
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Fri, 19 Feb 2010 08:12:43 +0100
> From: "Michel Claveau" <mc at mclaveau.com>
> To: "Python-Win32 List" <python-win32 at python.org>
> Subject: Re: [python-win32] win32gui and SysListView32
> Message-ID: <1104CE55FBF149E69F26064C55346FF8 at MCI1330>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
> 	reply-type=original
> 
> Hi, Tim!
> 
> Thanks for your answer.
> 
> 
>>>  - The size is limited to 9999 lines ; how define more?
>>  The number of items is limited only by available memory
> 
> You are right. I tried with 300 000 lines, without problem.
> I do not know I had a 9999 limit on my first tests...  Sorry for
> trouble.
> 
> Little info (for other readers):
> This code give more speed:
>     win32gui.PostMessage(self.hwnd, win32con.WM_SETREDRAW,0,0)
>     ...(preparation of data in show)...
>     win32gui.PostMessage(self.hwnd, win32con.WM_SETREDRAW,1,0)
>     win32gui.UpdateWindow(self.hwnd)
> 
> 
>>>  - I did not found how define alignment for columns (Left, Right,
> Center)
>> "fmt" member of the LVCOLUMN ... If you use LVM_SETCOLUMN, you
>> should probably do an LVM_GETCOLUMN first.
> 
> OK, it's run. Without LVM_GETCOLUMN first. But with
> win32gui.UpdateWindow 
> after.
> 
> Thank you very well & again :)))
> 
> 
>> The leftmost column is ALWAYS left-justified.  This cannot be changed.
> 
> In my W7, I can align the column 0 (leftmost) without problem. Perhaps 
> because I insert it in last operation?
> 
> 
>> This seems like the hard way to write an application.  Have you
>> considered using a GUI framework like Tkinter or Qt or (my favorite)
>> wxPython?
> 
> I tried TK: limited.
> I tried wx: I let down, because several conflict's versions, and it is
> very 
> complicated.
> Actually, I use Autoit like GUI, and Python's functions linked to
> UIobject 
> and events (via COM) ; run OK, but not pythonic.
> Also I use IE like GUI, with PLUIE
> (http://ponx.org/ponx/guiescreens.htm) ; 
> but it is not very fast.
> 
> I think than a pure  pywin32 is a good way to explore.
> 
> Have a nice day.
> 
> Michel Claveau
> 
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 
> 
> End of python-win32 Digest, Vol 83, Issue 21
> ********************************************
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 
> 

-- 
View this message in context: http://old.nabble.com/Python-Automation-Question-tp27630895p27676028.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.



More information about the python-win32 mailing list