AutoHotKey: How to make my script run only within a specific program?

Mastaxx

I have made an AHK script that adds metadata to video clips within Avid Media Composer (video editing software). It does this by entering all the necessary sub-menu's and sends mouse clicks to locations on the screen that make a laborious task easy when needing to do it over and over all day.

However, i want the script to only run within Avid Media Composer and nothing else. There are other storage systems connected to the machine and i wouldn't want the script going into other files/folders accidentally doing who knows what to important data.

I tried using #IfWinActive but i'm not very experienced and not sure why i cant get it to work.

Here's what i need to do:

If 'Avid Media Composer' is the active window, run 'My Code'. If anything other than Avid Media Composer is the active window, Msgbox 'Avid Media Composer must be the active window to run this task'.

-

Window Title, Class and Process

Avid Media Composer Mojo DX

ahk_class Qt5QWindowIcon

ahk_exe AvidMediaComposer.exe

-

My Code:

F3::

 {
    BlockInput, MouseMove
    Hotkey, LButton, DummyLabel, On
    Hotkey, RButton, DummyLabel, On
    Hotkey, MButton, DummyLabel, On
    Sleep, 20
    Send, {LAlt}
    Sleep, 20
    Send, {Right}
    Sleep, 200
    Send, {Right}
    Sleep, 20
    Send, {Right}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Right}
    Sleep, 20
    Send, {Enter}
    Sleep, 100
    MouseClick, Left, 107, 30
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Down}
    Sleep, 20
    Send, {Enter}
    Sleep, 100
    MouseClick, Left, 346, 38
    Sleep, 200
    Send, ^v
    Sleep, 200
    Send, {Enter}
    Sleep, 200
    Send, {Enter}
    Sleep, 200
    MouseClick, Left, 91, 102
    Sleep, 100
    MouseClick, Left, 92, 100
    Sleep, 100
    MouseClick, Left, 143, 154
    Sleep, 100
    Send, {Down}
    BlockInput, MouseMoveoff
    Hotkey, LButton, DummyLabel, Off
    Hotkey, RButton, DummyLabel, Off
    Hotkey, MButton, DummyLabel, Off

 }
return

DummyLabel:
return

What is the correct code for this series of commands to run only within Avid Media Composer itself and nothing else?

Many thanks for any help in advance.

harrymc

You should have a look at the following references :

According to your info the following three are all possible :

SetTitleMatchMode, 2
#IfWinActive Avid Media Composer

#IfWinActive ahk_class Qt5QWindowIcon

#IfWinActive ahk_exe AvidMediaComposer

Example :

SetTitleMatchMode, 2
#IfWinActive Notepad
F3:: MsgBox, IN
return
#IfWinNotActive Notepad
F3:: MsgBox, OUT
return

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I make my program run only the second output?

From Dev

How can you run autohotkey script in background only with PID available?

From Dev

How can I make Mix run only specific tests from my suite of tests?

From Dev

How can I make my .exrc script work only for specific files extension?

From Dev

How to run an autohotkey script in Python (2.7)

From Dev

How to make an Autohotkey automatically run at startup?

From Dev

How to run another program and have it output to only a specific part of the terminal

From Dev

How to make a Python script compile and run C++ program with CMake

From Dev

How can I make my program run on startup by adding it to the registry?

From Dev

How to run a program that has its own command line within a shell script program

From Dev

How to run python script only once in a specific day of the week in bash

From Dev

How can I make my sed script run faster?

From Dev

How to make my ajax polling run for 5 times only then terminate

From Dev

How to run a timeout "within" a script?

From Dev

trying to make a menu for a program and run a specific function

From Dev

A way to make a file decryptable only by specific program?

From Java

How do I run a program with commandline arguments using GDB within a Bash script?

From Dev

How do I make a shell program run with the script name? and script help

From Dev

AutoHotKey Script Continually Opening Program

From Dev

AutoHotKey Script Continually Opening Program

From Dev

I want to make my current macro only run on the specific row that is changed

From Dev

How can I make a SAS dataset read only within a SAS program?

From Dev

How can I make a SAS dataset read only within a SAS program?

From Dev

How to make a JAVADOC of my program?

From Dev

How to make my program faster

From Dev

How to run AutoHotKey script as an admin every time a user logs in?

From Dev

Autohotkey: How to use nested double quotes on a run statement in ahk script

From Dev

How to make Arduino run a script

From Dev

How can make script run?

Related Related

  1. 1

    How do I make my program run only the second output?

  2. 2

    How can you run autohotkey script in background only with PID available?

  3. 3

    How can I make Mix run only specific tests from my suite of tests?

  4. 4

    How can I make my .exrc script work only for specific files extension?

  5. 5

    How to run an autohotkey script in Python (2.7)

  6. 6

    How to make an Autohotkey automatically run at startup?

  7. 7

    How to run another program and have it output to only a specific part of the terminal

  8. 8

    How to make a Python script compile and run C++ program with CMake

  9. 9

    How can I make my program run on startup by adding it to the registry?

  10. 10

    How to run a program that has its own command line within a shell script program

  11. 11

    How to run python script only once in a specific day of the week in bash

  12. 12

    How can I make my sed script run faster?

  13. 13

    How to make my ajax polling run for 5 times only then terminate

  14. 14

    How to run a timeout "within" a script?

  15. 15

    trying to make a menu for a program and run a specific function

  16. 16

    A way to make a file decryptable only by specific program?

  17. 17

    How do I run a program with commandline arguments using GDB within a Bash script?

  18. 18

    How do I make a shell program run with the script name? and script help

  19. 19

    AutoHotKey Script Continually Opening Program

  20. 20

    AutoHotKey Script Continually Opening Program

  21. 21

    I want to make my current macro only run on the specific row that is changed

  22. 22

    How can I make a SAS dataset read only within a SAS program?

  23. 23

    How can I make a SAS dataset read only within a SAS program?

  24. 24

    How to make a JAVADOC of my program?

  25. 25

    How to make my program faster

  26. 26

    How to run AutoHotKey script as an admin every time a user logs in?

  27. 27

    Autohotkey: How to use nested double quotes on a run statement in ahk script

  28. 28

    How to make Arduino run a script

  29. 29

    How can make script run?

HotTag

Archive