
Walkabout
Active Members-
Posts
37 -
Joined
-
Last visited
Everything posted by Walkabout
-
FYI This UDF no longer seems to work with the latest beta 3.2.10. Walkabout
-
Hi All, I needed a procedure to recursively get the contents of a remote directly, so here it is: ;=============================================================================== ; ; Function Name: _FTPGetFoldercontents ; Description: Recursively retrieves the contents of a directory on an FTP server. ; Parameter(s): $s_Server - Server name/ip. ; $s_Username - Username. ; $s_Password - Password. ; $s_RemoteDir - The directory on the server to retrieve. End in "/" ; $s_LocalDir - The Local directory to save to ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - None. Byref variable $i_Count returns number of files (not ; including directories) transferred. ; On Failure - None, exits with Msg. Opportunity here for some improvement ; Author(s): Walkabout 2006-10-18 ; ;=============================================================================== Func _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir, $s_LocalDir, ByRef $i_Count) Local $h_Handle Local $DllRect Local $FileInfo[12] Local $Open Local $Conn Local $s_Filename ;Open the Connection. This has to be done for each new level of recusion. $Open = _FTPOpen ('MyFTP Control') If @error Then Failed ("Open") $Conn = _FTPConnect ($Open, $s_Server, $s_UserName, $s_Password, 1) If @error Then Failed ("Connect") ;First File If Not FileExists($s_LocalDir) Then DirCreate($s_LocalDir) $FileInfo = _FtpFileFindFirst ($Conn, $s_RemoteDir & '*.*', $h_Handle, $DllRect) $error = @error If Not $FileInfo[0] Then Return $s_Filename = $FileInfo[10] ConsoleWrite($i_Count & " - " & $s_RemoteDir & $s_Filename & @LF) If $FileInfo[1] = 16 Then;Directory. Recurse down one level If $s_Filename <> "." And $s_Filename <> ".." Then If Not FileExists($s_LocalDir & $s_Filename & "\") Then DirCreate($s_LocalDir & $s_Filename & "\") _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir & $s_Filename & "/", $s_LocalDir & $s_Filename & "\", $i_Count) EndIf Else; File. Retrieve it $Result = _FTPGetFile ($Conn, $s_RemoteDir & $s_Filename, $s_LocalDir & $s_Filename) $i_Count += 1 EndIf ;Subsequent Files While 1 $FileInfo = _FtpFileFindNext ($h_Handle, $DllRect) If Not $FileInfo[0] Then Return $s_Filename = $FileInfo[10] ConsoleWrite($i_Count & " - " & $s_RemoteDir & $s_Filename & @LF) If $FileInfo[1] = 16 Then;Directory. Recurse down one level If $s_Filename <> "." And $s_Filename <> ".." Then If Not FileExists($s_LocalDir & $s_Filename & "\") Then DirCreate($s_LocalDir & $s_Filename & "\") _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir & $s_Filename & "/", $s_LocalDir & $s_Filename & "\", $i_Count) EndIf Else; File. Retrieve it $Result = _FTPGetFile ($Conn, $s_RemoteDir & $s_Filename, $s_LocalDir & $s_Filename) $i_Count += 1 EndIf WEnd EndFunc ;==>_FTPGetFolderContents and an example #include <ftp.au3> $server = 'ftp.myserver.com' $username = 'ftpuser' $pass = 'password' Local $RemoteDir = '/wwwroot/' Local $LocalDir = "C:\TempDir\" Local $Count = 0 _FTPGetFolderContents($Server, $UserName, $Pass, $RemoteDir, $LocalDir,$Count) msgbox(0,"Complete",$Count & " Records Processed") I played around with the code a little, tidying it up before posting. As I can't test that my changes haven't broken it, let me know if you spot any issues. Walkabout
-
Autoit can use for Outlook Plugin?
Walkabout replied to srinivas224's topic in AutoIt General Help and Support
I'm not sure if this is what you are looking for, but check AutoIt for the Masses in my Sig. Walkabout. -
Galenda - a calendar application in AutoIt
Walkabout replied to peethebee's topic in AutoIt Example Scripts
If you are using an exe I'm assuming you want to do one of two things. 1) Encrypt the database file. This could only be done safely when the database was not in use, either by: i) Decrypting at startup and then encrypting at close. This would leave the database file unencrypted the whole time the application was running, which would almost be pointless from a security perspective. Especially as calendar applications tend to remain open most of the time. ii) Decrypting every time you wish to access the database and then re-encrypting when finished would slow down response times and be very inefficient. 2) Encrypt the data via a temporary text file and then feeding that in to an unencrypted database file. Sounds painful and unlikely to be faster than using a UDF. If you use a DLL to encrypt data on the fly, then you are really only encrypting text, and therefore a UDF would do. There doesn't seem to be many free open-source encryption DLLs out there anyway. Are you sure that an exe/dll is the right way to go? Why don't you use one of the many good UDFs here on the forum and then save the encrypted text into an unencrypted database file? Walkabout. -
Galenda - a calendar application in AutoIt
Walkabout replied to peethebee's topic in AutoIt Example Scripts
Does that mean you might want to encrypt binary data. If so, and if you don't mind me asking, what binary data would a calendar application want to encrypt? I'll have a troll through the forum to see if I can track down a good encryption UDF. Walkabout. -
Galenda - a calendar application in AutoIt
Walkabout replied to peethebee's topic in AutoIt Example Scripts
I had a bit of a poke around, and options which immediately sprung to mind were crosscrypt, truecrypt and gpg. The first two are more about mounting virtual drives which use encrypted files to store their data, so they are probably not ideal. GPG is a strong possiblity. It is GPL, and proven, but the exe is about 850k. Is this too large? I'm also wondering what you want it for. Could a DLL do? How strong do you want the encryption? Would something simpler do (eg ROT13) or does it need to be encrypted? Do we want open source, or would closed source freeware do? Just let me know and I'll try to help. Walkabout -
Galenda - a calendar application in AutoIt
Walkabout replied to peethebee's topic in AutoIt Example Scripts
peethebee, This is fantastic. I've been wanting to write my own PIM, but wasn't sure how to do the display. I'd like to help, but I haven't spoken any German in about twenty years, and even then it was non-technical. I'm not sure how it could be done, but if we could work out a way to get both english and german discussions going, it could help things along. It would be cool to have the UI based on language files too, so that it's international. Walkabout -
Have the integrity to honetly say who you are in your eMails. Anything else is phishing or spamming! It's things like this that give the rest of the AutoIt community a bad name. Walkabout
-
Interfacing With Java Windows
Walkabout replied to esfalk's topic in AutoIt General Help and Support
Bump -
Script for all database connections...
Walkabout replied to Raestlin's topic in AutoIt Example Scripts
Thanks Ptrex. You've made me a very happy scripter!!!!! Walkabout -
Interfacing With Java Windows
Walkabout replied to esfalk's topic in AutoIt General Help and Support
We looked at some automated testing solutions for work a little while ago, and being an AutoIt user, I asked the question about Java Controls. The answer was that with a special plugin, Quicktest Pro by Mercury (Used to be called WinRunner) is able to interact with Java controls. Anyone got any insights on how they might do it and if the technique could be ported to AutoIt? Brief reference here Ta Walkabout -
Script for all database connections...
Walkabout replied to Raestlin's topic in AutoIt Example Scripts
Fantastic Post Raestlin. I've been struggling with trying to connect to an AS400 database without resorting to ODBC for a long time now, and had no success. How did you determine what the DSN connect strings should be, and maybe I can add another one? Thanks Walkabout -
jpm, I noticed that the new error codes were missing from the documentation for _INetSMTPMail, so here's the updated help for the next release. Let me know if this should have been posted somewhere else. Regards Walkabout INetSMTPMail.txt
-
Internet Explorer Automation UDF library
Walkabout replied to DaleHohm's topic in AutoIt Example Scripts
Hi All, Thanks for such a useful UDF. I've been using it extensively recently and found it to be very helpful. A quick question if I may? When accessing many web pages, has anyone come across a problem with IE consuming more and more available memory until the system grinds to a halt? I think this is an IE problem, but I'm wondering if anyone has any ideas on how to 'band-aid' it using UDF. Thanks Walkabout -
code of sending Email through Telnet
Walkabout replied to Clever1mba's topic in AutoIt Example Scripts
Firestorm, At this stage you can't. Walkabout -
Weird or wrong? I'm a bit rusty on regexp but it looks ok to me. Found it on the net. Hmmm, didn't think of that. I'm pretty sure my ISP blocks access to smtp servers other than its own. It' supposed to combat spam. Anyone have an ISP that doesn't do that that would like to expand the code to include a password? Walkabout.
-
code of sending Email through Telnet
Walkabout replied to Clever1mba's topic in AutoIt Example Scripts
Added to the UDF thread at the top of this forum Latest version of function (plus associated files) Walkabout. -
DIRECT eMail UDF This udf will send an email using TCP rather than an external mail client. Link to thread Latest version and associated UDF files attached. INetSmtpMail.au3INetSmtpMail.txtINetSmtpMail_Example.au3
-
SQLite semi Embedded database functionality in AutoIt
Walkabout replied to ptrex's topic in AutoIt Example Scripts
Been poking around as part of some preliminary work for a major piece of development work I'm going do for myself and I've come up with a major limitation (for this case) of SQLite. Database level locking! Means I can't have one script inserting data at the same time as I have another script selecting it. This obviously wouldn't matter for simple, single user applications, but anything more complex will need to use a database with row level locking. Speaking of which, Firebird looks pretty good. Anyone done any work on connecting to a Firebird database using the client DLL (like the SQLite stuff here), rather than using ODBC? Walkabout. -
Who wants a callback function capability ?
Walkabout replied to AutoIT Geek's topic in AutoIt Example Scripts
You gonna share or just gloat? Walkabout -
code of sending Email through Telnet
Walkabout replied to Clever1mba's topic in AutoIt Example Scripts
Here it is (Thanks to MHz for his help) ;=============================================================================== ; ; Function Name: _INetSmtpMail() ; Description: Sends an email using SMTP over TCP IP. ; Parameter(s): $s_SmtpServer - SMTP server to be used for sending email ; $s_FromName - Name of sender ; $s_FromAddress - eMail address of sender ; $s_ToAddress - Address that email is to be sent to ; $s_Subject - Subject of eMail ; $as_Body - Single dimension array containing the body of eMail as strings ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - 0 and sets ; @ERROR = 1 - Invalid Parameters ; @ERROR = 2 - Unable to start TCP ; @ERROR = 3 - Unable to resolve IP ; @ERROR = 4 - Unable to create socket ; @ERROR = 5 - Data send or SMTP Protocol error ; Authors: Original function to send email via TCP - Asimzameer ; Conversion to UDF - Walkabout ; ;=============================================================================== Func _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $i_ReturnErrorCode Local $i_LocalErrorCode Local $v_Socket Local $s_IPAddress Local $i_SendReturn Local $i_Count Local $s_Send[10] If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then SetError(1) Return 0 EndIf $i_LocalErrorCode = TCPStartup() If $i_LocalErrorCode = 0 Then SetError(2) Return 0 EndIf StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") If @extended Then $s_IPAddress = $s_SmtpServer Else $s_IPAddress = TCPNameToIP($s_SmtpServer) EndIf If $s_IPAddress = "" Then TCPShutdown() SetError(3) Return 0 EndIf $v_Socket = TCPConnect($s_IPAddress, 25) If $v_Socket = -1 Then TCPShutdown() SetError(4) Return (0) EndIf Sleep(100) $s_Send[0] = "HELO " & $s_FromAddress & @CRLF $s_Send[1] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF $s_Send[2] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF $s_Send[3] = "DATA" & @CRLF $s_Send[4] = "From:" & $s_FromName & "< " & $s_FromAddress & " >" & @CRLF $s_Send[5] = "To:" & $s_ToAddress & @CRLF $s_Send[6] = "Subject:" & $s_Subject & @CRLF ;$s_Send[7] = "Sender: AutoIt3" & @CRLF $s_Send[7] = "Mime-Version: 1.0" & @CRLF $s_Send[8] = "Content-Type: text/plain; charset=US-ASCII" & @CRLF $s_Send[9] = @CRLF For $i_Count = 0 To UBound($s_Send) - 1 $i_SendReturn = TCPSend($v_Socket, $s_Send[$i_Count]) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf Sleep(100) $s_Receive = TCPRecv($v_Socket, 1000) Next Sleep(100) For $i_Count = 0 To UBound($as_Body) - 1 $i_SendReturn = TCPSend($v_Socket, $as_Body[$i_Count] & @CRLF) Sleep(100) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf $s_Receive = TCPRecv($v_Socket, 1000) Sleep(100) Next $i_SendReturn = TCPSend($v_Socket, @CRLF & "." & @CRLF) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf Sleep(100) TCPCloseSocket($v_Socket) TCPShutdown() Return 1 EndFunc ;==>_INetSmtpMail And simple wrapper script is: #include <INetSmtpMail.au3> $s_SmtpServer = "mysmtpserver.com.au" $s_FromName = "My Name" $s_FromAddress = "From eMail Address" $s_ToAddress = "To eMail Address" $s_Subject = "My Test UDF" Dim $s_Body[2] $s_Body[0] = "Testing the new email udf" $s_Body[1] = "Second Line" $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body) $err = @error msgbox(0,"email",$Response) msgbox(0,"error",$err) -
Ahh, thanks MHz! I removed the msgbox() around the @error, but not the INetSmtpMail() itself. Walkabout
-
Hi all, I'm working on a UDF version of the SMTP mailsend script posted by Asimzameer in Scripts and Scraps. I've almost got a simple but functioning version working......except the SetError function doesn't seem to work. I'm sure I'm overlooking something obvious here. Can anyone see what it is? ;=============================================================================== ; ; Function Name: _INetSmtpMail() ; Description: Sends an email using SMTP over TCP IP. ; Parameter(s): $s_SmtpServer - SMTP server to be used for sending email ; $s_FromName - Name of sender ; $s_FromAddress - eMail address of sender ; $s_ToAddress - Address that email is to be sent to ; $s_Subject - Subject of eMail ; $as_Body - Single dimension array containing the body of eMail as strings ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - 0 and sets ; @ERROR = 1 - Invalid Parameters ; @ERROR = 2 - Unable to start TCP ; @ERROR = 3 - Unable to resolve IP ; @ERROR = 4 - Unable to create socket ; @ERROR = 5 - Data send error ; Authors: Original function to send email via TCP - asimzameer ; Conversion to UDF - Walkabout ; ;=============================================================================== Func _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Local $i_ReturnErrorCode Local $i_LocalErrorCode Local $v_Socket Local $s_IPAddress Local $i_SendReturn Local $i_Count Local $s_Send[10] If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then SetError(1) Return 0 EndIf $i_LocalErrorCode = TCPStartup() If $i_LocalErrorCode = 0 Then SetError(2) Return 0 EndIf StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") If @extended Then $s_IPAddress = $s_SmtpServer Else $s_IPAddress = TCPNameToIP($s_SmtpServer) EndIf If $s_IPAddress = "" Then TCPShutdown() SetError(3) Return 0 EndIf $v_Socket = TCPConnect($s_IPAddress, 25) If $v_Socket = -1 Then TCPShutdown() SetError(4) Return (0) EndIf Sleep(100) $s_Send[0] = "HELO " & $s_FromAddress & @CRLF $s_Send[1] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF $s_Send[2] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF $s_Send[3] = "DATA" & @CRLF $s_Send[4] = "From:" & $s_FromName & "< " & $s_FromAddress & " >" & @CRLF $s_Send[5] = "To:" & $s_ToAddress & @CRLF $s_Send[6] = "Subject:" & $s_Subject & @CRLF ;$s_Send[7] = "Sender: AutoIt3" & @CRLF $s_Send[7] = "Mime-Version: 1.0" & @CRLF $s_Send[8] = "Content-Type: text/plain; charset=US-ASCII" & @CRLF $s_Send[9] = @CRLF For $i_Count = 0 To UBound($s_Send) - 1 $i_SendReturn = TCPSend($v_Socket, $s_Send[$i_Count]) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf Sleep(100) $s_Receive = TCPRecv($v_Socket, 1000) Next Sleep(100) For $i_Count = 0 To UBound($as_Body) - 1 $i_SendReturn = TCPSend($v_Socket, $as_Body[$i_Count] & @CRLF) Sleep(100) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf $s_Receive = TCPRecv($v_Socket, 1000) Sleep(100) Next $i_SendReturn = TCPSend($v_Socket, @CRLF & "." & @CRLF) If $i_SendReturn = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() SetError(5) Return 0 EndIf Sleep(100) TCPCloseSocket($v_Socket) TCPShutdown() Return 1 EndFunc ;==>_INetSmtpMail A down and dirty wrapper is: #include <INetSmptMail.au3> $s_SmtpServer = "mysmtpserver.com.au" $s_FromName = "My Name" $s_FromAddress = "From eMail Address" $s_ToAddress = "To eMail Address" $s_Subject = "My Test UDF" Dim $s_Body[2] $s_Body[0] = "Testing the new email udf" $s_Body[1] = "Second Line" msgbox(0,"email",_INetSmtpMail("", $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)) $err = @error msgbox(0,"error",$err) You can see that I've deliberately substituted one of the parameters to try to force an error, but I keep getting "0" back for the Return and "0" for the error. Any help anyone can give me will be greatly appreciated. Ta Walkabout
-
code of sending Email through Telnet
Walkabout replied to Clever1mba's topic in AutoIt Example Scripts
Asimzameer, Cool. I was so excited by this I've started to turn it into a UDF. I'll post it here when it's working. I've got a problem with the server unexpectely terminating the connection, and I'll be stuffed if I can work out why. Might have to post in support. Regards Walkabout. -
AutoIt3 made available to the masses
Walkabout replied to Walkabout's topic in AutoIt Example Scripts
Updated script to deal with Excel "Cannot Empty Clipboard" error. For general reference, leave a short sleep (I've had success with 50ms) between a copy in an Excel Window and a Clipget(). Excel seems to do some post copy playing around with the clipboard which conflicts with the operation of Clipget(). Walkabout.