Contributions
Re: Issues with TC8 and Office 2010 Using DDT
Well, I've managed to figure out the issues I was experiencing since installing TestComplete 8 onto a new system and running into various problems with my scripts (that were running and working on a different machine). First off, because this new machine has Office 2010 64-bit installed, I could not use the DDT Driver for Excel spreadsheets properly and fixed this issue by removing Office 2010 and installing a 32-bit version of Office 2007 (note that I could have also chose to use the DDT Driver for CSV files as it appeared to work regarless of my Office version, but I chose to have Excel functionality so I am sticking with Office 2007 for now). Secondly, I was having issues sending out email reports from my scripts using the CDO functionality from within TestComplete; Although my emails would appear to be send out without errors, they never arrived in the mailbox specified in the script. Turns out it was due to Avast Antivirus and it's "MailShield", which was blocking TestComplete from actually sending out the email reports (note that the built in SendMail function worked however, but I require use of the SendEmail function using CDO as I have multipleattachmentsthat need to be sent with my emails) So by disabling the "MailShield" feature within Avast, my emails were finally being sent out as they should. I also did *not* have to install that CDO package for Office 2007 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2714320d-c997-4de1-986f-24f081725d36&DisplayLang=en), nor do I have an actual profile/data file/email account setup in Outlook itself; It just works as is with Office 2007 installed. (and might work with 2010 but I cannot say for certain as I had this issue when running 2010 before but again it was due to Avast Antivirus) Anyways, I now appear to finally have my old scripts working again on this new machine. Too bad it cost me a day in productivity trying to debug these issues, which is why I thought I would post my findings in case anyone else runs into these same issues. Thanks.1.2KViews0likes0CommentsRe: Issues with TC8 and Office 2010 Using DDT
It's definitly a 64bit issue related to Office 2010; I've removed it and now installed Office 2007 and the DDT Driver for Excel spreadsheet functionality is working again. Now I've run into another issue in that my email script is no longer working; I believe it has something to do with Office as well (see my post here:http://www.automatedqa.com/forums/forum/post/?mode=singleThread&thread=5cba3cea-4b84-45c0-bd8b-4f18a62959fd) in that CDO is not supported in Office 2010 (which is another reason why I downgraded to 2007) and requires the following to be installed for it to work with Office 2007:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2714320d-c997-4de1-986f-24f081725d36&DisplayLang=en-- Hopefully this will resolve my email issues. Will post back with my results.1.2KViews0likes0CommentsSend folder of attachments using built in Sendmail
Is there any way to send a folder of attachments using the built in sendmail function of TestComplete (as opposed to using theCollaboration Data Objects to do this?) I ask because Office 2010 (Outlook 2010) no longer includes CDO support (see:http://support.microsoft.com/kb/2028411) and I would like to use the built in sendmail function instead. Does anyone know of a way to generate a file name list by way of a folder's content using VBScript - And subsequently inserting that list into the SendMail function? (http://www.automatedqa.com/support/viewarticle.aspx?aid=12301) Thanks!16KViews0likes1CommentRe: Issues with TC8 and Office 2010 Using DDT
So I tried that Access package and it does nothing; Still having issues running my script when trying to pull variables from an excel spreadsheet. Would it be due to the fact that I have Office 2010 64 bit installed? I really need to get this functional again, any help is greatly appreciated!1.2KViews0likes0CommentsRe: Issues with TC8 and Office 2010 Using DDT
I guess my question is doesDDT.ExcelDriver run depending on if you have Office installed, and does it work with Office/Excel 2010? It doesn't appear to work with a machine that has Office 2010 but did before on another machine with Office 2007 installed. Please let me know :) Thanks! Update: not 100% certain but do I need somthing like the following to be installed?http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en1.2KViews0likes0CommentsIssues with TC8 and Office 2010 Using DDT
Hello, I've recently upgrading the computer we use for writing routines on TC8, and since upgrading I am now having issues running the scripts when using values from an Excel spreadsheet using DDT. Testcomplete will run the script but nothing happens and no errors are given. Is there issues when using the Excel DDT Driver and Office 2010? Do we require Office 2007 to be installed instead? Thank you.13KViews0likes6CommentsRe: Email a folder instead of individual files using script.
Okay, I think I'm on to somthing but cannot seem to make it work. As found on this site: http://www.winfrastructure.net/article.aspx?BlogEntry=VBScript-to-check-if-folder-is-empty What I'm trying to do is see if either oFolder is empty then set it to another folder with a generic image placed in it, using something like so: If oFolder.Files.Count = 0 Then Set oFolder = aqFileSystem.GetFolderInfo("F:\temp2") End If But I keep getting an error. If anyone has any suggestions, I'm all ears... UPDATE: I've managed to get it working. Basically, I am now using the following two scripts: For taking screenshots: Sub Main If aqFileSystem.Exists("F:\temp") Then Sys.Desktop.ActiveWindow().Picture.SaveToFile "F:\temp\" + VarToStr(Project.Variables.Screenshot_Filename) Else aqFileSystem.CreateFolder("F:\temp") Sys.Desktop.ActiveWindow().Picture.SaveToFile "F:\temp\" + VarToStr(Project.Variables.Screenshot_Filename) End If End Sub And emailing logs/screenshots: Function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) Err.Clear On Error Resume Next schema = "http://schemas.microsoft.com/cdo/configuration/" Set mConfig = Sys.OleObject("CDO.Configuration") mConfig.Fields.Item(schema + "sendusing") = 2 ' cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver") = "smtp.mailserver.address" ' SMTP server mConfig.Fields.Item(schema + "smtpserverport") = 25 ' Port number ' mConfig.Fields.Item(schema + "sendusername") = "" ' User name (if needed) ' mConfig.Fields.Item(schema + "sendpassword") = "" ' User password (if needed) mConfig.Fields.Update() Set mMessage = Sys.OleObject("CDO.Message") mMessage.Configuration = mConfig mMessage.From = mFrom mMessage.To = mTo mMessage.Subject = mSubject mMessage.HTMLBody = mBody aqString.ListSeparator = "," For i = 0 To aqString.GetListLength(mAttachment) - 1 mMessage.AddAttachment aqString.GetListItem(mAttachment, i) Next mMessage.Send If Err.Number > 0 Then Log.Error "E-mail cannot be sent", Err.Description SendEMail = False Else Log.Message "Message to <" + mTo + "> was successfully sent" SendEMail = True End If End Function Sub MainTest ' checks to see if there are any existing screenshots If aqFileSystem.Exists("F:\temp") Then Set oFolder = aqFileSystem.GetFolderInfo("F:\temp") Else Set oFolder = aqFileSystem.GetFolderInfo("F:\temp2") End If Set colFiles = oFolder.Files strFileList = "" aqString.ListSeparator = "," While colFiles.HasNext Set f = colFiles.Next strFileList = aqString.AddListItem(oFolder.Path + "\" + f.Name, strFileList) Wend ListFiles = strFileList ' this executes the email function If SendEmail("from@email.com", "to@email.com", "Subject", _ "Message Body", "" + ListFiles + "") Then ' Message was sent Else ' Message was not sent End If ' deletes the screenshot folder If aqFileSystem.Exists("F:\temp") Then For Each aFile In oFolder.Files aFile.Delete Next aqFileSystem.DeleteFolder("F:\temp") End If End Sub And as long as I set my variable for the screenshot filename (along with some other stuff that I removed from the example above) it works beautifully! (and I didn't erase my entire C: drive in the process!) So thanks for letting me chat to myself on here today :) Regardless, I have it working the way I like and I couldn't have gotten to this point without all of your help. Thanks again!2.4KViews0likes0CommentsRe: Email a folder instead of individual files using script.
Little worried to ask as this could cause potential security issues, but is there a way to delete the entire contents of a folder using VBScript? That way I could "flush" this screenshots folder at the start of the script routine to avoid attaching images from previous executions of the script. UPDATE: I've figured out how to deleted or flush the directory by inserting the following code before the End Sub line of the MainTest: For Each aFile In oFolder.Files aFile.Delete Next However, I've notice I will get an error if the screenshots folder is empty and the email script is ran (see attached image); Is there any way to change this so to avoid this error? I will do my best to figure out a solution, but if anyone has any insight, please feel free to share :) Thanks!2.4KViews0likes0CommentsRe: Email a folder instead of individual files using script.
Alright, so the comma thing at the begining was causing an issue, and I've managed to move it to the end of the array and now it works (after some other tweaks, like adding the full path to the array as well). Anyways, like I said, I'm really new to VBScript so this may be a conveluted way to achieve this but it is working so I could care less :) Here is my working script: Function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) Err.Clear On Error Resume Next schema = "http://schemas.microsoft.com/cdo/configuration/" Set mConfig = Sys.OleObject("CDO.Configuration") mConfig.Fields.Item(schema + "sendusing") = 2 ' cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver") = "my.smtp.server" ' SMTP server mConfig.Fields.Item(schema + "smtpserverport") = 25 ' Port number ' mConfig.Fields.Item(schema + "sendusername") = "" ' User name (if needed) ' mConfig.Fields.Item(schema + "sendpassword") = "" ' User password (if needed) mConfig.Fields.Update() Set mMessage = Sys.OleObject("CDO.Message") mMessage.Configuration = mConfig mMessage.From = mFrom mMessage.To = mTo mMessage.Subject = mSubject mMessage.HTMLBody = mBody aqString.ListSeparator = "," For i = 0 To aqString.GetListLength(mAttachment) - 1 mMessage.AddAttachment aqString.GetListItem(mAttachment, i) Next mMessage.Send If Err.Number > 0 Then Log.Error "E-mail cannot be sent", Err.Description SendEMail = False Else Log.Message "Message to <" + mTo + "> was successfully sent" SendEMail = True End If End Function Sub MainTest Set oFolder = aqFileSystem.GetFolderInfo("C:\Documents and Settings\User\My Documents\TestComplete 8 Projects\Automation\Screenshots") Set colFiles = oFolder.Files strFileList = "" aqString.ListSeparator = "," While colFiles.HasNext Set f = colFiles.Next strFileList = aqString.AddListItem("C:/Documents and Settings/User/My Documents/TestComplete 8 Projects/Automation/Screenshots/" + f.Name, strFileList) Wend ListFiles = strFileList If SendEmail("sent-from@email.com", "send-to@email.com", "Automated Testing", _ "This is a test message.", "" + ListFiles + "") Then ' Message was sent Else ' Message was not sent End If End Sub If someone knows a cleaner way to achieve this, or a way to remove the additional comma at the end of the ListFiles array (which causes a "noname" attachement to be attached along with the entire folder contents) then I'd be interested in hearing your solutions. Otherwise, I'm happy that it at least works and is doing what I require :) Thanks for all your help! Much appreciated!2.4KViews0likes0CommentsRe: Email a folder instead of individual files using script.
Okay, that works (somewhat) but I'm a complete moron when it comes to VBScript, so how do I use the Email function in combination with creating this file list to email attachements? My code is as follows: Function ListFiles(folder) Dim oFolder, colFiles, f Set oFolder = aqFileSystem.GetFolderInfo(folder) Set colFiles = oFolder.Files strFileList = "" aqString.ListSeparator = "," While colFiles.HasNext Set f = colFiles.Next strFileList = aqString.AddListItem(strFileList, f.Name) Wend ListFiles = strFileList End Function Function SendEmail(mFrom, mTo, mSubject, mBody, mAttachment) Err.Clear On Error Resume Next schema = "http://schemas.microsoft.com/cdo/configuration/" Set mConfig = Sys.OleObject("CDO.Configuration") mConfig.Fields.Item(schema + "sendusing") = 2 ' cdoSendUsingPort mConfig.Fields.Item(schema + "smtpserver") = "my.smtp.server" ' SMTP server mConfig.Fields.Item(schema + "smtpserverport") = 25 ' Port number ' mConfig.Fields.Item(schema + "sendusername") = "" ' User name (if needed) ' mConfig.Fields.Item(schema + "sendpassword") = "" ' User password (if needed) mConfig.Fields.Update() Set mMessage = Sys.OleObject("CDO.Message") mMessage.Configuration = mConfig mMessage.From = mFrom mMessage.To = mTo mMessage.Subject = mSubject mMessage.HTMLBody = mBody aqString.ListSeparator = "," For i = 0 To aqString.GetListLength(mAttachment) - 1 mMessage.AddAttachment aqString.GetListItem(mAttachment, i) Next mMessage.Send If Err.Number > 0 Then Log.Error "E-mail cannot be sent", Err.Description SendEMail = False Else Log.Message "Message to <" + mTo + "> was successfully sent" SendEMail = True End If End Function Sub MainTest If SendEmail("do-not-reply@mail.com", "automated@test.com", "Automated Testing", _ "This is a test message.", ListFiles("C:/Documents and Settings/User/My Documents/TestComplete 8 Projects/Automation/Screenshots/")) Then ' Message was sent Else ' Message was not sent End If End Sub The script runs without error, but the attachements are not being sent (says "noname" as an attachment). UPDATE: I know what the issue is. The comma seperator is being placed at the begining of the list of files, so they show up as ",C:\temp\1.jpg, C:\temp\2.jpg, C:\temp\3.jpg" ect. I need to remove that comma at the begining and it should work...2.4KViews0likes0Comments