KF5WGB

ControlSend acts weird

2 posts in this topic

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

 

Share this post


Link to post
Share on other sites



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


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

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