topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 10:53 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Read from one field, place data into another field  (Read 4398 times)

SparkyPine

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
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

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Read from one field, place data into another field
« Reply #1 on: April 14, 2007, 05:39 AM »
 :) 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

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: Read from one field, place data into another field
« Reply #2 on: April 25, 2007, 02:05 PM »
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.