Jump to content

Recommended Posts

Posted

Hi everybody,

I have a weird problem. I am getting data from a field in one program (JTAlert) with ControlGetText (which works fine) and want to send it to another program with ControlSend (Log4OM). 8~9 times out of 10 it works but sometimes the ControlSend is sending the "SHIFTVALUE" from the number keys to the second program. By that I mean instead of numbers 3,4 or 9 it sends #,$,( It behaves as if it pushes the shift key and instead of sending a number it sends the "shifted" key.

Both programs are used by HAM operators for digital modes. HAM's have callsigns made out of letters and numbers. Mine for example is KF5WGB. Sometimes my little script sends KF%WGB which of course is wrong.  How can I make the script stop to send the "shifted" values of the number keys. The MSGBOX is only in there for me to see what was pulled from JTAlerts textfield and that is always right. No &,@,$,%,# just numbers.

On more thing. For now I use a timer set to 10000. Is there a way to make the script aware of a mouse click in the first program (JTAlertand only do its thing when the mouse is clicked??

Thanks for any advice.

Cheers

KF5WGB ~ Ralf

include <MsgBoxConstants.au3>
Local $CS, $CSmem

While 1

GetCS()
if $CS <> $CSmem then
SendCALLSIGN($CS)
EndIf
WinActivate("WSJT")
sleep(10000)
WEnd

Func GetCS()
   Local $sText = ControlGetText("JTAlert", "", "Static72") ;Getting text from datafield -program JTAlert
   MsgBox (0,"Callsign", $sText,1) ;what is in the datafield? For some reason $sText is always correct in here(for testing)
      $CS = $sText
   Return $CS
EndFunc


Func SENDCALLSIGN($CS)

WinActivate("Log4OM [User") ; bring window in focus - program Log4OM
ControlSend("Log4OM", "", "[CLASS:WindowsForms10.EDIT.app.0.338574f_r13_ad1; INSTANCE:3]", "{CTRLDOWN}a{CTRLUP}{SHIFTUP}") ; clear field in second application
ControlSend("Log4OM", "", "[CLASS:WindowsForms10.EDIT.app.0.338574f_r13_ad1; INSTANCE:3]", $CS) ; send data from first application. Sometimes send the "SHIFT" value
$CSmem = $CS 

EndFunc

 

Posted

_ispressed can detect the click. As for the behaviour of the ctrlsend.. idk

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...