Jump to content

send enter to process finish .


Go to solution Solved by AlessandroAvolio,

Recommended Posts

Posted

we have process to run with command 

when its finish its ask "press enter to continue"

All the commands I give, send ENTER or CONTROL SEND do not work
I attach the picture of the process,
A code I wrote recently that also does not help,

I even made an infinite Loop that sends ENTER and nothing happens.


Is there a way to send him an ENTER to complete the process on his own?

 

Local $hWnd=WinWaitActive("C:\Users\ADMINM~1\AppData\Local\Temp\FDT\fdt2.exe","")
While 1

Sleep(2000)
ControlSend($hWnd, "", "", "{TAB}{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{TAB}{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
WEnd

 

press tnter.JPG

Posted

I run this processor from another program in c #,the process running For sure !! ,

When I run the code I wrote without the loop it detects that the process is working in the background and ends properly, the problem is that it does not really send enter

Posted
  On 9/28/2021 at 6:31 PM, heziavi said:

When I run the code I wrote without the loop it detects that the process is working in the background and ends properly, the problem is that it does not really send enter

Expand  

Did you try to activate (WinActivate) the window just before sending ENTER ?  (Duplicate, emphasis added)

Code hard, but don’t hard code...

Posted

You need to give us the Run or Shell command you are using to start your program.

Actually post all the code using the <> button in the toolbar.

 

Code hard, but don’t hard code...

Posted

This is one of the codes I tried, but I tried all the versions

ShellExecute("fdt2.exe","","C:\Users\aadmin\AppData\Local\Temp\FDT")
Local $hWnd=WinWait("C:\Users\admin\AppData\Local\Temp\FDT\fdt2.exe","")

WinActivate($hWnd,"")


Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(2000)
ControlSend($hWnd, "", "", {ENTER}")
Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
 

Even if put in an infinite loop it does not work!!!!!

While 1
Sleep(2000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", 'abc')
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
WEnd

 

Posted

You said that the window closes normally if you press ENTER with the keyboard. Let's try to understand if the problem is the focus. Let's try to send the ENTER key with SEND command after the focus has been activated by clicking the mouse on the window. Replace in $aCoord array the coordinates of a point of the window you want to close.

Main()


Func Main()

    Local Const $aCoord[2] = [634, 355] ; put coords window

    Sleep(1000)
    MouseClick("left", $aCoord[0], $aCoord[1])
    Sleep(1000)
    Send("{ENTER}")

    Return 0

EndFunc

 

Posted

It's certainly not related to focus, if I run cmd.exe  and send enter or a character everything works, it's probably impossible to send commands to it, just like it's not possible to send a password to a Bitlocker when running manage-bde -changepassword 😄

Its some problem.

Posted
  On 9/29/2021 at 11:31 AM, heziavi said:

Its some problem.

Expand  

Why not just:

RunWait("C:\Users\admin\AppData\Local\Temp\FDT\fdt2.exe", "C:\Users\admin\AppData\Local\Temp\FDT")

and forget all the Sends.

btw, I changed “aadmin” to “admin” in the working directory path.  If this was not a typo, change it back to aadmin.

Code hard, but don’t hard code...

Posted

Shure shure .

I not see you.

But i send alt+f4

I not wanting in video  while processing finish.

You want i see you?

I send more videos.

Its not working.

 

  • Solution
Posted

I am happy. Unfortunately I don't know the application, can't you try the same way? And if you copy and paste the text, does it work? You could try with Clipput and then with Send ("^ v"). I can't tell you anything else

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...