Switch fenêtre autohotkey

Poser vos questions de programmation en AutoHotkey
Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Switch fenêtre autohotkey

Post by Hocis07 » 10 Oct 2021, 04:42

Bonjour,

J'aimerais savoir comment faire pour programmer un autohotkey afin de pouvoir un genre de alt+esc seulement avec les fenêtre d'une même application avec des noms différents (donc combinées par windows 11), même si d'autres ne sont pas minimisées, et pouvoir avoir une touche qui peut faire l'inverse.

En gros par exemple : je suis sur la page "numéro 1"

alt+z va de page en page de gauche a droite, et si j'ai switch trop vite je peux retourner en arriere avec alt+a.

Ca pourrait aussi marcher avec les touches des souris de base pour ouvrir des fenetres dans un ordre puis un autre.

J'ai fait plusieurs recherches mais je n'arrive pas a faire gérer un genre de "liste" de fenetres dans un ordre précis au logiciel.

Merci.

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 10 Oct 2021, 09:24

Est-ce que c'est avec Windows 11 seulement? Je ne l'ai pas encore installé... :/
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 10 Oct 2021, 09:57

Les fenêtres ne peuvent pas être decombinées sur w11. Mais autohotkey fonctionne sur w11. Donc je voulais simplement de l’aide pour un script comme je demande … s’il vous plaît 🥺

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 10 Oct 2021, 14:12

Je pense qu'il est possible to utilisé le mode de Windows 10 avec le suivant:
Change AltTabSettings = 1 dans HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer et redémarre explorer.exe
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 11 Oct 2021, 10:26

Bonjour,

Je suis repassé sous w10 du coup. Mais j'aimerais alors avoir de l'aide pour le script qui permet de switch d'une fenetre a l'autre en lui donnant le nom, comme je voulais des le début :D

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 11 Oct 2021, 17:03

J'ai écris ce script, mais je ne pense pas que alt+z fonctionne correctement, alt+z fonctionne bien.
Le code pour alt+a me mélange un peu trop la tête... :crazy:

Code: Select all

!z:: WinActivate, % "ahk_id " w:=GetPrevious()
!a:: WinActivate, % "ahk_id " w:=GetNext()


GetWindowFamily() {
	WinList:=[]
	WinGet, activeExe, ProcessName , A
	WinGet, windows, List, ahk_exe %activeExe%
	Loop %windows%
	{
		id := windows%A_Index%
		WinList.Push(id)
	}
	return WinList
}

GetPrevious() {
	w := GetWindowFamily()
	return w.Pop()
}

GetNext() {
	static last
	w := GetWindowFamily()
	
	if (w.Length() > 2) {
		next := w[2]
		
		if (last == w[1])
		{
			next := w[3]
		}
		
		return last := next
	}
	
	return last := w.Pop()
}
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 12 Oct 2021, 08:58

Salut, je vais essayer ça et je reviens vers toi.

C'est super gentil d'avoir pris le temps ! Merci

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 12 Oct 2021, 09:24

Petite question, ou écris-tu les fenetres qu'il doit utiliser ? Exemple pour trois fenetre qui auraient comme noms : "premiere, deuxieme, troisieme"

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 12 Oct 2021, 10:15

En ce moment le script fait cycler seulement les fenêtres avec le même nom de processus (ex. notepad.exe) en ordre affiché sur l'écran.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 12 Oct 2021, 10:27

Pardon mais je ne suis pas vraiment doué avec ce langage.

J'ai mis le nom du processus (Excel.exe) a la place de ProcessName, mais que dois-je changer d'autre pour qu'il fonctionne ?

EDIT : En fait il n'y a rien a changer, simplement a être déja une sur page active et ensuite ca déroule selon l'ordre d'ouverture, pas dans l'ordre dans lequel je les vois dans la barre

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 12 Oct 2021, 11:07

Ahh okay, donc avec le change est-ce que alt+z fonctionne? Tu veux changer d'onglets aussi!?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 12 Oct 2021, 11:13

Oui le alt+z fonctionne !

Non je ne veux pas changer d'onglet, mais simplement que si j'inverse les deux pages excel, et bien que ca prenne en compte le "nouvel" ordre

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 12 Oct 2021, 20:45

Ahh okay, non c basé sur l'ordre affiché... Faudrait de quoi pour ça, j'ai trouvé ça trop mélangeant à programmer :b
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 25 Oct 2021, 14:12

Merci quand meme c'est déja super top !


Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 27 Jul 2023, 14:41

Bonjour, je me permets de revenir ici, je n'ai toujours pas trouver pour avoir le previous, ni le suivant selon l'ordre qui est affiché (si je change l'ordre de 2 fenetres, que ça s'actualise)

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 27 Jul 2023, 17:12

Donc, aucun des deux ne fonctione? :think:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 28 Jul 2023, 11:30

le alt z si, parfois car il ne va pas les mettre dans l'ordre (par exemple celle tout a droite ne sera pas la derniere mais avant derniere, l'ordre donne done 1 2 3 4 5 6 8 7) et le alt a est inactif :(

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Switch fenêtre autohotkey

Post by joedf » 28 Jul 2023, 12:12

Oh lala, et alt-tab ne fonctionne pas?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Hocis07
Posts: 21
Joined: 10 Oct 2021, 04:37

Re: Switch fenêtre autohotkey

Post by Hocis07 » 28 Jul 2023, 12:32

Ca ne fait pas dans l'ordre affiché, si je change deux fenetres de place ca garde le meme. J'ai essayé un truc avec un code qui prend le type du .exe pour qu'il ne vogue que sur cette application, mais rien. Et alt tab n'a pas de retour si jamais je switch trop vite

Post Reply

Return to “J'ai besoin d'aide”