Skip to content

Instantly share code, notes, and snippets.

@gioxx
Created April 14, 2023 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gioxx/731c4cf5ebfabf4184721e20cd51c65e to your computer and use it in GitHub Desktop.
Save gioxx/731c4cf5ebfabf4184721e20cd51c65e to your computer and use it in GitHub Desktop.
Recupero alcune informazioni da Windows e catturo uno screenshot tramite AutoHotKey. Articolo disponibile sul blog: https://wp.me/pdQ5q-thc
; *********************** Header - some configuration ***********************
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors. (disabled by default)
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
setTitleMatchMode, 2 ; set title match mode to "contains"
;Open System Properties
ActivateOrOpen("Impostazioni", "ms-settings:about")
WinMaximize
;Open Appwiz.cpl and search for M365Apps
ActivateOrOpen("Programmi e funzionalità", "appwiz.cpl")
WinMove, , , , , , 400, ,
WinGetPos X, Y, Width, Height
MaxX := A_ScreenWidth - Width
MaxY := A_ScreenHeight - Height - 30
WinMove, , ,%MaxX%, %MaxY%
Send, ^f
Send, "Microsoft 365 Apps"
;Take screenshot
Sleep 1000
FileCreateDir C:\Temp
;Run "%A_WorkingDir%\screenCapture.exe" "%A_ComputerName%.png"
Run "%A_WorkingDir%\screenCapture.exe" "C:\Temp\scrdel_%A_ComputerName%.png", , Min,
;Close Windows
Sleep 1000
ActivateOrOpen("Programmi e funzionalità", "appwiz.cpl")
Send !{F4}
ActivateOrOpen("Impostazioni", "ms-settings:about")
Send !{F4}
ActivateOrOpen(window, program)
{
; check if window exists
if WinExist(window)
{
WinActivate ; Uses the last found window.
}
else
{ ; else start requested program
Run cmd /c "start ^"^" ^"%program%^"",, Hide ;use cmd in hidden mode to launch requested program
WinWait, %window%,,5 ; wait up to 5 seconds for window to exist
IfWinNotActive, %window%, , WinActivate, %window%
{
WinActivate ; Uses the last found window.
}
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment