zlacker

[return to "Running a Bakery on Emacs and PostgreSQL"]
1. jedber+y51[view] [source] 2019-02-26 18:47:53
>>flocia+(OP)
This reminds me of the time I used Python to fill out my Wife's 4th grade report cards. She kept all the records in google sheets, so when it came time to do report cars, she already knew what all the grades should be. But the school only provided a terrible app where you literally had to make three clicks with a mouse to enter each grade. Each kid had about 20 grades to enter, and there were 30 kids. That was a lot of clicking and a lot of RSI.

The app had no import/export, but it turned out you could save your work in progress to a proprietary file format. I figured out the format, and then figured out how to basically take the data in google sheets and munge it into the save file format.

It took about 3 hours to enter all the grades manually, and it took about 3 hours to develop the app. So for the first time we used it, it was a wash, but then we got to use it twice more.

Sadly, then they changed report card programs and the new one used a binary file format. At least the new program allowed keyboard input with shortcuts, so it wasn't as a bad.

◧◩
2. FredFS+gn1[view] [source] 2019-02-26 20:56:19
>>jedber+y51
Rewrite the output logic with PyAutoGUI doing the keyboard shortcuts and grade typing? https://pyautogui.readthedocs.io/en/latest/
◧◩◪
3. Karto+Fq2[view] [source] 2019-02-27 10:28:02
>>FredFS+gn1
I've done exactly that for my monthly time reports at work.

The company's official ERP in which we report our monthly activities is a horrendously slow and error-prone old-school GUI, where you basically punch a lot of numeric codes that represent customers and activities, and that can be pretty hard to get right. It looks like a spreadsheet with delays of several seconds after each cell is filled-in, because the apps commits everything over the network each time. I would waste several hours of life every month, typing one piece of rubbish at a time into that sad thing. It's a lot of pain and a colleague had written an automation tool based on the ERP's binary formats. However, his tool needed the code to be adjusted to each user, then compiling his thing was no easy task, then you needed to ask for special permissions to be able to feed the ERP with the binaries, and at last you realized that the binary output was a fragile thing, and so nobody used the tool.

So I wrote an automation script in Python with pluggable input sources which can be combined (text files that are easy to read and write, http connection to Redmine activities... later on a colleague took the tool and added a GrindStone source, and another guy plugged it into his Outlook calendar). The output stage to the ERP is built upon PyWinAuto, and it just simulates key-strokes on the proper window. It is not smart. It remains constrained by the ERP's slowness. But IT IS A HELL OF A FUN TO WATCH your monthly torture getting done all by itself, and enjoying a walk with a coffee in hand for that time, coming back from time to time to see your screen doing stuff.

All in all it took me about a whole day to write the script. It has been running for four years now. One ERP update broke the output stage. Fixing it was a matter of minutes : just write down the new keystrokes.

[go to top]