Bonjour,
je reprends un code existant pour tester la copie d'écran.
Je n'ai rien en sortie et des codes retour dans les traces.
source
► Afficher le texte
Code : Tout sélectionner
; SCRIPT
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <file.au3>
#include <Date.au3>
#include <GUIConstantsEx.au3>
#Include <GDIPlus.au3>
#include <Clipboard.au3>
#include <ScreenCapture.au3>
; Création répertoire bugs si n'existe pas
$rep_bug="c:\BUGS"
$test= DirGetSize ($rep_bug)
if $test==-1 Then
DirCreate($rep_bug)
EndIf
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Créé le nom du fichier
$local_jour = @YEAR & "_" & @MON & "_" & @MDAY
$local_heure = @HOUR & "_" & @MIN & "_" & @SEC
;$bug_img = @ComputerName & "_" & $local_jour & "_" & $local_heure
$bug_img = "PPO_" & $local_jour & "_" & $local_heure
$bug_img = StringRegExpReplace($bug_img, " ", "") & ".png"
$bug_img = $rep_bug & "\" & $bug_img
Send("{PRINTSCREEN}")
;$bak = ClipGet()
;MsgBox(0, "Clipboard contains:", $bak)
$hGUI=GUICreate("WW")
_ClipBoard_Open ($hGUI)
$presse_papier=ClipGet()
if @error = 2 Then
$hBitmap=_ClipBoard_GetData ($CF_BITMAP)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hBitmap = ' & $hBitmap & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
_ScreenCapture_SaveImage($bug_img, $hBitmap)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _ScreenCapture_SaveImage($bug_img, $hBitmap) = ' & _ScreenCapture_SaveImage($bug_img, $hBitmap) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
EndIf
; Close the clipboard
_ClipBoard_Close ()
et les retours de trace :
Running:(3.3.6.1):D:\PPY\Mes Applis\AutoIt3\autoit3.exe "D:\PPY\Mes Applis\AutoIt3\Examples\CopieEcran.au3"
@@ Debug(44) : $hBitmap = 0
>Error code: -4
@@ Debug(46) : _ScreenCapture_SaveImage($bug_img, $hBitmap) = False
>Error code: 1
Comment les interpréter ?
Merci