I know this is too greedy, but i want to make python interact with a program´s user interface but on the background, so that i can still use my computer while the code runs. I am currently using pywinauto and pyautogui. So I can´t work while the code is running because my mouse and keybord are being manipulated. Does someone know how to make my code manipulate a "second" mouse and keyboard on the background while I use my mouse and keyboard to do other things?
The most common way to do this is a remote execution (on dedicated server or on virtual machine). All known recipes for pywinauto are collected in the Remote Execution Guide.
More complicated way is trying to use silent methods of pywinauto that don't require active desktop. This is partially mentioned in the above guide, but requires deep knowledge of pywinauto and your application structure. One of the examples was discussed on StackOverflow: https://stackoverflow.com/a/32847266/3648361 This way is not possible for many kinds of applications.
I've never heard about "second mouse/keyboard" approach. Not sure it's technically possible at all.
Related
recently I have made a CLI program using Python and it uses a library called keyboard. The program is working very well but have something that hurts me...
For any reason when I start it in Windows works normally, but on Linux (probably on MacOS too) gives a error of permission. What i know about this library is that it captures the keys even when the terminal windows is inactive, maybe the Linux think this dangerous and ask for super user. I particularly don't care to get the user "keypressers" even when the terminal window is inactive (Only in active terminal is great for me)
then I looked for some libraries similar this one, but for any reason don't work pretty similar. the keyboard library has a function called is_pressed() that returns a boolean value based if a specific key is pressed, for example: if is_pressed('space'), but I didn't find a alternative library that have a similar function.
Assuming this is for a game, you might want to take a look at the pygame framework. It has an eventloop specifically for this kind of purpose. Docs here.
Whats the best Python library to automate an external program
We have accounting software where we need to upload many files into for a particular reason. To do this we search for the relevant menu item right click it and then import. This is time consuming. It would be useful to be able to automate this. Ive looked at pyautogui but it needs the screen to be active and the user cant do anything else on their machine while it is running.
Of course ideally I would like to use the accounting software's API (if there is one) or find out if the upload is running a stored procedure at the back end taking the filepath as a parameter and then calling this procedure myself.
In the absence of those would anyone know if there is a way to automate this in Python without the limitations above or if not in Python what other language would be good for this?
Many thanks
I haven't done such thing. So I do not have proof of concept. But
You have at least 2 options, more or less complicated:
install virtualbox/vmware, and create virtual operating system (windows or Linux) on it. Then run your pyautogui script in this virtual operating system. You operating system is available in window-like container - so you can minimize this window with running script, and you system where you can interact as a user. (long tutorial: https://www.virtualbox.org/manual/ch01.html)
If you are Linux user, then you may be familiar with virtual screen. I think many people are using this virtual screen with automating web testing in sellenium (How do I run Selenium in Xvfb?). So probably, I say probably, there is chance to run pyautogui in virtual screen: How to attach pyautogui to the virtual display? - this is similar, but not answered question.
I'm sure many of us have seen vision degradation from too much screen time from programming.
A theory suggests that when they eyes become fixed, tension builds. And that tension causes the vision to slowly degrade.
This software promises to prevent that fixation...
http://www.central-fixation.com/downloads.php
The problem is it's outdated, and Windows only.
I'd like to write a script that will "swing" all open windows according to a set pattern & speed. A script that works with OSX 10.9 and later.
I know Python and Javascript but have no idea where to start on this.
Please help me out.
How is it done? What language is used to manipulate OSX application windows? And/or simply manipulate the whole desktop window space?
I haven't tried to do exactly what you are trying to achieve here, but ANYTHING at all related to manipulating OS X should be done via Automator or AppleScript. If you are running Yosemite, the app is called "Script Editor". Anything older and it's called "AppleScript Editor".
Try this site.
Extract:
tell application "Finder" to set the position of the front Finder window to {94, 134}
I know your question is labeled "python" but I believe that AppleScript is the way to go with this.
You can add AppleScript to an Automator workflow with the "script" object. I'm not sure how to make this run periodically, but one option would be to keep it open in the background. You can do this in AppleScript with the delay command:
(do stuff here)
delay (your delay)
Hope this achieves your purpose.
I've been looking for ways to make a GUI with a .py file, and have so far only found frameworks and modules like Tkinter. However, my ultimate goal is for this code to run on a lot of computers that don't necessarily have these modules installed. The machines are only guaranteed to have Python on them. Does anyone know a way to make a GUI under these restrictions?
The best way to do this would be to ship your application with those modules as a part of it; the user's computer doesn't need to have the GUI framework installed if you provide it.
What you're asking would essentially require you to write an entire GUI framework, which would give a result that would be similar or worse - with a LOT more work.
I have a horribly complicated (and very poorly designed) autodialer application I need to automate to make it possible for some less technical users to contact customers.
I would like to try using Python to accomplish this, and was wondering what experiences people have had with this. Poking around I've found a few extensions geared towards this type of thing:
Python Win32 GUI Automation (EDIT: PyWinAuto is hosted on GitHub now)
WATSUP
winGuiAuto
I would like to compile the end product into a standalone executable, so I'm looking for an extension that plays nice with pyinstaller, but is flexible enough to tackle this application with lots of tabs, checkboxes, radio buttons and buried options- and also refuses to save it's settings properly on close :( The system is running Windows 7.
Has anyone out there tried this sort of thing and could indicate which one could handle these requirements?
(Compatible with pyinstaller and Windows 7, and can handle drilling down to checkboxes, radio buttons etc.)
PyWinauto should be able to handle it. I used it for automating a OpenGL video game that had buttons and the like that are not Windows widgets so I had to use mouse clicks. However with your app you should be able to drill into the widgets with the functions it provides for using windows widgets. I recommend if possible to have pywinauto actually launch the dialer as it can be harder to find the correct name of the running app if you don't.
If the app does not use windows gui widgets then you will be able to have it click on the apps window to automate things. One thing you will find is the app must be visible and in focus. So if you want your app to be user interactive you will have to place a window in proximity to the dialer that has buttons. You will have to train your people not to click the autodialer window.
I don't know much about python, but project Sikuli sonuds great for what you want to do. It's a python project with image recognition -> http://news.ycombinator.com/item?id=1074469