[PYTHON] How to right click using keyboard input in RPA?

motivation

Not limited to python, if you are doing RPA,

"Isn't it faster to use that keyboard than to recognize an image and right-click with the mouse?"

There are times. However, the degree of abstraction of the concept of "that" is high, and it is difficult to find it even if you search.

Also, "you can right-click on the keyboard" You may feel how well it is recognized by the number of "LGTM".

Based on these facts, we decided to publish the article considering that it is information that contributes greatly to Qiita.

dialect

"Menu key" on Ubuntu "Application key" on Windows In Japanese, "keys that bring up the right-click menu" and "keys that bring up the context menu" Windows keyboard shortcut is " Shift + F10"

Code sample

Bring up the right-click menu by keyboard input

sample.py


import pyautogui

pyautogui.hotkey('apps')

bonus

On Windows, right-click menus such as window maximization, minimization, and window closure seem to appear with Shift + F10.

Original

PyAutoGUI | Docs PyAutoGUI | Github

py:https//github.com/asweigart/pyautogui/blob/master/pyautogui/_pyautogui_win.py


'apps': 0x5d, # VK_APPS

reference

[Application Key | Source: Wikipedia, the free encyclopedia](https://ja.wikipedia.org/wiki/%E3%82%A2%E3%83%97%E3%83%AA%E3% 82% B1% E3% 83% BC% E3% 82% B7% E3% 83% A7% E3% 83% B3% E3% 82% AD% E3% 83% BC)

Excelsior!

Recommended Posts

How to right click using keyboard input in RPA?
How to hide user input in PySimple GUI
How to exit when using Python in Terminal (Mac)
How to retrieve multiple arrays using slice in python.
How to execute a command using subprocess in Python
How to develop in Python
[Python] How to use input ()
[Django] How to give input values in advance with ModelForm
How to generate a query using the IN operator in Django
[Blender] How to handle mouse and keyboard events in Blender scripts
How to install python using anaconda
[Python] How to do PCA in Python
How to handle session in SQLAlchemy
How to write soberly in pandas
Repeated @ app.callback in Dash How to write Input and State neatly
How to display formulas in latex when using sympy (> = 1.4) in Google Colaboratory
How to use SQLite in Python
How to judge that the cross key is input in Python3
How to convert 0.5 to 1056964608 in one shot
How to reflect CSS in Django
How to kill processes in bulk
How to use Mysql in python
Let's see using input in python
How to wrap C in Python
How to use ChemSpider in Python
How to use PubChem in Python
How to run TensorFlow 1.0 code in 2.0
How to handle Japanese in Python
How to log in to Docker + NGINX
How to call PyTorch in Julia
How to reflect validation error and input contents on the previous page without using render in the action
How to make a model for object detection using YOLO in 3 hours
How to test each version of IE using Selenium in modan.IE (VM)
How to get a value from a parameter store in lambda (using python)
How to store CSV data in Amazon Kinesis Streams with standard input
How to plot galaxy visible light data using OpenNGC database in python
How to use calculated columns in CASTable
How to access environment variables in Python
How to dynamically define variables in Python
How to do R chartr () in Python
How to draw a graph using Matplotlib
How to convert csv to tsv in CLI
[Itertools.permutations] How to put permutations in Python
How to use Google Test in C
How to work with BigQuery in Python
How to install a package using a repository
Log in to Slack using requests in Python
How to set xg boost using Optuna
How to execute commands in jupyter notebook
How to do'git fetch --tags' in GitPython
How to get a stacktrace in python
How to display multiplication table in python
How to extract polygon area in Python
How to reassign index in pandas dataframe
How to check opencv version in python
How to enable SSL (TLS) in Apache
How to use Anaconda interpreter in PyCharm
How to specify non-check target in Flake8
How to handle consecutive values in MySQL
How to switch python versions in cloud9
How to adjust image contrast in Python