Jump to content

Help with SendKey


chde
 Share

Recommended Posts

For starters i just wanna say im a COMPLETE noob when it comes to AutoIT.

So i want AutoIT to start "AdobeCreativeCloudCleanerTool.exe" (which basically starts a command prompt), i then want AutoIT to send keys and press enter after each keypress.

Example: Start AdobeCreativeCloudCleanerTool, wait 1 sec, press e, wait 1 sec, press enter and so on.

AdobeCreativeCloudCleanerTool has no title so i cant use WinActive. It has a class (ConsoleWindowClass)

Ive only come this far:

ShellExecute("AdobeCreativeCloudCleanerTool.exe")
Sleep(1000)
Send("e")
Sleep(1000)
Send({ENTER})

 

The program starts, but no command is sent. How do i do this?

Link to comment
Share on other sites

Have you tried using:

ControlCommand

?

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Try this :

$pid = ProcessWait("AdobeCreativeCloudCleanerTool.exe")
$hwnd = _GetHwndFromPID($pid)
Sleep(1000)
ControlSend($hwnd, "", "", "e",0)
Sleep(1000)
ControlSend($hwnd, "", "", "{ENTER}",0)

Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
                DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
             EndIf
             ConsoleWrite(@CRLF &$winlist2[$i][0])
        Next
    Until $hWnd <> 0
    Return $hWnd
EndFunc ;==>_GetHwndFromPID

No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Link to comment
Share on other sites

As a noob it's helpfull to read the help, specialy:

  • Using AutoIt, whith all SubItems
  • Tutorials, whith all SubItems
  • Language Reference, whith all SubItems
  • Function Reference, from beginning to File, Directory and Diskmanagement specialy: ConsoleWrite
  • Process Management specialy: Run, StdErrRead, StdInWrite

Also helpfull is to search for Threads with TAG's Run, StdInWrite.

Have you ever started the AdobeCreativeCloudCleanerTool with Option /h?  Have a look if is possible to execute it silent with Parameters

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