Print Screen with Autoit
Print Screen with Autoit
; Press Esc to Print Screen and terminate script
#include <GDIPlus.au3>
#include <ClipBoard.au3>
Global $UnPaused
HotKeySet("1", "TogglePause")
HotKeySet("{ESC}", "Terminate")
While 1
Sleep(100)
ToolTip("Script is Paused",0,0)
WEnd
Func TogglePause()
$UnPaused = NOT $UnPaused
While $UnPaused
ToolTip("Sending...",0,0)
Send("z")
WEnd
EndFunc
Func Terminate()
; Capture full screen
Send("{PRINTSCREEN}") ; Screen
;Send("!{PRINTSCREEN}") ; window
_Main()
ShellExecute(@ScriptDir & "\Image.jpg")
Exit 0
EndFunc
Func _Main()
Local $hBmp, $hImage
If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed")
$hBmp = _ClipBoard_GetDataEx($CF_BITMAP)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
; Save bitmap to file
_GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Image.jpg") ;$sNewName)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_Shutdown()
_ClipBoard_Close()
EndFunc ;==>_Main
(Contains 1 attachments.)
How to kill a process with Autoit
How to kill a process with Autoit
Dim $Process $Process = InputBox($Process, "Process to kill?", ".exe", "", -1, -1, 0, 0) ProcessClose($Process) MsgBox(4096, "Test", $Process, 10)
(Contains 1 attachments.)
How to tracert with Autoit
I just wrote a beautiful script which can be used by support team while requesting tracert from client.
the script creates a text file of tracert which the client can email.
filedelete( @tempdir & "\output.txt" ) $ip = InputBox( "TRACERT", "Enter Site or IP", "www.google.com" ) $hops = InputBox( "TRACERT", "Enter Hops", 30 ) $timeout = InputBox( "TRACERT", "Enter Timeout in miliseconds", 1000 ) $output1 = "tracert for "&$ip&" 1.txt" TrayTip( "TRACERT", "Processing, Please Wait", 5, 16) ;RunWait (@ComSpec & " /c " & "tracert" & " -d " & "www.google.com" & " -h " & $hops & " -w " & $timeout & " >> " & @tempdir & "\output.txt", "", @SW_HIDE) RunWait (@ComSpec & " /c " & "tracert" & " -d " & $ip & " -h " & $hops & " -w " & $timeout & " >> " & @tempdir & "\output.txt", "", @SW_HIDE) $output = FileRead( @tempdir & "\output.txt" ) FileWriteLine($output1, $output) filedelete( @tempdir & "\output.txt") $output = StringStripCR ( $output ) msgbox(0,"Tracert Complete",$output)
(Contains 1 attachments.)
