Can someone please tell me why when my script is running it makes my pc lag even though I'm not calling any hotkey from it. When it is not running : the pc goes back to its normal speed. I tried testing several times (with my script running vs closed) and its always the same result. I tried with both .exe and .ahk extention (compiled/uncompiled): same result.
Thank you!
Code: Select all
SetTitleMatchMode, 2
#SingleInstance Force
#Persistent
TrayTip, AutoHotKey, Started, 1
;SoundBeep, 300, 150
Return
^#!r:: ; Save and Reload script
Send, ^s ; To save a changed script
Sleep, 300 ; give it time to save the script
Reload
Return
global CurrentClipBoard, NAM, Qc, nom, prenom, genre
~t::
{
SetTitleMatchMode, 1
If WinActive("1-Patient -")
{
Send {AppsKey}
Sleep, 700
Send {up}{up}{up}
Sleep, 100
Send {up}{up}{up}
Sleep, 100
Send {Enter}
}
SetTitleMatchMode, 2
return
}
^LButton:: ;ctrl+Left Mouse Click
{
hotkey,% a_thisHotkey,off
Send {RButton}
Sleep, 50
Send {TAB}
Sleep, 50
Send {F4}
Sleep, 50
Send {Home} ;white
Sleep, 50
Send {Enter}
hotkey,% a_thisHotkey,on
Return
}
^RButton::
{
hotkey,% a_thisHotkey,off
Send {RButton}
Sleep, 50
Send {TAB}
Sleep, 50
Send {F4}
Sleep, 50
Send {Home}{Down}
Sleep, 50
Send {Down} ;Green
Sleep, 50
Send {Enter}
hotkey,% a_thisHotkey,on
Return
}
!LButton:: ;alt+Left Mouse Click
{
hotkey,% a_thisHotkey,off
Send {RButton}
Sleep, 50
Send {TAB}
Sleep, 50
Send {F4}
Sleep, 50
Send {End}
Sleep, 50
Send {Up}
Sleep, 50
Send {Up}
Sleep, 50
Send {Up} ;Red
Sleep, 50
Send {Enter}
hotkey,% a_thisHotkey,on
Return
}
^#c::
{
If WinActive("1-Patient - ")
{
CurrentClipBoard = %ClipBoard%
Send {Ctrl Down}l{Ctrl Up}
Send {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Sleep, 100
Send {Ctrl Down}{Shift Down}{right}{right}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up}
Sleep, 100
Qc = %ClipBoard%
Send {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Sleep, 100
Send {Ctrl Down}{Shift Down}{right}{right}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up}
NAM = %ClipBoard%
ClipBoard = %CurrentClipBoard%
return
}
}
#c::
{
If WinActive("Patient - ")
{
Send {Home}
Sleep, 100
CurrentClipBoard = %ClipBoard%
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up}
NAM = %ClipBoard%
Send {Ctrl Down}l{Ctrl Up} ;remonte à nom
Sleep, 100
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up} ;copie nom
Sleep, 100
nom = %ClipBoard%
Send {TAB}
Sleep, 250
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Send {Ctrl Down}c{Ctrl Up} ;copie prenom
Sleep, 100
prenom = %ClipBoard%
Send {TAB}
Sleep, 250
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up} ;copie genre
Sleep, 100
genre = %ClipBoard%
Send {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Sleep, 100
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up}
Sleep, 100
Send {TAB}
Qc = %ClipBoard%
Sleep, 100
ClipBoard = %CurrentClipBoard%
}
else If WinActive("1-(Pat Search)")
{
CurrentClipBoard = %ClipBoard%
Send {Enter}
Sleep, 1300
Send {Ctrl Down}l{Ctrl Up}
Send {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Sleep, 100
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}{AppsKey}
Sleep, 200
Send {Down}{Down}{Down}
Qc = %ClipBoard%
Send {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Sleep, 100
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}{AppsKey}
Sleep, 200
Send {Down}{Down}{Down}
NAM = %ClipBoard%
ClipBoard = %CurrentClipBoard%
}
else If WinActive("ABC ")
{
Sleep, 200
Send {BS}
Sleep, 100
Send %Qc%{space}
Sleep, 700
Send {Down}
Sleep, 100
Send {Enter}
}
else If WinActive("recherche - ")
{
SetTitleMatchMode, 1
Send %NAM%
x = Rand(300, 350) ; - Random integer between X and Y
Sleep, %x%
Send {enter}
x = Rand(300, 350) ; - Random integer between X and Y
Sleep, %x%
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
x = Rand(100, 150) ; - Random integer between X and Y
Sleep, %x%
Send {Tab}
x = Rand(100, 150) ; - Random integer between X and Y
Sleep, %x%
;Send {Tab}
x = Rand(100, 150) ; - Random integer between X and Y
Sleep, %x%
Send {Tab}
KeyWait, Tab, D T10
Send {enter}
SetTitleMatchMode, 2
}
else If WinActive("Save As")
{
Send %NAM%_
Send, %A_YYYY%-%A_MM%-%A_DD%_
FormatTime, Time, ,hh:mmtt
SendInput, %Time%
Sleep, 100
Send {enter}
Sleep, 100
}
return
}
~Tab::
{
WinGetActiveTitle, currectWindow
if (InStr(currectWindow, "https://(ADRESS HIDDEN FOR CONFIDENTIALITY REASON)" , false,1))
{
if (NAM)
{
ControlClick, x280 y79, https://(ADRESS HIDDEN FOR CONFIDENTIALITY REASON)
Sleep, 2000
Send %NAM%_
Send, %A_YYYY%-%A_MM%-%A_DD%_
FormatTime, Time, ,hhmmsstt
SendInput, %Time%
Sleep, 100
Send {enter}
x = Rand(2000, 2500) ; - Random integer between X and Y
Sleep, %x%
;WinActivate ahk_class IEFrame
;Sleep, 100
if WinExist("https://(ADRESS HIDDEN FOR CONFIDENTIALITY REASON)")
WinClose ; Use the window found by WinExist.
WinActivate ahk_class IEFrame
Sleep, 100
;Send {Alt Down}{F4}{Alt Up}
Sleep, 300
Send {Shift Down}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Shift Up}{enter}
Sleep, 100
Send {Shift Down}{Tab}{Tab}{Shift Up}{enter}
Sleep, 100
Send {Right}
}
}
return
}
~d::
{
SetTitleMatchMode, 1
If WinActive("1-Modify ")
{
Send {Ctrl Down}e{Ctrl Up}
}
SetTitleMatchMode, 2
return
}
~^c:: ;ctrl+c
{
;SetTitleMatchMode, 1
If WinActive("1-Patient -")
{
Send {Home}
Sleep, 100
Send {Ctrl Down}{Shift Down}{End}{Ctrl Up}{Shift Up}
Sleep, 100
Send {Ctrl Down}c{Ctrl Up}
}
;SetTitleMatchMode, 2
Return
}
^+Enter:: ;ctrl+Shift+Enter
^+NumpadEnter::
{
SetTitleMatchMode, 1
If WinActive("1-Patient -")
{
Send {Shift Down}{F3}{Shift Up}
}
SetTitleMatchMode, 2
Return
}
^Enter:: ;ctrl+Enter
^NumpadEnter::
{
If WinActive("ABC ")
{
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Sleep, 100
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Sleep, 100
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Sleep, 100
Send {Enter}
Sleep, 700
Send {Shift Down}{Tab}{Shift Up}
}
else If WinActive("Patient")
{
Send d
Sleep, 300
Send {End}
Sleep, 300
Send m
}
return
}
+Enter::
{
If WinActive("ABC ")
{
Send {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}
Sleep, 100
}
return
}
#z::
if(%nomPatient%)
{
if (WinExist("Courriel - Outlook"))
{
WinActivate, Courriel - Outlook
Sleep, 500
Send n
Sleep, 500
Send compass
Sleep, 500
Send {Tab}
Sleep, 300
Send {Tab}{Tab}
Sleep, 300
Send {Tab}{Tab}{Tab}
Sleep, 100
Send %QC%
Sleep, 100
Send {ctrl Down}{left}{left}{ctrl Up}
Sleep, 100
Send {del}{del}{del}2
Sleep, 100
Send {End} - Suivi
Sleep, 100
Send {Tab}
Sleep, 100
Send Bonjour
}
Else
MsgBox, "Veuillez- SVP ouvrir"
return
}