Skip to content

Commit

Permalink
failed attempt to implement playEvents with python.
Browse files Browse the repository at this point in the history
  • Loading branch information
quintijn committed Jun 4, 2024
1 parent c7e1ea1 commit 7c1e3c7
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions pythonsrc/src/natlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import contextlib
import win32api
import win32gui
from dtactions.vocola_sendkeys import ext_keys
from dtactions.vocola_sendkeys import ext_keys ### , SendInput
W32OutputDebugString = ctypes.windll.kernel32.OutputDebugStringW

#copied from pydebugstring.
Expand Down Expand Up @@ -84,6 +84,7 @@ def playString(a, hook=0):
# normal case:
return ext_keys.send_input(a)


def playEvents16(events):
"""a short version, written by Dany Finlay
"""
Expand All @@ -92,15 +93,22 @@ def playEvents16(events):
if not isinstance(events, list):
raise TypeError("events must be a list of 3-tuples")

# Post each 3-tuple event to the foreground window.
hwnd = win32gui.GetForegroundWindow()
for event in events:
if not (isinstance(event, tuple) and len(event) == 3 and
all((isinstance(i, int) for i in event))):
raise TypeError("events must be a list containing 3-tuples of"
" integers")
message, wParam, lParam = event
win32api.PostMessage(hwnd, message, wParam, lParam)
print('playEvents not implemented for Dragon 16 (yet)')
# try to attach to (repository) \dtactions\vocola_sendkeys
# SendInput.send_input(events)


# this is the attempt of Dane, which fails.
# # Post each 3-tuple event to the foreground window.
# hwnd = win32gui.GetForegroundWindow()
# for event in events:
# if not (isinstance(event, tuple) and len(event) == 3 and
# all((isinstance(i, int) for i in event))):
# raise TypeError("events must be a list containing 3-tuples of"
# " integers")
#
# message, wParam, lParam = event
# win32api.PostMessage(hwnd, message, wParam, lParam)

def playEvents(a):
"""causes a halt (ESP error) in Dragon 16.
Expand Down

0 comments on commit 7c1e3c7

Please sign in to comment.