Embedding Python in AHK
Posted: 18 May 2015, 09:14
I'm trying to embed some python code into an ahk script, and get it to run the python code.
Please can somebody shed some light on why the following autohotkey code to run a defined string of python code using my python installation isn't working.
The dll file is definitely at that location, if I msgbox the results of the dllcalls i get (in order): 503316480 , 68762920 , -1 , 0 . The second number changes every time, but the others are always the same
My end goal is to create a hotkey that will copy any selected text and run it as a python script. Once this part is working, the rest will fit into place.
Thanks all!
Please can somebody shed some light on why the following autohotkey code to run a defined string of python code using my python installation isn't working.
The dll file is definitely at that location, if I msgbox the results of the dllcalls i get (in order): 503316480 , 68762920 , -1 , 0 . The second number changes every time, but the others are always the same
My end goal is to create a hotkey that will copy any selected text and run it as a python script. Once this part is working, the rest will fit into place.
Code: Select all
py =
(
import ctypes
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)
)
DllCall("LoadLibrary", "str", A_WinDir "\SYSTEM32\python33.dll")
DllCall(A_WinDir "\SYSTEM32\python33.dll\Py_Initialize", "Cdecl")
DllCall(A_WinDir "\SYSTEM32\python33.dll\PyRun_SimpleString", "str",py, "Cdecl")
DllCall(A_WinDir "\SYSTEM32\python33.dll\Py_Finalize", "Cdecl")