thqby / pyahk

31 stars 5 forks source link

not work #2

Open superuser7777 opened 1 week ago

superuser7777 commented 1 week ago

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.

thqby commented 1 week ago

Before importing variables, you need to initialize the ahk.

Move the first line after the fifth line.

superuser7777 commented 1 week ago

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