Hi !
I have been trying to add shortcuts to Photoshop & Illustrator.
Both of these applications have floating windows which are named ' ahk_class OWL.DocumentWindow ' in WindowSpy.
I am currently using the following code to make shortcuts work in both applications with AHK.
GroupAdd,ai,ahk_exe Illustrator.exe
GroupAdd,ai,ahk_class OWL.DocumentWindow
GroupAdd,ps,ahk_exe Photoshop.exe
GroupAdd,ps,ahk_class OWL.DocumentWindow
However, as both applications have the same ahk_class (OWL.DocumentWindow), the shortcuts don't work for the application that's mentioned second.
If one application is closed, the shortcuts work perfectly.
other things i have tried, but in vain:
GroupAdd,ai,ahk_exe Illustrator.exe
GroupAdd,ai,ahk_class OWL.DocumentWindow
return
GroupAdd,ps,ahk_exe Photoshop.exe
GroupAdd,ps,ahk_class OWL.DocumentWindow
return
Is there a way to let AHK know that these two classes are different & not the same?
(#IfWinActive ahk_group ps & #IfWinActive ahk_group ai are mentioned above each set of shortcuts.
Using AHK v1.1.22.07, win10 )
Please help. Thanks!
How do I use GroupAdd for two seperate applications having same ahk_class name Topic is solved
Re: How do I use GroupAdd for two seperate applications having same ahk_class name Topic is solved
I would probably not use GroupAdd for this, and instead, at the appropriate places:
Code: Select all
;not: the OWL.DocumentWindow line would have to appear above the more generic line
#IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Illustrator.exe
#IfWinActive, ahk_exe Illustrator.exe
#IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Photoshop.exe
#IfWinActive, ahk_exe Photoshop.exe
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: How do I use GroupAdd for two seperate applications having same ahk_class name
Thank you for the suggestion jeeswg! Shall try it out & keep you posted.jeeswg wrote:I would probably not use GroupAdd for this, and instead, at the appropriate places:Code: Select all
;not: the OWL.DocumentWindow line would have to appear above the more generic line #IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Illustrator.exe #IfWinActive, ahk_exe Illustrator.exe #IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Photoshop.exe #IfWinActive, ahk_exe Photoshop.exe
Re: How do I use GroupAdd for two seperate applications having same ahk_class name
jeeswg wrote:I would probably not use GroupAdd for this, and instead, at the appropriate places:Code: Select all
;not: the OWL.DocumentWindow line would have to appear above the more generic line #IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Illustrator.exe #IfWinActive, ahk_exe Illustrator.exe #IfWinActive, ahk_class OWL.DocumentWindow ahk_exe Photoshop.exe #IfWinActive, ahk_exe Photoshop.exe
This worked as expected..which is fantastic Thank you jeeswg!
If possible , could you kindly guide me to the documentation of this specific code explained in the AHK help docs? I'd like to learn more about AHK.
Re: How do I use GroupAdd for two seperate applications having same ahk_class name
Here's the key point. Cheers.
#IfWinActive / #IfWinExist - Syntax & Usage | AutoHotkey
https://autohotkey.com/docs/commands/_IfWinActive.htm
#IfWinActive / #IfWinExist - Syntax & Usage | AutoHotkey
https://autohotkey.com/docs/commands/_IfWinActive.htm
If more than one variant is eligible to fire, only the one closest to the top of the script will fire. The exception to this is the global variant (the one with no #IfWin criteria): It always has the lowest precedence; therefore, it will fire only if no other variant is eligible (this exception does not apply to hotstrings).
Code: Select all
#IfWinActive ahk_class Notepad ;checked 1st
q::MsgBox, % "Notepad"
#IfWinActive ahk_class WordPadClass ;checked 2nd
q::MsgBox, % "WordPad"
#IfWinActive ;checked 3rd
q::MsgBox, % "other"
#IfWinActive ;checked 3rd
w::MsgBox, % "other"
#IfWinActive ahk_class Notepad ;checked 1st
w::MsgBox, % "Notepad"
#IfWinActive ahk_class WordPadClass ;checked 2nd
w::MsgBox, % "WordPad"
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA