Reputation: 18010
How can I define several shortcut for a specific program using more concisely from following code?
#IfWinActive ahk_class AcrobatSDIWindow
0::Send !vp ^0
#IfWinActive ahk_class AcrobatSDIWindow
1::Send ^1
#IfWinActive ahk_class AcrobatSDIWindow
2::Send !vpc ^2
How define some shortcut common between some similar programs (e.g. PDF reader softwares)
Upvotes: 0
Views: 782
Reputation: 7953
@Reza,
To combine multiple applications, use the GroupAdd. Place the GroupAdd together with the SetTitleMatchMode at the top, before any Return commands.
GroupAdd, IfWinGroup , Acrobat
GroupAdd, IfWinGroup , Evernote ; Not that the following shortcuts make any sense in Evernote, but it shows how to create groups of shortcuts that are used in more that one application.
SetTitleMatchMode, 2
#ifWinActive, ahk_group IfWinGroup
0::Send !vp ^0
1::Send ^1
2::Send !vpc ^2
#ifWinActive
Upvotes: 3
Reputation: 7953
@Reza,
Is this what you are looking for? This will set shortcuts for Evernote and Chrome.
SetTitleMatchMode, 2
#ifWinActive, Evernote
+Numpaddiv::Send, / ; Shift NumPadDiv is now the standard /
+NumpadMult::Send, *
+Numpadsub::Send, -
+NumpadAdd::Send, +=
^Numpaddiv::Send, (
^NumpadMult::Send, )
Numpaddiv::Send, {Space}/{Space} ; NumPadDiv will send space/space
NumpadMult::Send, {Space}*{Space}
Numpadsub::Send, {Space}-{Space}
NumpadAdd::Send, {Space}+={Space}
NumPadDot::Send, `,
#ifWinActive
#ifWinActive, Chrome
NumpadIns::Send, {Click}
+NumpadPgdn::Send, {PgUp} ; Shift + PageDown = PageUp
+NumpadDown::Send, {Up} ; Shift + Down = Up
NumpadRight::Send, ^{PgDn} ; Right arrow = activate next Tab
NumpadLeft::Send, ^{PgUp} ; Left arrow = activate previous tab
+NumpadClear:: ; NumPad 5 = Park mouse right hand top of screen
NumpadClear::MouseMove,(1340),(100) ; NumPad 5 = Park mouse right hand top of screen
+NumPadSub::Send, ^{F4} ; NumPad Minus = Close tab
NumPadDel::Send, . ; NumPad Del = dot to delete mail in gmail
SC16D::Send, +j ; Jump ONE G+ Story down with Music Media Button
+SC16D::Send, +k ; Jump ONE G+ Story up with Play/Pause button
#ifWinActive
Upvotes: 1