Trying to send Serial command upon mouse click, 90% there - cmd

I am trying to send a Hex command from the P.C's serial port. So far I am doing this with a batch script using a modification of this code and the "copy" function.
#echo off
echo BEEF100500C6FF111101000100>off.txt
echo BEEF030600DCDB690000000000>on.txt
certutil -decodehex off.txt off.bin
certutil -decodehex on.txt on.bin
MODE COM1:19,n,8,1
copy off.bin \\.\com1 /b
copy on.bin \\.\com1 /b
What I would like to do is send the Hex command any time the mouse wheel is scrolled up, or send a different command any time the mouse wheel is scrolled down.
The missing piece for me is how to read the input from the USB optical mouse, and combine this event with my desired function.
I found this link on Microsofts help page, but I do not understand all of it and I'm not sure how to incorporate this as my solution.
https://learn.microsoft.com/en-us/windows/desktop/inputdev/mouse-input
Open to any solutions except that I'd like to avoid using third part software like AutoHotKey. Any opensource code or executable are O.K.

I'm not sure why you want to do that, but you may wish to adapt the code from this answer for your needs.

Related

How to read from the internal clipboard of a Telerik Kendo Diagram?

I have a system that allows users to create multiple diagrams. I want to be able to copy a part of one diagram, close it, run another and paste in what I have copied. The problem is that the diagram.copy() and diagram.paste() functions use an internal clipboard which is lost when I close the original diagram, so there's nothing to paste when I open the other one.
I'm very new to Telerik, so I don't really know how to approach this. I tried digging through the documentation, but I couldn't see any way to interact with the internal clipboard other than the two functions.
Preferably I'd like to be able to read the internal clipboard, copy it to a global variable and then read the variable back when opening the destination diagram.
Or maybe there's a way to read the selected shapes into a variable without using the copy() function?
Reading the source code, I've found it's stored in the variable diagram._clipboard . You can run this sample and inspect: https://dojo.telerik.com/onunEkib
However, as an undocumented feature, this can change and break when upgrading your Kendo version. Plus, as this is the diagram's internal data, it can be invalid for the target diagram.
What I'd do is a custom copy button that gets the current selection through the select method.

Can AppleScript read mouse position / action in one application and replicate it in another application?

I've been searching for a mouse broadcaster for Mac for a while and it seems there are no solutions for doing this, so I must look for alternative solutions now. I'm wondering if AppleScript is capable of performing such a task. Basically, what I would like to do is read mouse position and action when performed in one application for as long as the script is active, and broadcast/replicate it in one or more other applications. Is AppleScript capable of this?
Just to clarify, I'd need to simulate mouse movement in the other applications... for example, if I opened up several instances of a drawing program, assuming that the program had the same resolution, anything I drew in the main program, would replicate on the other programs.
Really applescript cannot do what you need. It's not made for that. Applescript is made to run the commands in an application's applescript dictionary. I assume that the dictionary of the applications you want to control give you no way to read and control the mouse.
You do have an applescript alternative though. I have made a command line tool to read the mouse position and also to move the mouse. So theoretically you can do what you want with applescript and my tool. I do not believe you will get the results you expect though. Anyway you can try. Here's a link to the web page for my tool. I hope it helps.
Get it here.
Your basic approach could be 1) activate the application you want to read the mouse position, 2) run my tool in a repeat loop and record the mouse positions, 3) activate the second application that you want to duplicate the mouse movements, 4) use a repeat loop with my tool to make the mouse move according to how you recorded it.

Simulating a drag & drop operation using SendInput

Can SendInput be used to simulate a drap & drop operation?
I've got an application that accepts files of a certain format that are dropped on it, but not from the command line, and I want to associate it with a file. I thought I'd create a small tool that finds the window, and simulates a drag & drop of the file - is this at all possible? Do I need to use SendInput or possibly SendMessage? What would be the parameters?
Yes, pretty likely. SendInput injects mouse events at a very low level. SendMessage won't work.
You'll need a thread since DoDragDrop is a blocking call. Fake the mouse down first, start the thread, call DoDragDrop. The thread should sleep to give enough time for DoDragDrop to get started, then fake mouse move and mouse up. Keep fingers crossed that it works the first time, it is impossible to debug if it doesn't.
The shell already has a function that simulates a drop: SHDoDragDrop, no need for hacks like faking mouse input.
Since you are talking about the commandline, XP added support for simulating D&D for applications/registered file types: How do I accept files to be opened via IDropTarget instead of on the command line?

change label text from a VB6 binary (not source code)

we have a VB6 binary executable that comes with no source code. And we need to change the label text for that VB6 application from "AAA" to "BBB". Is there any way or tools that can do that?
The closest tool I can find right now is microsoft UISpy, it can read all the other elements but not the label.
I hope there is a tool that can change the resource in the .exe so that the label "AAA" will read "BBB". Or is it possible to write a wrapper application, it will launch the .exe, examine the application screen for "AAA" and change that to "BBB"?
Thank you for your help!
Instead of tampering with the EXE, it might be worth your while to simply write a simple wrapper that will run silently, obtaining the window handle after enumerating the VB6's parent window and directly modify it at run-time by hooking into VB6's window procedure looking for the handle of the label...
You could end up mistakenly rip out AAA which could be a binary for something else (by coincidence) and thereby breaking the application!...
Have a look here for a similar question in which the SO was trying to modify an AOL window...and here's the direct download for this demo application to obtain the text from an AOL window...this should give you a clue in the direction on how to find the window and enumerate it looking for label that has "AAA"
What about hex-dumping it and searching for all instances of AAA? Try replacing each one in succession with BBB and see if you win.

Windows (Vista): Set process-priority on a program shortcut

Is there any way to launch a program with a shortcut, that sets the process-priority of that program?
iTunes is dragging my system to it's knees, but when I set the process-priority to "low", somehow, like magic, Windows gets back to it's normal responsive self :)
You learn something new every day.
My answer was wrong, but since it was marked accepted I'm editing to be right.
Change your short cut to point to:
start /BELOWNORMAL iTunes.exe
Instead of just iTunes.exe

Resources