#If WinExist("ahk_class ArtRage 3")
Capslock::
WinActivate, ahk_class ArtRage 3
WinWaitActive, ahk_class ArtRage 3
Send {Ctrl Down}{Right}{Ctrl Up} ; Ctrl Right is the key I set to toogle the workbench mode
return
#If
EDITAR:
Pode ser que o programa crie uma nova janela desta ahk_class no modo de bancada? Use isto para descobrir:
F1::
WinGet, instances, count, ahk_class ArtRage
MsgBox, There exist %instances% windows of this ahk_class.
return
EDIT2:
Tente também como script autônomo (feche todos os outros scripts que possam interferir):
#If WinExist("ahk_class ArtRage 3")
Capslock::
ControlSend, ahk_parent, ^{Right}, ahk_class ArtRage 3
; or:
; ControlSend,, ^{Right}, ahk_class ArtRage 3
return
#If
Se isso não funcionar, leia link e tente as soluções mencionadas.
EDIT3:
A resposta para a pergunta sobre como usar melhor as diretivas # If ou #IfWin depende da sua situação.
The #IfWin directives are positional:
they affect all hotkeys and hotstrings physically beneath them in the script.
They are also mutually exclusive; that is, only the most recent one will be in effect.
#if WinExist é um identificador amplo, mas somente se você der prioridade a ele, ou seja, se você colocar antes outras diretivas #if no script. Tente dar prioridade às diretivas #if WinActive (coloque-as antes do #if WinExist no seu script).
Exemplo:
#If WinActive("ahk_class ArtRage 3")
Capslock:: MsgBox, You pressed Capslock while ArtRage was active
1:: MsgBox, You pressed 1 while ArtRage was active
#If WinActive("ahk_class notepad")
Capslock:: MsgBox, You pressed Capslock while Notepad was active
1:: Send, 2
#If WinActive("ahk_class CabinetWClass")
Capslock:: MsgBox, You pressed Capslock while Explorer was active
1:: Run %A_MyDocuments%
#If WinExist("ahk_class ArtRage 3")
Capslock:: MsgBox, You pressed Capslock while ArtRage was inactive 'n(Notepad and Explorer are not active or do not exist)
1:: MsgBox, You pressed 1 while ArtRage was inactive'nNotepad and Explorer are not active or do not exist
#If WinExist("ahk_class IEFrame")
Capslock:: MsgBox, You pressed Capslock while IE was inactive 'nArtRage does not exist,'nNotepad and Explorer are not active or do not exist
#If ; end of context-sensitive hotkeys
Capslock:: MsgBox, You pressed Capslock while ArtRage and IE do not exist'nNotepad and Explorer are not active or do not exist
1:: MsgBox, You pressed 1 while ArtRage and IE do not exist'nNotepad and Explorer are not active or do not exist
BTW: #Se WinExist ("ahk_class ArtRage 3") após #If WinActive ("ahk_class ArtRage 3") não faz sentido (a diretiva #If WinActive pressupõe que essa janela exista).