Jump to content

Help with SendKey

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:



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

Share this post

Link to post
Share on other sites

Have you tried using:



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


Share this post

Link to post
Share on other sites

Try this :

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

Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
        $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]
             ConsoleWrite(@CRLF &$winlist2[$i][0])
    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)

Share this post

Link to post
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

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

  • Create New...