Jump to content

Recommended Posts

Posted (edited)

I am fully capable of doing Screenshots on my computer, I know the code.

What Im trying to do is have a live continuous screenshot feed of the computer being displayed on a webpage, preferably using ftp to upload the screenshot.jpg

I've sifted thru some ftp code but every example or script doesn't seem to work.

I don't have any demo code. Im basically just issuing the Screenshot ---- Sending to Webserver ---> Displaying on Website.

If you can get me started or pointed in the right direction I would be very appreciative.

/edit:

I know you can't upload a file that is open without it failing so if the screenshot file is being created or overwritten how would I go about doing this?

Edited by BlackDawn187
Posted

Search the help file for ftp that will get you started. Taking the screenshot with _ScreenCapture_Capture and then uploading the file should not cause you any issues.

[size="1"]Please stop confusing "how to" with "how do"[/size]

Posted

Okay so heres some demo code:

;Screen Capture time
    Local $h
        $h = WinGetHandle("WindowTitle")
    WinActivate("Window Title")
    BlockInput(1)
    _ScreenCapture_CaptureWnd("ScreenCapture.jpg", $h)
    BlockInput(0)
    
    ;Upload Screen Capture to Web Server - Using Ftp
    $server = 'ftp.website.org'
        $username = 'username'
        $pass = 'password'
    $s_LocalFolder = "C:\Users\*****\Desktop\ScreenCapture.jpg"
    $s_RemoteFolder = "/public_html"

    $Open = _FTP_Open('MyFTP Control')
    $Conn = _FTP_Connect($Open, $server, $username, $pass)
    ;Insert what commands you want to do once connected here
    MsgBox(4096, "", "FTP Connection Success.")
    _FTP_DirPutContents($s_LocalFolder, $s_RemoteFolder)
    MsgBox(4096, "", "Upload Success?")
    $Ftpc = _FTP_Close($Open)

The _FTP_DirPutContents keeps issuing at error because of the "_" in front. Any suggestions?

Posted (edited)

The help file shows $l_InternetSession as the variable handling the connection, but should be $Conn I believe. As well I noticed I was using FTP do folder work so this is what I've come up with since:

$server = 'ftp.website.org'
$username = 'username'
$pass = 'password'
$s_LocalFile = 'C:\Users\*****\Desktop\*****\ScreenCapture.jpg'
$s_RemoteFile = '/public_html/ScreenCapture.jpg'
    
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
;Insert what commands you want to do once connected here
MsgBox(4096, "Window Name", "FTP Connection Success.")
$FilePut = _FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile)
MsgBox(4096, "Window Name", "Upload Success?")
$Ftpc = _FTP_Close($Open)

Now it will display the 2nd Message Box but still doesn't upload any file.

Edited by BlackDawn187
Posted

What does $conn and $fileput return?

All I know is that they're not generating any errors. But no data is being sent to the ftp server. $Conn executes and then displays the msgbox I have after it which means to me that its either connecting or pretending to connect, same goes with the fileput.

Posted

Here now you should know what $conn and $fileput return. Compare the results to the return values in the help file.

$server = 'ftp.website.org'
$username = 'username'
$pass = 'password'
$s_LocalFile = 'C:\Users\*****\Desktop\*****\ScreenCapture.jpg'
$s_RemoteFile = '/public_html/ScreenCapture.jpg'
    
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

MsgBox(0, "$Conn Returned", $Conn) ; This tells us what the variable $Conn contains.

;Insert what commands you want to do once connected here
MsgBox(4096, "Window Name", "FTP Connection Success.")
$FilePut = _FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile)

MsgBox(0, "$FilePut Returned", $FilePut) ; This tells us what the variable $FilePut contains.

MsgBox(4096, "Window Name", "Upload Success?")
$Ftpc = _FTP_Close($Open)

[size="1"]Please stop confusing "how to" with "how do"[/size]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...