SQL Police
SQL Police

Reputation: 4206

Sending key strokes to a window

I want to use AutoHotkey to run a program and send some keystrokes. But I don't get it to work. The program pops up, and then nothing happens.

Here is what I have so far:

run, c:\windows\sysnative\gfxv4_0.exe
WinActivate, "Intel(R) Graphics Control Panel"
SendInput {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Enter}

Just for testing, I have also tried to send some keys to notepad, but that doesn't work either. The notepad window pops up, but then nothing:

run notepad.exe
WinActivate "Unbenannt - Editor"
SendInput abc{Tab}{Tab}xyz

I have also tried WinActivate without parameters, but no results either. Have also tried with Send, SendPlay, SendEvent and SendRaw. No change.

System is Windows 8.1 64 Bit, latest Service Packs. Core i7, 8 GB, 2 screens.

Upvotes: 0

Views: 1188

Answers (1)

woxxom
woxxom

Reputation: 73836

  1. Remove the quotes
    The parameters of AHK commands are literal strings unless specified otherwise in the help for a command or you explicitly make the parameter an expression: WinActivate, % "some string"
  2. Wait for the window to appear before activating it because launching an application takes time:
    WinWait Intel(R) Graphics Control Panel

  3. Maybe there's ® instead of (R). Use the exact window title text from Window Spy application that comes with AutoHotkey.

Upvotes: 1

Related Questions