Learn How to Pass arguments to a Python Script and run it using Autohotkey Macro in Windows

Here I have provided you with a two little scripts that work in harmony. You can call a python script and provide arguments to it.

The script is called using an autohotkey script. Enjoy

The code is given below

Breakdown of Above Scripts


This script on line 5 requests for an argument in command line.

Line 6 receives all the passed arguments

Line 8 gets the actual argument’s value in “value” variable.

Line 9 obviously prints it on the screen.


Line 6 stands for the hotkey of WIN+CTRL+SPACE

Line 7 opens a CMD terminal in windows

Line 9 keeps the autohotkey script waiting until CMD opens.

Line 10, 11 navigate to the script folder.

Line 12 executes the python script by passing the required arguments.

By codeonion

Codeonion contributes to the honorable mission of “helping people learn and earn online”. Whether your day job is creative or not, life is better when you learn and apply creative skills regularly. To do this is satisfying in its own right and a practical investment in your future.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.