Where do I begin learning to program bots? - python

I don't know what they're called but I want to learn to program bots that perform tasks within a game or software. But I have no idea how to even make a program that does stuff on other programs/software/games. Are their any good books on the subject?
If it makes a difference I'm using a Linux OS. I know Python and I began learning C recently.
Thanks!

There are many tools for sending artificial input. My favorite one only works on Windows.
For the cross platform, including Linux, there is a library called autopy. As you can guess, it's a Python library and it allows you to access your keyboard and mouse through Python objects.

If you want to automate requests and parsing, Python has packages urllib2 and BeautifulSoup (specifically for parsing).

Related

Sapi5 on linux?

I am working on creating an AI for myself and I chose python as the programming language to code it in. I am an absolute beginner in programming and have very little knowledge of the subject. After spending months of coding I finally created an AI by myself that is able to run and I did so on windows. I wanted to move this program to a raspberry pi but turns out that I am unable to use Sapi5 TTS module from pyttsx3 on linux as it requires the win32com files to function. I am aware that pywin32 cannot be run on linux as it is a different OS and I want to know if there is a way for me to be able to run sapi5 on linux? I have tries using different tts modules such as espeak but they are too robotic and I really like sapi5 so it would be great if there was a way for me to be able to use it, thank you for your time!!
Sapi5 is a built-in part of Microsoft Windows and you can't run it in Linux. I agree it's a pretty good speech synthesizer. You may consider using Mycroft/mimic, though I found the build process tricky, or use gTTS if your utterances are short and you'll have internet access.

Could one control a software GUI with python?

I need to create a python script to control a ThorLabs device. The device can be controlled with the proprietary Kinesis software, coding with C#, or through the communication protocol commands (at least I think so, not experienced with this). I am working on the latter since I need this to work in python but I believe it's going to take me a while to learn how to do this.
So, I was wondering, would there be an easier way to prototype a quick solution say by letting python control the Kinesis software GUI? If not, would it be possible to call on a C# script through a python script? I'm not proficient with C# and our whole solution runs on python.
Some insight or guidance would be greatly appreciated.
PywinAuto seems like something that may work for you.

Excel automation with python

I have been working with excel vba for some period of time related with automation. Now I am planning to upgrade to python. I did a little bit of research on how to implement automation using python. All I see people doing coding with PyCharm or Jupiter, to do an automation user has to have knowledge of python. What I want to know is how to create a tool or standalone application with python that does a repetitive task, calculation or report generation in excel. Where the end user doesn't have to worry about python or codes or learning new technology to accomplish the task.
I know this isn't technically and answer, and since I can't comment yet (too low rep), I'm going to point you to automate the boring stuff with python. I'm sure you can find your answer here plus some!
Here is my answer.
https://github.com/TaeYoon2/ExcelAutomation
This project is a sample excel automation program with python.
I used 'openpyxl' library.
welcome to stackoverflow. Here are a few resources that hopefully get you started on your journey to automating excel tasks with python then wrapping your project up for non-python users.
Python libraries that interface with excel (these are for you to write your excel automation projects)
openpyxl docs
pandas docs
pylightxl docs
more at http://www.python-excel.org/
Wrapping up your project for non-programmers
There are a few options here for your non-programmer users.
Have users run your python project on command line where you give them prompts to respond to for your automation (ie. input excel file name, automation task inputs etc). This is probably the simplest task on your end, but it does expect your users to know how to user command line.
Have users run your python project on command line but you create a graphical user interface (GUI) for them to ease the input field options. This requires some up front work on your end to wrap you input with a GUI of your choice; here are a few tkinter, pyqt.
Note that both of these options require your users to have python on their machine with the proper packages ready to go to execute your project. This can be a lot to ask for non-python users. Therefore finally you could use a packaging software like pyinstaller to wrap up your python project into an .exe
Hope that helps! Happy pythoning

Create a in-browser Python application with a GUI

I am teaching a class soon and I want to have users try my platform without the need of installing Python in their computers and to run everything online. I have searched for platforms such as Skulpt, CodeMirror and Trinket and they seem ok for what I want to do. However, I want to develop a GUI for the users to input parameters since there are a lot of options and I don't want users with no Python experience to run the programs from the command line like I do and hide the Python code behind the GUI. I have learnt simplegui recently but I think the GUIs you can create are not visually pleasant and for me this is a big no. I also saw in another post that using Tkinker with a in-browser python implementation is not possible.
So, I would like to know what would be the best combination of in-browser Python implementation and GUI module to reach my goal please?
Thank you so much!
I guess Jupyter could meet your needs. Getting started here.
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
The Notebook has support for over 40 programming languages, including those popular in Data Science such as Python, R, Julia and Scala.

PyWinAuto still useful?

I've been playing with PyWinAuto today and having fun automating all sorts GUI tests. I was wondering if it is still state of the art or if there might be something else (also free) which does windows rich client automation better.
pywinauto is great because it's Python.
Perhaps a bit more full featured is AutoIT, which has a COM server that you can automate (from Python using win32com), and some cool tools, like a "Window Info" utility, which will give you the text (title), class, size, status-bar text, and so on for the window currently under the mouse cursor.
There are some cases where pywinauto is a bit harder to use than AutoIt, and seems a little less polished. One example is automating Inno Setup programs. The Inno Setup "setup.exe" program launches a separate application that actually performs the install, and it's a pain to track this down with pywinauto, but AutoIt makes it easy.
I used to do test automation on our projects with AutoIt but switched over to pywinauto 3 months ago and have been very happy with that decision. There are some rough edges, but I've been able to fill them in with my own supplementary test functions. In addition I find that coding tests and support code in Python is much easier and more manageable compared to AutoIt. With Python I have way more powerful options for logging, debugging, documentation, process management and test configuration. For me it was absolutely the right way to go.
I am going the same way, bit by bit and I have to say that python + pywinauto is good stuff!
New pywinauto 0.6.0 has introduced MS UI Automation support under the hood. So that WinForms, WPF, Qt, Store apps etc. could be automated almost the same way as an old native Win32 application.
Moreover it's possible to use mouse and keyboard modules out of a window/control context. These modules work on Linux as well!
New module win32_hooks is inspired by pyHook and similar libraries, but it doesn't require compilation.
Yeah, this post is a kind of ad. But I just wanna say pywinauto is still useful and I believe it will be even more useful in the future. The developers community currently consists of 2 mature developers and 3 talented students and we have long term plans on Linux and Mac OS X.
P.S. There are some more open source tools:
similar tools overview in the pywinauto docs
UI Automation tools rating by GitHub stars and SO stats.

Categories

Resources