ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Read from one field, place data into another field

(1/1)

SparkyPine:
We would like to be able to read specific field data derived from something like, say, a counting scale (connected to a pc with a serial cable) and have that value auto-fill into a specific field in a different window.  It would eliminate transcription errors by not requiring users to retype these values. 

Bonus for being able to customize the source and destination data fields!  I suppose, technically, it wouldn't matter where the source field is, I can get the data from the scale...would be nice to be able to use this for lots of other things besides scales.

 

skrommel:
 :) Using AutoHotkey you can do this, but not in a generic way, cause there's no unified way of getting the data out of different programs and controls.

Here's a sample using ControlGetText. Use AutoHotekey's WinSpy to get the names of the windows and controls you want to access, and fill them into the script. If you can't make it work, please post some program info, windows titles and control names and types here, and I'll try it out.

It would also be easy to implement keyboard or mouse actions before and after getting and sending data, or check if the data has changed, etc.


--- ---;InControl.ahk

#NoEnv
interval=1000  ;time in ms

sourcewindow=Calculator
sourcecontrol=Edit1

targetwindow=Untitled - Notepad
targetcontrol=Edit1

Loop
{
  Sleep,%interval%
  ControlGetText,data,%sourcecontrol%,%sourcewindow%
  ControlSetText,%targetcontrol%,%data%,%targetwindow%
}

SparkyPine:
skrommel -

This is rather slick.  Thank you very much for both your time and your suggestions.  We will tinker around and see how it goes.

Navigation

[0] Message Index

Go to full version