Anything better than pyWinAuto?

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Need to do some relatively simple automation and I'm already learning Python so that seems like the obvious route. Unfortunately most Google links are from 2007-2010. PyWinAuto has a lot of links but the current version on Sourceforge was uploaded two years ago and apparently only runs in Python 2.7.

SWAPY looks awesome and I suppose I'll just downgrade to Python 2.7 if necessary, but since I've already been practicing on 3.3 I'd like to stick with it if possible.

Suggestions? Is there another way to do Windows automation in Python 3.3 with or without pywinauto (and preferably something like SWAPY)?
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
The process is roughly:

download an xml file with wget (which I found the Python version of)
open the xml file in notepad++ and find/replace &lt; and &gt; with <> (for some reason we get sanitized data), save
open saved file with xml2csv and convert
move csv to the same folder as an xlsm data crunching sheet
open the xlsm and wait a min for it to do its thing
save the output tab on the xlsm as a txt file in our upload directory, then close excel
run another custom application to handle final upload
repeat every hour or two

It'll be run on my workstation in a static environment. No biggie if it misses a cycle from me kicking out the ethernet port or something, but it does need to run reliably all weekend. We can put it on our server if needed, but would prefer to keep it on my system at least until we're confident and happy with the process.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
The process is roughly:

download an xml file with wget (which I found the Python version of)
open the xml file in notepad++ and find/replace &lt; and &gt; with <> (for some reason we get sanitized data), save
open saved file with xml2csv and convert
move csv to the same folder as an xlsm data crunching sheet
open the xlsm and wait a min for it to do its thing
save the output tab on the xlsm as a txt file in our upload directory, then close excel
run another custom application to handle final upload
repeat every hour or two

It'll be run on my workstation in a static environment. No biggie if it misses a cycle from me kicking out the ethernet port or something, but it does need to run reliably all weekend. We can put it on our server if needed, but would prefer to keep it on my system at least until we're confident and happy with the process.

SWAPY looks pretty cool for this job.It is a visual automation tool so it will be very easy to code.However I have never worked with this before.All my windows scripting experience is in vbscript.
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Actually it seems like it might be more trouble than it's worth. It's generating clunky code, doesn't seem to register Notepad++ as an open application (and therefore can't generate menu and window commands for it) and has an abysmally limited set of options. I don't even see a command to enter text. And I can't edit/clean up the output except by closing and restarting the program.

Can Python33 handle Windows automation without all these plugins? SO far I seem to need wget, pywinauto, easy_install, and pip... probably more.
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Can a cron job do all the above? Download the file, rename it, run it in Notepad++, do a couple find-replaces that take ~10 mins each (107MB of XML), save and close, open the result in xml2csv, convert, close, open the csv, etc...?

I don't know much about cron jobs but always associated them with much simpler jobs and not with issuing program-specific commands in different programs.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,284
3,905
75
Well, I'd say the first thing you should do is avoid running a Windows program with automation wherever possible. Personally, I'd collect the various steps in a batch file.

1. WGet: You found a version. But see step 5 as well.
2. find/replace: sed. (That's what I sed!) You could surely make a similar thing in pure Python as well.
3. xml2csv appears to be a command-line thing.
4. xlsm: No idea.
5. Upload: Curl? It can upload as well as download.
6. Repeat every hour or two: That's what the cron or cron-like job is for.
 

beginner99

Diamond Member
Jun 2, 2009
5,223
1,598
136
Why don't you do the replace in python? Don't see the need to call notepad++?

Same for the other stuff. Move it to python too.
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Thanks for the help everyone!

1. WGet: You found a version. But see step 5 as well.
2. find/replace: sed. (That's what I sed!) You could surely make a similar thing in pure Python as well.
3. xml2csv appears to be a command-line thing.
4. xlsm: No idea.
5. Upload: Curl? It can upload as well as download.
6. Repeat every hour or two: That's what the cron or cron-like job is for.

Ken - No need for cURL. The upload is already handled by some custom VB in our processing sheet. I dug into it earlier and got it working. I've been using xml2csv as a GUI; didn't know there was a CLI version but I'm sure I can dig it out. There are probably libraries for making it easy in Python too - the only reason I haven't done that so far is that... well, I had two years of comp sci circa 2001-2002 (mostly Java and C) but I'm a complete noob at Python and not familiar with this sort of manipulation (but hey, I could push and pop like nobody's business back in the early post-Y2K lol). Trying to bite off the smallest possible chunks while I figure it out.

I was just planning to use a lot of Wait statements in Python to slow it down and just let it run in a continuous loop with a basic GUI and start/stop buttons and an error readout area, but a cron job is probably the better way to go. Thanks.

Lumberg and Netopia - I'll look into those, thanks! Trying to do at least the basic stuff in Python partially because it's a good way to learn Python, but there's something to be said for fast results too.

Beginner - eventually I do want it all in Python; like I told Ken though I'm a complete Pynoob and trying to avoid biting off more than I can chew.

Everyone - if writing the find/replace in Python is easy, I'd rather do that than call n++ obviously. Digging up UI element names and manipulating them is a PITA, esp since SWAPY doesn't work very well (unsurprising I guess for code that's gone apparently unmaintained since 2005). If I code it internally, the new process would be:

1. Call Wget for the xml file
2. Call find/replace subroutine
3. Call xml2csv (will dig up the CLI version)
4. Run data processing spreadsheet
5. The processing sheet will grab info from data.csv automatically and process it
6. Call pywinauto to run the VB upload macro in the processing sheet
7. ???
8. Profit!

Sound reasonable enough?
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Also, can this be done in python33 or do I still need python27? I'd like to stay on the version I'm more or less familiar with if possible.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
Also, can this be done in python33 or do I still need python27? I'd like to stay on the version I'm more or less familiar with if possible.

It may sound funny but some of the Test automation tools would be better suited for your needs.Have you ever given Quick Test professional a shot? some folks use it at my office and it is extremely powerful.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
etherealfocus,

You should take a five minute look at Sikuli. It uses python as its programming language. It just helps you use gui elements to program with.
 

etherealfocus

Senior member
Jun 2, 2009
488
13
81
Been playing with sikuli for a while... kinda awesome

Current plan is a cron job to manage scheduling, python for the crunching, and sikuli for hitting UI elements in other apps. It's a little clunky, but pasting in a pic of a button is a lot easier than digging out UI element names from SWAPY.

Thanks Netopia - you win an internet
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |