AutoIt: Снимка на екрана
Публикувано: 09.08.13, 15:06:35 | Автор: ArMeN | Видяна: 1138 | Редактирано: 20.07.16, 20:14:29
#include <ScreenCapture.au3>
_ScreenCapture_Capture("img.jpg")
След натискането на клавиша F4 скрипта заснима екрана при натискане на бутона ESC скрипта спира.#include <ScreenCapture.au3>
Opt("TrayIconHide",1)
HotKeySet("{F4}", "PrintScreen")
HotKeySet("{ESC}", "Close")
While 1
Sleep(100)
WEnd
Func PrintScreen()
_ScreenCapture_Capture(@DesktopDir & "\" & @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & "-" & @MIN & "-" & @SEC & ".jpg")
EndFunc
Func Close()
Exit
EndFunc
Още един метод...#Include <ClipBoard.au3>
#Include <GDIPlus.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
_ScreenCapture(@ScriptDir & '\Screenshot.jpg')
Func _ScreenCapture($sFile)
Local $Result, $Timer, $hImage, $hBitmap = 0
ClipPut('')
Send('{PRINTSCREEN}')
$Timer = TimerInit()
While TimerDiff($Timer) < 1000
_ClipBoard_Open(0)
$hBitmap = _ClipBoard_GetDataEx($CF_BITMAP)
_ClipBoard_Close()
If $hBitmap Then
ExitLoop
EndIf
WEnd
If Not $hBitmap Then
Return 0
EndIf
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$Result = _GDIPlus_ImageSaveToFile($hImage, $sFile)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Return $Result
EndFunc
Няма коментари.