• L
  • M
  • M
  • J
  • V
  • S
  • D
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

Script complet pour 5 Avatars

Voici un script complet et les macros permettant de gérer 5 avatars de même type (5 Chamans). Le script et les macros seront très peu commentées. Si vous voulez plus de détail sur l'un ou l'autre il vous faudra consulter les différents sujets traités sur le site, ou consulter www.dualboxing.fr.

A noter que le script qui suit est dépendant de mes macros de jeu. Il est donc conseillé de lire aussi la page dédiée aux Macros "universelles".

Script AutoHotKey

WinGet, appid, List, World of Warcraft

idMain = %appid1%
idAlt1 = %appid2%
idAlt2 = %appid3%
idAlt3 = %appid4%
idAlt4 = %appid5%

; ----------------------------------------------------------------------------------
; Variables globales
; ----------------------------------------------------------------------------------

NumAltInMove := 0  ; Une Variable pour définir lequel des 4 Alts recevra un ordre (0 = Tous)

NumRealMain = %idMain% ; Une Variable pour enregistrer le main véritable (Pour le switch de main)

; ----------------------------------------------------------------------------------
; A PARTIR D'ICI ON TRAITE LES ACTIONS PROPRES A WOW
; ----------------------------------------------------------------------------------

#IfWinActive, World of Warcraft

; ---------------------------------------------------------------------------------
; Script de désactivation d'AHK lorsqu'on dialogue ou répond à un Wisp
; ---------------------------------------------------------------------------------
;
; La(les) touche(s) qui suspend(en)t AHK :
;
;  R   Permet de répondre à un wisp
;  /   Permet de commencer un message (Comme ENTER)
;  ENTER  Permet de commencer un message
;
; La(les) touche(s) qui relance(nt) AHK :
;
;  ESC
;
; ---------------------------------------------------------------------------------

~r::Suspend, on
~/::Suspend, on

~Enter::Suspend, on

~Escape::Suspend, off

; ----------------------------------------------------------------------------------
; Effet WoW Maximizer sans WoW Maximizer pour 5 WoW répartis sur deux écrans
; ----------------------------------------------------------------------------------

^Escape::
KeyWait, Escape, D
{
 MsgBox, 4,, Désirez-vous mettre en forme les fenêtres de jeu ?
 
 IfMsgBox Yes
 {
  
  ; SplashTextOn, 400, , Le script cherche la fenêtre de votre personnage principal.
  ; Sleep, 2000
  ; SplasHtextoff
  
  WinMinimize, ahk_id %appid1%
  WinMinimize, ahk_id %appid2%
  WinMinimize, ahk_id %appid3%
  WinMinimize, ahk_id %appid4%
  WinMinimize, ahk_id %appid5%
  
  WinActivate, ahk_id %appid1%
  
  MsgBox, 4,, Cette fenêtre est-elle celle de votre personnage principal ?
  
  IfMsgBox Yes
  {
   
   idMain = %appid1%
   idAlt1 = %appid2%
   idAlt2 = %appid3%
   idAlt3 = %appid4%
   idAlt4 = %appid5%
   
  } else {
   
   WinActivate, ahk_id %appid2%
   
   MsgBox, 4,, Cette fenêtre est-elle celle de votre personnage principal ?
   
   IfMsgBox Yes
   {
    
    idMain = %appid2%
    idAlt1 = %appid1%
    idAlt2 = %appid3%
    idAlt3 = %appid4%
    idAlt4 = %appid5%
    
   } else {
    
    WinActivate, ahk_id %appid3%
    
    MsgBox, 4,, Cette fenêtre est-elle celle de votre personnage principal ?
    
    IfMsgBox Yes
    {
     
     idMain = %appid3%
     idAlt1 = %appid2%
     idAlt2 = %appid1%
     idAlt3 = %appid4%
     idAlt4 = %appid5%
     
    } else {
     
     WinActivate, ahk_id %appid4%
     
     MsgBox, 4,, Cette fenêtre est-elle celle de votre personnage principal ?
     
     IfMsgBox Yes
     {
      
      idMain = %appid4%
      idAlt1 = %appid2%
      idAlt2 = %appid3%
      idAlt3 = %appid1%
      idAlt4 = %appid5%
      
     } else {
      
      idMain = %appid5%
      idAlt1 = %appid2%
      idAlt2 = %appid3%
      idAlt3 = %appid4%
      idAlt4 = %appid1%
      
     }
    }
   }
  }
  
  NumRealMain = %idMain%
  
  MsgBox, 4,, Votre écran principal est-il le N°1 ?
  
  IfMsgBox Yes
  {
   
   SysGet, Pri, Monitor, 2
   SysGet, Mon, Monitor, 1
   
  } else {
   
   SysGet, Pri, Monitor, 1
   SysGet, Mon, Monitor, 2
   
  }
  
  ; MsgBox, Veuillez patienter le temps de mettre en place les fenêtres de jeu.
  
  WinActivate, ahk_id %idMain%
  WinActivate, ahk_id %idAlt1%
  WinActivate, ahk_id %idAlt2%
  WinActivate, ahk_id %idAlt3%
  WinActivate, ahk_id %idAlt4%
  
  ; WinSet, Style, -0xC00000, ahk_id %idMain%
  ; WinSet, Style, -0x40000 , ahk_id %idMain%
  
  WinSet, Style, -0xC00000, ahk_id %idAlt1%
  WinSet, Style, -0x40000 , ahk_id %idAlt1%
  WinSet, Style, -0xC00000, ahk_id %idAlt2%
  WinSet, Style, -0x40000 , ahk_id %idAlt2%
  WinSet, Style, -0xC00000, ahk_id %idAlt3%
  WinSet, Style, -0x40000 , ahk_id %idAlt3%
  WinSet, Style, -0xC00000, ahk_id %idAlt4%
  WinSet, Style, -0x40000 , ahk_id %idAlt4%
  
  W := (MonRight - MonLeft) / 2
  H := (MonBottom - MonTop) / 2
  
  X1 := MonLeft
  X2 := MonLeft + W
  
  Y1 := MonTop
  Y2 := MonTop + H
  
  ; WinMove, ahk_id %idMain%,, PriLeft, PriTop, PriRight - PriLeft, PriBottom - PriTop
  
  WinMove, ahk_id %idAlt1%,, X1, Y1, W, H
  WinMove, ahk_id %idAlt2%,, X2, Y1, W, H
  WinMove, ahk_id %idAlt3%,, X1, Y2, W, H
  WinMove, ahk_id %idAlt4%,, X2, Y2, W, H
  
 } else {
  
;  idMain = %appid1%
;  idAlt1 = %appid2%
;  idAlt2 = %appid3%
;  idAlt3 = %appid4%
;  idAlt4 = %appid5%
  
 }
}
return

; ----------------------------------------------------------------------------------
; Une fonction pour renvoyer les touches du Main sur les Alts
; ----------------------------------------------------------------------------------

MyControlSend(KeyWait, KeySend) {
 
 global
 
 KeyWait, %KeyWait%, D
 {
  ControlSend,, %KeySend%, ahk_id %idAlt1%
  ControlSend,, %KeySend%, ahk_id %idAlt2%
  ControlSend,, %KeySend%, ahk_id %idAlt3%
  ControlSend,, %KeySend%, ahk_id %idAlt4%
 }
 
 return
 
}

; ----------------------------------------------------------------------------------
; Une fonction pour définir l'Alt en cours
; ----------------------------------------------------------------------------------

ChangeNumAltInMove(KeyWait, NewValue) {
 
 global
 
 KeyWait, %KeyWait%, D
 {
  
  if NumAltInMove = %NewValue%
  
  NumAltInMove := 0
  
  else
  
  NumAltInMove := NewValue
  
 }
 
 return
 
}

; ----------------------------------------------------------------------------------
; Une fonction pour définir que l'Alt en cours effectue une action
; ----------------------------------------------------------------------------------

SendKeyPress(KeyWait, KeySendDown, KeySendUp, idReceiver1, idReceiver2, idReceiver3, idReceiver4) {
 
 if idReceiver1 != 0
  ControlSend,, %KeySendDown%, ahk_id %idReceiver1%
 
 if idReceiver2 != 0
  ControlSend,, %KeySendDown%, ahk_id %idReceiver2%
 
 if idReceiver3 != 0
  ControlSend,, %KeySendDown%, ahk_id %idReceiver3%
 
 if idReceiver4 != 0
  ControlSend,, %KeySendDown%, ahk_id %idReceiver4%
 
 KeyWait, %KeyWait%
 
 if idReceiver1 != 0
  ControlSend,, %KeySendUp%, ahk_id %idReceiver1%
 
 if idReceiver2 != 0
  ControlSend,, %KeySendUp%, ahk_id %idReceiver2%
 
 if idReceiver3 != 0
  ControlSend,, %KeySendUp%, ahk_id %idReceiver3%
 
 if idReceiver4 != 0
  ControlSend,, %KeySendUp%, ahk_id %idReceiver4%
 
 return
 
}

SendKeyPressAtCurrentAssist(KeyWait, KeySendDown, KeySendUp) {
 
 global
 
 if NumAltInMove = 1
  
  SendKeyPress(KeyWait, KeySendDown, KeySendUp, idAlt1, 0, 0, 0)
  
 else if NumAltInMove = 2
  
  SendKeyPress(KeyWait, KeySendDown, KeySendUp, 0, idAlt2, 0, 0)
  
 else if NumAltInMove = 3
  
  SendKeyPress(KeyWait, KeySendDown, KeySendUp, 0, 0, idAlt3, 0)
  
 else if NumAltInMove = 4
  
  SendKeyPress(KeyWait, KeySendDown, KeySendUp, 0, 0, 0, idAlt4)
  
 else {
  
  SendKeyPress(KeyWait, KeySendDown, KeySendUp, idAlt1, idAlt2, idAlt3, idAlt4)
  
 }
 
 return
 
}

; -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

; ----------------------------------------------------------------------------------
; Touches de contrôle des Avatars
; ----------------------------------------------------------------------------------

~&::MyControlSend("&","{SHIFT down}{&}{SHIFT up}")
~é::MyControlSend("é","{SHIFT down}{é}{SHIFT up}")
~'::MyControlSend("'","{SHIFT down}{'}{SHIFT up}")
~(::MyControlSend("(","{SHIFT down}{(}{SHIFT up}")
~-::MyControlSend("-","{SHIFT down}{-}{SHIFT up}")
~è::MyControlSend("è","{SHIFT down}{è}{SHIFT up}")
~_::MyControlSend("_","{SHIFT down}{_}{SHIFT up}")
~ç::MyControlSend("ç","{SHIFT down}{ç}{SHIFT up}")
~à::MyControlSend("à","{SHIFT down}{à}{SHIFT up}")
~)::MyControlSend(")","{SHIFT down}{)}{SHIFT up}")
~=::MyControlSend("=","{SHIFT down}{=}{SHIFT up}")

~^&::MyControlSend("^&","{CTRL down}{&}{CTRL up}")
~^é::MyControlSend("^é","{CTRL down}{é}{CTRL up}")
~^'::MyControlSend("^'","{CTRL down}{'}{CTRL up}")
~^(::MyControlSend("^(","{CTRL down}{(}{CTRL up}")
~^-::MyControlSend("^-","{CTRL down}{-}{CTRL up}")
~^è::MyControlSend("^è","{CTRL down}{è}{CTRL up}")
~^_::MyControlSend("^_","{CTRL down}{_}{CTRL up}")
~^ç::MyControlSend("^ç","{CTRL down}{ç}{CTRL up}")
~^à::MyControlSend("^à","{CTRL down}{à}{CTRL up}")
~^)::MyControlSend("^)","{CTRL down}{)}{CTRL up}")
~^=::MyControlSend("^=","{CTRL down}{=}{CTRL up}")

~!&::MyControlSend("^&","{ALT down}{&}{ALT up}")
~!é::MyControlSend("^é","{ALT down}{é}{ALT up}")
~!'::MyControlSend("^'","{ALT down}{'}{ALT up}")
~!(::MyControlSend("^(","{ALT down}{(}{ALT up}")
~!-::MyControlSend("^-","{ALT down}{-}{ALT up}")
~!è::MyControlSend("^è","{ALT down}{è}{ALT up}")
~!_::MyControlSend("^_","{ALT down}{_}{ALT up}")
~!ç::MyControlSend("^ç","{ALT down}{ç}{ALT up}")
~!à::MyControlSend("^à","{ALT down}{à}{ALT up}")
~!)::MyControlSend("^)","{ALT down}{)}{ALT up}")
~!=::MyControlSend("^=","{ALT down}{=}{ALT up}")

~space:: MyControlSend("space","{space}")

~"::
KeyWait, ", D
{
 ControlSend,, {SHIFT down}{"}{SHIFT up}, ahk_id %idAlt1%
 ControlSend,, {SHIFT down}{"}{SHIFT up}, ahk_id %idAlt2%
 ControlSend,, {SHIFT down}{"}{SHIFT up}, ahk_id %idAlt3%
 ControlSend,, {SHIFT down}{"}{SHIFT up}, ahk_id %idAlt4%
}
return

~^"::
{
 ControlSend,, {CTRL down}{"}{CTRL up}, ahk_id %idAlt1%
 ControlSend,, {CTRL down}{"}{CTRL up}, ahk_id %idAlt2%
 ControlSend,, {CTRL down}{"}{CTRL up}, ahk_id %idAlt3%
 ControlSend,, {CTRL down}{"}{CTRL up}, ahk_id %idAlt4%
}
return

~!"::
{
 ControlSend,, {ALT down}{"}{ALT up}, ahk_id %idAlt1%
 ControlSend,, {ALT down}{"}{ALT up}, ahk_id %idAlt2%
 ControlSend,, {ALT down}{"}{ALT up}, ahk_id %idAlt3%
 ControlSend,, {ALT down}{"}{ALT up}, ahk_id %idAlt4%
}
return

; ---------------------------------------------------------------------------------
; Script de formation
; ---------------------------------------------------------------------------------

$J::
KeyWait, J, D
{
 SetKeyDelay, -1
 ControlSend,, {A down}, ahk_id %idAlt1%
 ControlSend,, {E down}, ahk_id %idAlt2%
 ControlSend,, {A down}, ahk_id %idAlt3%
 ControlSend,, {E down}, ahk_id %idAlt4%
 Sleep, 200
 ControlSend,, {A up}, ahk_id %idAlt1%
 ControlSend,, {E up}, ahk_id %idAlt2%
 Sleep, 200
 ControlSend,, {A up}, ahk_id %idAlt3%
 ControlSend,, {E up}, ahk_id %idAlt4%
}
return

; ----------------------------------------------------------------------------------
; F5 à F8 et ² pour désigner les focus des Alts en cours
; ----------------------------------------------------------------------------------

²::SendKeyPressAtCurrentAssist("²","{² down}","{² up}")

F5::SendKeyPress("²", "{² down}", "{² up}", idAlt1, 0, 0, 0)
F6::SendKeyPress("²", "{² down}", "{² up}", 0, idAlt2, 0, 0)
F7::SendKeyPress("²", "{² down}", "{² up}", 0, 0, idAlt3, 0)
F8::SendKeyPress("²", "{² down}", "{² up}", 0, 0, 0, idAlt4)

; ----------------------------------------------------------------------------------
; F9 à F12 pour désigner l'Alt en cours
; ----------------------------------------------------------------------------------

F9::ChangeNumAltInMove("F9", 1)

F10::ChangeNumAltInMove("F10", 2)
F11::ChangeNumAltInMove("F11", 3)
F12::ChangeNumAltInMove("F12", 4)

; ----------------------------------------------------------------------------------
; Déplacement des Alts de façon idividuelle ou générale
; ----------------------------------------------------------------------------------

Numpad7::SendKeyPressAtCurrentAssist("Numpad7","{a down}","{a up}")
Numpad8::SendKeyPressAtCurrentAssist("Numpad8","{z down}","{z up}")
Numpad9::SendKeyPressAtCurrentAssist("Numpad9","{e down}","{e up}")
Numpad4::SendKeyPressAtCurrentAssist("Numpad4","{q down}","{q up}")
Numpad6::SendKeyPressAtCurrentAssist("Numpad6","{d down}","{d up}")
Numpad2::SendKeyPressAtCurrentAssist("Numpad2","{s down}","{s up}")

; ----------------------------------------------------------------------------------
; Page UP et Down font faire des pas Gauche et Droite aux Alts et à l'Assist (Requière d'y associer les raccourcis qui vont bien dans WoW)
; ----------------------------------------------------------------------------------

~PgDn::SendKeyPress("PgDn", "{a down}","{a up}", idAlt1, idAlt2, idAlt3, idAlt4)
~PgUp::SendKeyPress("PgUp", "{e down}","{e up}", idAlt1, idAlt2, idAlt3, idAlt4)