J
J
Jasee Cambatch2020-01-03 18:19:48
Programming
Jasee Cambatch, 2020-01-03 18:19:48

How to bind a script to a specific window?

Found the code like I need, edited it.
The bottom line is to alternately press the buttons 1 2 3 4 in a minimized window, cyclically.
Now I want to bind it so that it works only in a certain window, I tried using ahk_class, but I ran into a problem.
I have two windows, identical - and both have the same ahk class, how to make the script work only in the second window?

vk71::
Loop 
If isKeyPressed :=!isKeyPressed
    {
     {
       ControlSend,, {vk31 Down}, ahk_class SimWindow
       KeyWait, vk71
       Sleep 3150
       Send, {vk31 Up}
  
     }

  
  
       {
    ControlSend,, {vk32 Down}, ahk_class SimWindow 
    KeyWait, vk71
    Sleep 3150
    Send, {vk32 Up}
     }
  
    
      {
      ControlSend,, {vk33 Down}, ahk_class SimWindow
            Sleep 3150			
      KeyWait, vk71
      Send, {vk33 Up}
      }
      {
      ControlSend,, {vk34 Down}, ahk_class SimWindow
            Sleep 3150			
      KeyWait, vk71
      Send, {vk34 Up}
        }
  
  }
return
vk73::Pause

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question