Page 1 sur 3
[..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 00:13
par quelqun
salut
je viens de découvrir le langage autoit et je trouve déjà une difficulté avec la fonction hotkeyset()
plus précisément avec les caractères spéciaux comme @
par exemple:
ça bug

pourtant j'ai assez chercher sur google
quelqu'un aurait-il une solution?
merci
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 00:24
par bloodwolff
Euh je ne connais pas de clavier ou il y a une touche @ . Chez moi il faut appuyer sur ctrl+alt+2
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 00:39
par jbnh
The following hotkeys cannot be set:
Ctrl+Alt+Delete It is reserved by Windows
F12 It is also reserved by Windows, according to its API.
NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard.
Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.
Alt, Ctrl, Shift, Win These are the modifier keys themselves!
Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.
cfr doc
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 01:09
par ani
bonjour et soyez le bienvenu parmis nous.
l'erreur est toute bête, vous devez pour cela indiquer l'arobase entre accolade.
HotKeySet("{@}", "function")
bonne continuation

Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 08:41
par legend
J'ai une petite question sur hotkey moi aussi

S'est possible de désactiver un hotkeyset avec un ligne.
(je parle du truc du genre hotkeydisable.)
Merci et bonne journée.
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 09:21
par Jerome
Coucou,
Je ne pense pas.
Pour moi, il suffit simplement de ré-attribuer la touche.
Jérôme
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 11:05
par TommyDDR
Pour commencer, personnellement ce code fonctionne chez moi :
Code : Tout sélectionner
HotKeySet("@", "test")
While(True)
Sleep(10)
WEnd
Func test()
MsgBox(0, "", "")
Exit
EndFunc
@ = AltGr + à (=> Ctrl + Alt + à)
Ensuite, pour annuler un hotkeyset, il suffit de rappeler la fonction HotKeySet en précisant la touche et de ne pas envoyer de 2nd paramètre :
HotKeySet("a", "MaFonction") => Associe la fonction "MaFonction" à la touche "a"
HotKeySet("a") => Retire l'association
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 11:36
par Fish
Et je me demandais un truc...
J'essaye de mettre un hotkeyset sur une touche, sa marche mais quand je veut par exemple taper cette touche dans un traitement de texte, sa ne l'écrit pas. Et même si je met un Send dans la fonction appelée par la touche, sa ne marche pas...
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 13:12
par jbnh
Faut passer par _ispressed pour faire cela
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 14:34
par Fish
Ah ok merci.
Mais le problème c'est que cette solution ne marche pas...

En effet j'ai testé pour faire des flèches directionnelles .
Peut-être que j'ai mal procédé, je vais réessayer.
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 15:41
par jbnh
Dans la doc vous avez toutes les touches pour ispressed :
► Afficher le texte
01 Left mouse button
02 Right mouse button
04 Middle mouse button (three-button mouse)
05 Windows 2000/XP: X1 mouse button
06 Windows 2000/XP: X2 mouse button
08 BACKSPACE key
09 TAB key
0C CLEAR key
0D ENTER key
10 SHIFT key
11 CTRL key
12 ALT key
13 PAUSE key
14 CAPS LOCK key
1B ESC key
20 SPACEBAR
21 PAGE UP key
22 PAGE DOWN key
23 END key
24 HOME key
25 LEFT ARROW key
26 UP ARROW key
27 RIGHT ARROW key
28 DOWN ARROW key
29 SELECT key
2A PRINT key
2B EXECUTE key
2C PRINT SCREEN key
2D INS key
2E DEL key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
5B Left Windows key
5C Right Windows key
60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
6A Multiply key
6B Add key
6C Separator key
6D Subtract key
6E Decimal key
6F Divide key
70 F1 key
71 F2 key
72 F3 key
73 F4 key
74 F5 key
75 F6 key
76 F7 key
77 F8 key
78 F9 key
79 F10 key
7A F11 key
7B F12 key
7C-7F F13 key - F16 key
80H-87H F17 key - F24 key
90 NUM LOCK key
91 SCROLL LOCK key
A0 Left SHIFT key
A1 Right SHIFT key
A2 Left CONTROL key
A3 Right CONTROL key
A4 Left MENU key
A5 Right MENU key
BA ;
BB =
BC ,
BD -
BE .
BF /
C0 `
DB [
DC \
DD ]
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 17:12
par legend
@jbnh : C'est possible de le faire avec hotkey (je peut dire comment si vous voulez)
@jerome : que veut tu dire par "ré-attribuer la touche"?
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 18:30
par Fish
@legend : TommyDDR l'a déjà dit, on peut la réattribuer avec du "rien"
Voici l'exemple :
HotKeySet("a", "MaFonction") => Associe la fonction "MaFonction" à la touche "a"
HotKeySet("a") => Retire l'association
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 19:25
par legend
Bof, il est même possible de faire un petit If au début de la fonction avec un variable pour l'annuler . . .
Sinon la touche reste toujours inactive pour l'écriture.
Pour l'activer suffit de faire un control send dans la fonction du hotkey sur la fenêtre active . . .
bonne journée a tous
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 19:29
par Fish
Ben non legend, justement sa ne marche pas avec un send ()... J'ai déjà testé.
Bonne journée.
Re: [..] Fonction hotkeyset()
Posté : dim. 09 janv. 2011 21:01
par quelqun
avec le script ci-dessous ça marche:
Code : Tout sélectionner
HotKeySet("@", "test")
While(True)
Sleep(10)
WEnd
Func test()
MsgBox(0, "", "")
Exit
EndFunc
mais je voudrais mettre un script du genre:
Code : Tout sélectionner
HotKeySet("@", "test")
While(True)
Sleep(10)
WEnd
Func test()
HotKeySet("@")
send("@")
HotKeySet("@", "test")
Exit
EndFunc
ça bug gravement

Re: [..] Fonction hotkeyset()
Posté : lun. 10 janv. 2011 09:53
par Iste
Bon allé...
Code : Tout sélectionner
HotKeySet("m", "at")
While 1
Sleep(1000)
WEnd
Func at()
HotKeySet("m")
Send("m")
HotKeySet("m", "at")
EndFunc
Re: [..] Fonction hotkeyset()
Posté : lun. 10 janv. 2011 11:35
par quelqun
tu as essayer avec ça:
Code : Tout sélectionner
HotKeySet("@", "at")
While 1
Sleep(1000)
WEnd
Func at()
HotKeySet("@")
Send("@")
HotKeySet("@", "at")
EndFunc
parce que ça bug et j'aimerais éviter cela

Re: [..] Fonction hotkeyset()
Posté : lun. 10 janv. 2011 11:48
par Iste
Non, car send se superpose a a votre Alt Gr...
Code : Tout sélectionner
HotKeySet("@", "at")
While 1
Sleep(1000)
WEnd
Func at()
Send(Chr(40))
EndFunc
Re: [..] Fonction hotkeyset()
Posté : lun. 10 janv. 2011 12:00
par quelqun
ça bug aussi
en executant juste:
ça envoie une parenthése: "("