Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to Enable Auto hotkey in Certain Program Only



  • Please log in to reply
9 replies to this topic
NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

Is This Possible

 

 

scenario :

 

I have 3 preset of AutoHotkey all running at notification area 

 

which is

 

2D.ahk

3D.ahk

desktop.ahk

 

 

for example if Photoshop is active it will disable the 2 Hotkey

and only 2D.ahk will be active

 

now when i switch to 3D program Maya or Blender it will disable the 2D.ahk and desktop.ahk and 3D.ahk will be active

 

 

now when i open chrome and word document it will disable the 2D.ahk and 3D.ahk

 

can someone provide some examples 

thank you



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

Have a look at the #IfWinActive directive or at the #If directive in combination with the WinActive built-in function.


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

Have a look at the #IfWinActive directive or at the #If directive in combination with the WinActive built-in function.

 

 

im sorry i really cant understand the function

my mind is going to explode if i will try to undestand it there is so many underline links :(( which is related to each other but i really cant understand it 

im really not good in scripting 

 

can anyone provide example script i really appreciate it

im sorry for being spoonfeed type but im really desperate to have this kind of script

this will speedup my workflow .. 

 

im sorry again and thank you



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Here's a quick example for you to get familiar with it.
 

SetTitleMatchMode, 2 ; This let's any window that partially matches the given name get activated
#IfWinActive, Chrome
F1::MsgBox You are currently using Google Chrome
 
#IfWinActive, Notepad
F1::MsgBox You are currently using Notepad
 
#IfWinActive, Firefox
F1::MsgBox You are currently using Firefox
 
#IfWinActive, ABBY Screenshot Reader
F1::MsgBox You are currently using ABBY Screenshot Reader
 
#If
F1::MsgBox You are currently using a program that is not Chrome, Notepad, Firefox, or ABBY Screenshot Reader.

 

Try pressing F1 while you have any of those programs active (or not) and notice that you get different results.



NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

Here's a quick example for you to get familiar with it.
 

SetTitleMatchMode, 2 ; This let's any window that partially matches the given name get activated
#IfWinActive, Chrome
F1::MsgBox You are currently using Google Chrome
 
#IfWinActive, Notepad
F1::MsgBox You are currently using Notepad
 
#IfWinActive, Firefox
F1::MsgBox You are currently using Firefox
 
#IfWinActive, ABBY Screenshot Reader
F1::MsgBox You are currently using ABBY Screenshot Reader
 
#If
F1::MsgBox You are currently using a program that is not Chrome, Notepad, Firefox, or ABBY Screenshot Reader.

Try pressing F1 while you have any of those programs active (or not) and notice that you get different results.

 

hi thanks for this it works in my 2 AHK preset which is 3D.AHK and desktop.ahk

but when using 2d.ahk ( which is photoshop )  it doesnt work any idea?

 

when i check spy

Adobe Photoshop CC 2014 <= no document/canvas present

Untitled-1 @ 50% (RGB/8) <= when created new document

tried each but it doesntwork

 

now ive tested in plain ahk wheres there's no swapping of hotkeys involve

only this script written

 

#IfWinActive, Adobe Photoshop CC 2014

F1::MsgBox this is a test
 
and it doesnt work ...........  now ive created again a fresh ahk script then paste this
 
#IfWinActive, Untitled-1 @ 50% (RGB/8) 

F1::MsgBox this is a test

 

also doesnt work

do you have alternate  solution ?


NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

hi again sorry for bumping

#IfWinActive, Adobe Photoshop CC 2014

F1::MsgBox this is a test
#IfWinActive, Untitled-1 @ 50% (RGB/8) 

F1::MsgBox this is a test

 
this doesnt work and doesnt detect photoshop ... 

 

 

i think i find another solution or idea but i dont know how to do it

 

how about this

 

whenever i click  Maya or Blender to make it active Window

it will Automatically Suspend the hotkey 

 

but it will reactivate the suspend hotkey  again if i click another application that isnt listed

is this possible?



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013
✓  Best Answer

You can try the window class.

#IfWinActive, ahk_class Photoshop

Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

 

You can try the window class.

#IfWinActive, ahk_class Photoshop

 

You can try the window class.

#IfWinActive, ahk_class Photoshop

 

 

 

hey thank you so much this really solve the problem 



NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

sorry for spam internet lag



NoobGraphicArtist
  • Members
  • 42 posts
  • Last active: Mar 15 2016 12:17 PM
  • Joined: 23 Oct 2014

sorry for spam