samozaparola

Simulate custom ultrasound machine keystrokes

4 posts in this topic

#1 ·  Posted (edited)

I have a Windows XP based ultrasound machine that besides the keyboard has a console with custom controls such as zoom, pause, measure, caliper, etc. As far as I understand, these custom  keys "don't send key combinations; instead, they have their own usage IDs in the HID". So is there a way to simulate pressing these keys in AutoIt?

Edited by samozaparola
typo

Share this post


Link to post
Share on other sites



What happens if you hover over the display with the AutoIt Window Info Tool (in the same directory where you installed AutoIt), what does it show you regarding the controls?


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

@JLogan3o13 I think the OP means it is a physical piece of medical hardware with keys specific to the device.  I think he would need to listen for the input on key press to mimic the values (but there may be other better approaches).


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Yes Jfish, it is a physical type of interface, not an onscreen GUI. here is a short video of an older version of the same model:

One of the problems is that au3record.exe tracks only the keyboard and the mouse events and does not record the activity of these custom buttons.  I don't know in what way this physical interface communicates with the software application, but it may be something different than listening to a key press event. I found a document (HID usage tables, p.126 addresses such medical instruments)

http://www.usb.org/developers/hidpage/Hut1_12v2.pdf

that describes this type of interfaces, but the info is incomplete and I do not know what to do with it.

 

JLogan3o13,  the Window Info Tool works as expected, but I had no luck showing up the measurement menu (all I want is to be able to measure the previously acquired images, remotely from the machine, i.e. at my desk with the mouse). I used the ControlShow command but it works with some controls and not with others, may be my AutoIt scripting is wrong, may be the approach is incorrect. Anyway, even if I succeed in showing or activating the controls, my task may still be impossible this way as some controls forcibly contain the mouse cursor and a particular "cursor" button needs to be pressed to overcome this limitation. So the best way would be to be able to identify those custom input events and to send them to the application. Perhaps some other software tools are needed to accomplish this...

 

Edited by samozaparola

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • corgano
      Help / Reading usb controller with _WinAPI_RegisterRawInputDevices
      By corgano
      Edit: If you already read this post, I updated it to better fit the scope of what I want to do.

      My goal is to be able to read the raw output from a usb type controller (or mouse or keyboard, don't want it to be controller-only) so i can see how / what changes when i hit buttons. I've gotten as far as finding HID page documentation and documentation for the device Struct, but I don't know where to go from here
      How do I tell what and Useage to use for any given controller / Keyboard / Mouse? How do I get a list of all HID devices connected and their UsagePage / Usage? How do I register multiple devices / get raw input from multiple devices at once? Here is the modified example script i am using:
      #include <APISysConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Opt('TrayAutoPause', 0) Global $iFlagsOld = 0, $iDataOld = 0 ; Create GUI Global $g_hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 160, 212, @DesktopWidth - 179, @DesktopHeight - 283, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST) ; To obtain the values of "UsagePage" and "Usage" members of this structure read HID Usage Tables documentation ; http://www.usb.org/developers/devclass_docs/HID1_11.pdf ; Disregaurd that, official USB documention = useless. Here is a human/normal-person friendly list ; http://www.freebsddiary.org/APC/usb_hid_usages.php ; Information on the Struct (eg what Flags and hTarget do) can be found here ; https://msdn.microsoft.com/en-us/library/ms645565(v=vs.85).aspx Local $tRID = DllStructCreate($tagRAWINPUTDEVICE) DllStructSetData($tRID, 'UsagePage', 0x01) ; Generic Desktop Controls DllStructSetData($tRID, 'Usage', 0x06) ; Mouse DllStructSetData($tRID, 'Flags', $RIDEV_INPUTSINK) ; This flag makes window hTarget accept input even when it's not active. MUST define hTarget DllStructSetData($tRID, 'hTarget', $g_hForm) ; The target window that will be sent events, used with some Flags ; Register HID input to obtain row input _WinAPI_RegisterRawInputDevices($tRID) ; Register WM_INPUT message GUIRegisterMsg($WM_INPUT, 'WM_INPUT') ;~ GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam Switch $hWnd Case $g_hForm Local $tRIM = DllStructCreate($tagRAWINPUTMOUSE) If _WinAPI_GetRawInputData($lParam, $tRIM, DllStructGetSize($tRIM), $RID_INPUT) Then Local $iFlags = DllStructGetData($tRIM, 'Flags') Local $sFlag = "", $sData = "" $iFlags = DllStructGetData($tRIM, 'ButtonFlags') If $iFlags <> $iFlagsOld Then $sFlag = $iFlags $iFlagsOld = $iFlags EndIf $iData = DllStructGetData($tRIM, 'ButtonData') If $iData <> $iDataOld Then $sData = $iData $iDataOld = $iData EndIf If $sFlag&$sData <> "" Then ConsoleWrite($sFlag&" "&$sData&@CRLF) EndIf EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_INPUT
      Old post:
       
    • sswcharlie
      Multiple USB Devices - GUI
      By sswcharlie
      For a model railway project only.  Using multiple  rfid readers. These readers have no PID or VID or serial numbers.
      Only difference is the hub/port number allocated.

      Using Win7  32 bit.

      The only information I need to obtain from the HID devices is:

      hub/port number
      last string transmitted.  (14 character string of the rfid tag number)
      timestamp of the latest reading.

      The tag data will be moved to excel immediately after received by usb ready for the next read.  Timestamp and data would be overwritten by next set of data.
      the GUI would have single line for each reader (by hub/port #) with 3 headings.  Timestamp, 14 character data, and hub/port # .
      Is it possible for Autoitscript to have a GUI to do this ?

      Thankyou

      Charles Harris
       
    • gononono64
      Looking to cancel a keystroke to fully rebind keys
      By gononono64
      Hey im looking to rebind my wasd keys to arrow keys in order to play a game using my phone and chrom remote access. I tried using controlsend to send a arrow keys when i push wasd. Problem lies in that it sends both w (for example) and the up arrow key aswell as asd etc. Any ideas how to get around this?
    • corgano
      Disable GUI's "caching" keystrokes
      By corgano
      The scenario is thus: You have a button on a gui, and it does an action that takes some time - let's just assume it is a sleep(20000).
      The user clicks the button, the script does it's thing. HOWEVER if the user gets impatient and clicks the button again before it finishes, or if they spam the button, you will get an endless looping of the function over and over.

      Is there any way that if I had a function that took a while to run, and someone clicked the button to start/restart it again, that I could immediately kill/return the function instead of waiting for it to finnish? Or would there be a way to disable the gui from accepting and clicks or keystrokes until the current function finishes executing? My goal is to avoid the pressing the button twenty times impatiently making it do the same thing over and over.