Si vous voulez "cliquer" sur une certaine position, pour ouvrir un menu, vous pouvez d'abord cliquer avec le bouton droit sur votre icône AutoHotKey et ouvrir le "espion de la fenêtre". Cet espion de la fenêtre vous montrera la position de la souris. Vous pouvez utiliser les positions de la souris pour effectuer vos actions dans l'application active.
Exemple:
SoundBeep 1000, 300 ; Wake up user
SplashTextOn, 200, 100, Script Preparations, Please Click on the person icon link. ; Show new Instructions text
WinMove, Script Preparations,, (A_ScreenWidth/2)+150, (A_ScreenHeight/2)+200 ; Move the window with the name "Script Preparations" Down and Right on the main screen
KeyWait, LButton, D ; Wait for LeftMouseButton click Down
MouseGetPos, xposE ,yposE ; Store the position where the mouse was clicked (Employee)
MouseClick, left, %xposE% ,%yposE%, 2 ; Perform a double mouse click on the captured mouse location
SplashTextOff ; Remove Text box
Dans ce cas, je demande d'abord à l'utilisateur de cliquer manuellement sur le bon emplacement. Ceci n'est requis que lorsque la position à cliquer change dans la fenêtre active (tuiles variables dans la fenêtre active). Une fois la position enregistrée, vous pouvez la réutiliser tout au long de votre script.
b.t. au lieu d'utiliser Alt +Tab, je suggère d'utiliser ceci:
settitlematchmode, 1 ; Set search in title to start with....
settitlematchmode, Fast ; Slow is not required here. Slow is only required when hidden text needs to be found.
SwitchWindow("Microsoft Excel - 1 QRM Upload and Change Template") ; Activate the
window with the title: Microsoft Excel - 1 QRM Upload and Change Template
You could even use someting like this:
SetTitleMatchMode, 2 ; Ensure that the Title Match mode is set to 2: Find anywhere in the title
SetTitleMatchMode, Fast ; Ensure that the Title Match mode is set to FAST
winactivate, %WindowName% ; Activate the window with the title stored in the variable WindowName
WinWaitActive, %WindowName%, , 5 ; Wait up to five seconds for the screen
if ErrorLevel ; Execute this when the window is not activated within 5 seconds
{ ; Start-If Wait failed
SoundBeep 1000 , 1000 ; Warn the user
MsgBox,4097,Time Out, Script timed out while waiting for %WindowName%.`n`rYou Must manually activate %WindowName% and then continue the script by pressing OK. ; Message to user
IfMsgBox, Cancel ; Do when the user clicked on Cancel
{ ; Start-If User clicked Cancel
ExitApp ; Exit this program when the user clicked on Cancel
} ; End-If User clicked Cancel
WinWaitActive, %WindowName%, , 5 ; Try to activate the window AGAIN
if ErrorLevel ; If window can't be found
{ ; Start-If window can't be found
MsgBox,4096,Exit, %WindowName% still NOT Active. ; Warn user
ExitApp ; Exit this program when the expected window is still not found
} ; End-If window can't be found
} ; End-If Wait failed
Cordialement,
Robert Ilbrink
Merci. Le WinActivate est très pratique et j'ai dormi un peu après les nombreux 'Send' que j'ai fini par utiliser. Je n'ai pas utilisé le clic de souris pour changer le mode de collage car le contenu du presse-papiers pourrait être 'pseudo-collé' avec 'Envoyer,% presse-papiers%' – abcde123483