spyoungtech/ahk

msg_box crashes with AHK v2

michaelmesser opened this issue · 2 comments

describe your issue

msg_box crashes with AHK v2. I don't see this documented as not working with v2 so I assume that it is a bug.

ahk.version

1.6.1

AutoHotkey version

v2

Code to reproduce the issue

ahk = AHK(version='v2')
ahk.msg_box(text='Test', title='My Title')

Traceback/Error message


AHKExecutionException Traceback (most recent call last)
Cell In[2], line 2
1 ahk = AHK(version='v2')
----> 2 ahk.msg_box(text='Test', title='My Title')

File c:\Folder\Hotkeys\venv\Lib\site-packages\ahk_sync\engine.py:3747, in AHK.msg_box(self, text, title, buttons, icon, default_button, modality, help_button, text_right_justified, right_to_left_reading, timeout, blocking)
3745 if timeout is not None:
3746 args.append(str(timeout))
-> 3747 return self._transport.function_call('AHKMsgBox', args, blocking=blocking)

File c:\Folder\Hotkeys\venv\Lib\site-packages\ahk_sync\transport.py:609, in Transport.function_call(self, function_name, args, blocking, engine)
607 request = RequestMessage(function_name=function_name, args=args)
608 if blocking:
--> 609 return self.send(request, engine=engine)
610 else:
611 return self.send_nonblocking(request, engine=engine)

File c:\Folder\Hotkeys\venv\Lib\site-packages\ahk_sync\transport.py:830, in DaemonProcessTransport.send(self, request, engine)
828 content = content_buffer.getvalue()[:-1]
829 response = ResponseMessage.from_bytes(content, engine=engine)
--> 830 return response.unpack()

File c:\Folder\Hotkeys\venv\Lib\site-packages\ahk\message.py:219, in ExceptionResponseMessage.unpack(self)
217 def unpack(self) -> NoReturn:
218 s = self._raw_content.decode(encoding='utf-8')
--> 219 raise self._exception_type(s)

AHKExecutionException: Error occurred in Array.Prototype.__Item.Get (line 2544). The error message was: Invalid index.. Specifically: 4
Stack:
C:\Users\user\AppData\Local\Temp\python-ahk-1ehwfsy8.ahk (2544) : [Array.Prototype.__Item.Get] timeout := args[4]
C:\Users\user\AppData\Local\Temp\python-ahk-1ehwfsy8.ahk (2544) : [AHKMsgBox] timeout := args[4]
C:\Users\user\AppData\Local\Temp\python-ahk-1ehwfsy8.ahk (2744) : [] pyresp := %func_name%(argsArray*)

Auto-execute

Thanks for the report. Yes, this definitely looks like a bug. I will have a fix out for this soon.

This should now be fixed in version 1.6.2