pyahk icon indicating copy to clipboard operation
pyahk copied to clipboard

not work

Open superuser7777 opened this issue 1 year ago • 2 comments

I configured it according to the readme, but it didn't work. Both example1 and 2 have the same error. Is there a setting I'm overlooking?

ImportError                               Traceback (most recent call last)
X:\temp/ipykernel_24620/1116311586.py in <module>
----> 1 from pyahk import MouseGetPos, mul
      2 from pyahk import *
      3 
      4 AhkApi.initialize()  # init ahk
      5 AhkApi.addScript('''

ImportError: cannot import name 'MouseGetPos' from 'pyahk' (d:\SOFT\dev\_runtime\_python\Winpython310\python-3.10.0.amd64\lib\site-packages\pyahk\__init__.py)
ImportError                               Traceback (most recent call last)
X:\temp/ipykernel_24620/154558150.py in <module>
----> 1 from pyahk import Gui, MsgBox, FileAppend, Array, Map, JSON, Hotkey, HotIf, WinActive
      2 from ctypes import c_wchar_p
      3 from pyahk import *
      4 
      5 AhkApi.initialize()  # init ahk

ImportError: cannot import name 'Gui' from 'pyahk' (d:\SOFT\dev\_runtime\_python\Winpython310\python-3.10.0.amd64\lib\site-packages\pyahk\__init__.py)

btw, the URL of "Download ZIP" is VSCode lsp.

superuser7777 avatar Nov 13 '24 08:11 superuser7777

Before importing variables, you need to initialize the ahk.

Move the first line after the fifth line.

thqby avatar Nov 13 '24 10:11 thqby

It worked fine. Thank you for the wonderful library. Imgur Image

superuser7777 avatar Nov 13 '24 19:11 superuser7777