Skip to main content

Posts

Showing posts from June, 2015

Send Mail uisng Outlook with Vb Script or QTP/UFT

strToaddress  =   "Jayakrishna@sample.com; Jayakrishna2@sample.com " strSubject  =   "Sample-Subject" strBody  =   "Sample-Body" strAttachPath  =   "C:\Dump\Sample.txt" SendMailFromOutlook strToaddress,strSubject,strBody,strAttachPath Function  SendMailFromOutlook ( strToaddress,strSubject,strBody,strAttachPath )        Dim  objOut, Objmail        Set  objOut  =   CreateObject ( "Outlook.Application" )        Set  Objmail  =  objOut.CreateItem ( 0 )                   With  Objmail         . To   =  strToaddress         .Subject  =  strSubject         .Body  =  strBody          If  strAttachPath  <>   ""   Then                                .Attachments.Add ( strAttachPath )          End   If         .Save         .Send        End   With             'Clear the memory        Set  objOut  =   Nothing        Set  Objmail  =   Nothing End   Function Note : Mail will be sent from your Local Co

ZipFiles/Folders Using VB Script in QTP/UFT

Sample:  strmyFolderPath = "C:\Jay\Sample" strZipFilePath  = " C:\Jay\My SampleFile.Zip" Call  ZipMyFolder (  strmyFolderPath, strZipFilePath  ) Function  ZipMyFolder (  strmyFolderPath, strZipFilePath  )      Dim  intSkipped, intSrcItems      Dim  objApp, objFolder, objFSO, objItem, objTxt      Dim  strSkipped      Const  ForWriting  =   2     intSkipped  =   0      ' Make sure the path ends with a backslash      If   Right (  strmyFolderPath,  1   )   <>   "\"   Then         strmyFolderPath  =  strmyFolderPath  &   "\"      End   If      ' Use custom error handling      On   Error   Resume   Next      ' Create an empty ZIP file      Set  objFSO  =   CreateObject (   "Scripting.FileSystemObject"   )      Set  objTxt  =  objFSO.OpenTextFile (  strZipFilePath, ForWriting,  True   )     objTxt. Write   "PK"   &   Chr ( 5 )   &   Chr ( 6 )   &   String (   18 ,  Chr (