Here I have some functions and snippets that I didn't organize yet.
CompareFileVersions()
;
; postado em www.autohotkey.com/forum/viewtopic.php?p=299528#299528
; by MasterFocus
;
r0 := "-1 indicates LEFT is newer version.`n"
r0 .= " 1 indicates RIGHT is newer version.`n"
r0 .= " 0 indicates they are the same version.`n`n"
r0 .= "Expected results:`t-1 , -1 , 1 , -1 , 1`nResults:`t`t"
r0 .= CompareFileVersions( "9.0.0.09" , "8.17.0.12" ) " , "
r0 .= CompareFileVersions( "99.9.9.9" , "9.10.10.10" ) " , "
r0 .= CompareFileVersions( "1.2.3.4" , "9.7" ) " , "
r0 .= CompareFileVersions( "4.232.42.5" , "4.2.42.5" ) " , "
r0 .= CompareFileVersions( "4.232.42.5" , "4.3.42.5" )
MsgBox % r0
Return
CompareFileVersions(a,b)
{
StringSplit, a, a, .
StringSplit, b, b, .
Loop, % ( a0 < b0 ? a0 : b0 )
{
ai := a0-(A_Index-1) , bi := b0-(A_Index-1)
av := (A_Index<>1)AND(StrLen(a%ai%)1)AND(StrLen(b%bi%) bv )
Return ( av>bv ? -1 : 1 )
}
Return ( a0>b0 ? -1 : a0
Remove GUI Icon
#persistent
Gui, +LastFound
hGui := WinExist()
SendMessage, 0x80, , hGui
Gui, Show, xCenter yCenter W500 H500
return
; SendMessage, WM_SETICON, NULL parameter, Gui handle
"Admin Security"
;
; http://www.autohotkey.com/forum/viewtopic.php?p=293350#293350
;
;
; EMERGENCY IS SHIFT + ESC
;
; ==== AUTO EXEC ====
#NoTrayIcon
#Persistent
#SingleInstance Force
; Process Explorer | Windows Task Manager | System Configuration | MSConfig
; Processes are added into this variable and the timer is set
ProcList := "PROCEXP.EXE|taskmgr.exe|sysconfig.exe|msconfig.exe"
SetTimer, CloseEscapeAttempts, On
; Gui is created only once (see the Dismiss label below)
WarnMsg := "ACCESS IS" "`n" "STRICTLY FORBIDDEN"
WarnMsg .= "`n`n"
WarnMsg .= "PLEASE CONTACT" "`n" "THE ADMIN"
Gui -Caption +ToolWindow +AlwaysOnTop
Gui, Color, FF0000
Gui, Font, S40 c0, Ariel
Gui, Add, Button, h600 w800 gDismiss, %WarnMsg%
Return
; ==== EMERGENCY ====
+Esc:: ; SHIFT+ESC will terminate the script (you may remove this)
SoundBeep,,100
SoundBeep,,100
ExitApp
; ===== LABELS ======
WarningMessage:
; The more commands you add into this label, the longer it will take
; to execute and the easier it will be to successfully bypass it.
Gui, Show
Soundbeep, 690
Return
; ---- ---- ---- ----
Dismiss:
; Hide is used instead of Destroy so Gui is created only once
Gui, Hide
Return
; ---- ---- ---- ----
CloseEscapeAttempts:
Loop, Parse, ProcList, | ; loops through processes in ProcList variable
{
Process, Close, %A_LoopField% ; try to close the current process
If Errorlevel ; if process was successfully closed (which means that it existed)
Gosub, WarningMessage
}
Return