Jump to content

Increase reliability that it sends correctly


Aarstad
 Share

Recommended Posts

My program is sitting in the background, waiting for a program to stop existing, then execute the if loop when it doesnt exist.

The program will open run, write in the dir to the program manually and press enter. However, sometimes it fails (it seems like the shift key is tampering with it) so what I did was create a Do it again Untill it fits. Still, it sometimes messes it up by doubling it.

#NoTrayIcon
While 1

If Not WinExists ("Local Online Communicator") Then
ProcessClose ("LOC.exe")
ProcessWaitClose ("LOC.exe")
Send ("{shiftup}{altup}{ctrlup}")
Send ("#r")
Sleep (100)
If WinExists ("Ejecutar") Then
$winrun = "Ejecutar"
ElseIf WinExists ("Run") Then
$winrun = "Run"
ElseIf WinExists ("Kjør") Then
$winrun = "Kjør"
EndIf
ControlGetFocus ($winrun)
$locdir = "c:LOCLOC.exe"
SendKeepActive ($winrun)

; here is the problem spot
Do
Sleep (400)
ControlSend ($winrun, "", "[CLASS:Edit; INSTANCE:1]", "{lctrl a}")
ControlSend ($winrun, "", "[CLASS:Edit; INSTANCE:1]", $locdir & "{enter}")
Until ControlGetText ($winrun, "", "[CLASS:Edit; INSTANCE:1]") = $locdir
;------------------------------------

WinWait ("Local Online Communicator")
WinSetState ("Local Online Communicator", "", @SW_MINIMIZE)
Send ("{shiftup}{altup}{ctrlup}")
EndIf
Sleep (600)
WEnd

Any suggestions to increase the reliability? I cannot use run or shellexecute, there seems to be some limitation or security feature in the program itself.

Edited by Aarstad
Link to comment
Share on other sites

Are you sure there is security feature in the program?

I had problems using Run() not running but i noticed i can do this

Run ($path & "" & $program, $path)

that fixed the problem for me.

If you haven't tryed it yet please do and tell me if it helped.

Link to comment
Share on other sites

Are you sure there is security feature in the program?

I had problems using Run() not running but i noticed i can do this

Run ($path & "" & $program, $path)

that fixed the problem for me.

If you haven't tryed it yet please do and tell me if it helped.

Yes I have tried that as well. The problem isn't that the program doesn't run, it runs fine. But all the configs from the installed folder are copied and launched from the script dir, so the program loads without any settings.

This is either some weird bug, or it might be a security feature. Who knows?

I increased the reliability by doing the following:

Do
Controlsend ($window, "", CONTROLID, "{end}+{home}{backspace}")
Controlsend ($window, "", CONTROLID, "write whatever here")
Sleep (5)
Until Controlgettext ($window, "", CONTROLID) = "whatever you want it to be "
Edited by Aarstad
Link to comment
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
 Share

  • Recently Browsing   0 members

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