This addon will execute whatever is on your clipboard as a python script after you press a hotkey defined in preferences. Great productivity booster if you’re running scripts copied from the internet, and also great for running arbitrary scripts from AHK.
Execute Python from Clipboard v2.py (4.2 KB)
For AHK v1, just do something like this, for storing the Python inside the AHK script:
CapsLock & q::
Clipboard =
(
import bpy ; You don't need this line, I just included it to show how to write multi-line strings in AHK without the ugly new line characters.
print("Example")
)
Send, +{Insert} ; The hotkey that you set up in the addon preferences.
return
Or like this, for storing it in an external file:
CapsLock & q::
FileRead, PyContent, C:\Example.py ; Location of the py in your computer.
Clipboard := PyContent
Send, +{Insert} ; The hotkey that you set up in the addon preferences.
return