'*********************************************************************************************
' Get Data Row
dataRow = TestArgs("dataRow")
DataTable.SetCurrentRow(dataRow)
' Set Output Parameter for use in subsequent components '
Parameter("submissionName") = Parameter("insuredName")
'*********************************************************************************************
' Local Parameter initialization '
LocalParameter("role")=Parameter("role")
'*********************************************************************************************
' Role '
If Parameter("role") = "Agent" Then
'insert code here
Else
'insert code here
End If
'*********************************************************************************************
' Delay '
delay1 = 5
'*********************************************************************************************
' Parse '
DataTable("automationname") = ".*" & Parameter("searchString") & ".*" ' for "The Row You Know"
Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexBox("...").FlexCanvas("Overview").FlexPanel("What's New").FlexLabel("The Row You Know").Output CheckPoint("What's New Row X")
debug below
Parameter("companyName") = "07_Daniel"
Parameter("searchString") = "Assigned to"
debug above
Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexBox("...").FlexCanvas("Overview").FlexPanel("What's New").Output CheckPoint("What's New Table")
'*********************************************************************************************
' Search a string and parse it '
messageSegment = Split( DataTable("Item_1"), Parameter("searchString") )
If messageSegment(0) = DataTable("Item_1") Then
'msgbox "same same"
messageSegment_2= Split( DataTable("Item_2"), Parameter("searchString") )
If messageSegment_2(0) = DataTable("Item_2") Then
'msgbox "same same here too"
Else
Parameter("valueObtained") = Trim( messageSegment_2(1) )
'msgbox Trim( messageSegment_2(1) )
End If
Else
Parameter("valueObtained") = Trim( messageSegment(1) )
End If
'*********************************************************************************************
' Open Submission '
comapnyRegEx = ".*" & DataTable("insuredName") & ".*"
ready = Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexDividedBox("Home").FlexPanel("casesPanel").FlexDividedBox("index:15").FlexDataGrid("contentGrid").FlexBox("automationname:="&insuredRegEx ).Exist
aName = Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexDividedBox("Home").FlexPanel("casesPanel").FlexDividedBox("index:15").FlexDataGrid("contentGrid").FlexBox("automationname:="&insuredRegEx ).GetROProperty("automationname")
aName = Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexDividedBox("Home").FlexPanel("casesPanel").FlexDividedBox("index:15").FlexDataGrid("contentGrid").FlexBox("automationname:="&insuredRegEx ).GetROProperty("automationname")
Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexDividedBox("Home").FlexPanel("casesPanel").FlexDividedBox("index:15").FlexDataGrid("contentGrid").DoubleClick aName
Browser("...").FlexApplication("...").FlexCanvas("mainScreen").FlexDividedBox("Home").FlexPanel("casesPanel").FlexDividedBox("index:15").FlexDataGrid("contentGrid").DoubleClick aName
'*********************************************************************************************
' Do Loop '
generateBar = Browser("...").FlexApplication("...").FlexBox("index:4").Exist
Do Until generateBar = False
generateBar = Browser("...").FlexApplication("...").FlexBox("index:4").Exist
If generateBar = False Then
Browser("...").FlexApplication("...").FlexPanel("External Data Report:").FlexButton("Close window.").Click
End If
Loop
'*********************************************************************************************
' Increment index number '***********
numNotes = 5
initialIndex=2
For Iterator = 0 To numNotes-1 Step 1
msgbox Iterator
initialIndex=initialIndex+12
msgbox initialindex
Next
resultIndex = ("index:"&initialIndex)
msgbox resultIndex
'*********************************************************************************************
' Programmatically parse and verify the text in PDF docs using clipborad to text '
string1 = "Hello World"
len_data = len(string1)
i=0
file_path = "C:\qtp\pdftotext.text"
Set clipboard = createobject("mercury.clipboard")
Set fso = createobject("scripting.filesystemobject")
Set notepad = fso.createtextfile(file_path,8)
'*********************************************************************************************
' Start recording click on Edit menu--select all, 'click on Edit menu--copy, click on pdf file to get deselect 'the text...'
Window("Adobe Reader").Activate
Window("Adobe Reader").WinMenu("Menu").Select "Edit;
Window("Adobe Reader").WinMenu("Menu").Select "Edit;
Window("Adobe Reader").Activate
get_text = clipboard.gettext
notepad.Write get_text
notepad.Close
Set notepad = fso.opentextfile(file_path,1)
Do while notepad.AtEndofStream <> true
get_data = notepad.readline
search_data = instr(get_data, "Hello World")
capture_data = mid(get_data,search_data,len_data)
If capture_data = string1 then
i = i+1
Else
End if
Loop
'msgBox ("the text is found in" &i &"rows")
'*********************************************************************************************
' Len function '
'Returns the number of characters in a string or the number of bytes required to store a variable.
Dim MyString
MyString = Len("VBSCRIPT") ' MyString contains 8.
' Increment using Do While statements '
increment = 0
counter =0
Do While increment = increment+1
counter = counter=1
Loop While False
'*********************************************************************************************
' Programmatically parse and verify the text in PDF docs using clipborad to text '
LocalParameter("filePath") = "C:\qtp\"
LocalParameter("fileType") = "parsePDF.xls"
LocalParameter("verifyText") = "Stephanie Cassady"
LocalParameter("pdfDoc") = "cover letter.pdf"
filePath = LocalParameter("filePath")
localPath = LocalParameter("filePath")&LocalParameter("fileType")
snapData = LocalParameter("verifyText")
Dim captureData
lenData = Len(snapData)
i=0
rowCounter=0
filePath = localPath
Set clipboard = createobject("mercury.clipboard")
Set fso = createobject("scripting.filesystemobject")
Set notepad = fso.createtextfile(filePath,8)
'*********************************************************************************************
' Open PDF file '
SystemUtil.Run "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe","",filePath,""
Window("Adobe Reader").WinMenu("Menu").Select "File;
Window("Adobe Reader").Dialog("Open").WinEdit("File name:").Set LocalParameter("filePath")
Window("Adobe Reader").Dialog("Open").WinEdit("File name:").Type micReturn
Window("Adobe Reader").Dialog("Open").WinListView("SysListView32").Activate LocalParameter("pdfDoc")
Window("Adobe Reader").Activate
Window("Adobe Reader").WinMenu("Menu").Select "Edit;
Window("Adobe Reader").WinMenu("Menu").Select "Edit;
Window("Adobe Reader").Close
getText = clipboard.gettext
notepad.Write getText
notepad.Close
Set notepad = fso.opentextfile(filePath, 1)
Do while notepad.AtEndofStream <> true
getData = notepad.readline
searchData = InStr(getData, snapData)
rowcounter = rowcounter+1
If searchData <>0 Then
captureData = Mid(getData,searchData,lenData)
End If
If captureData = string1 Then
i = i+1
'msgBox rowCounter
rowNumber = rowcounter
'msgBox rowNumber
Else
End if
Loop
If captureData Then
msgBox "The '"&captureData &"' text were found in the number " &searchData &" position on row "&rowNumber+1
Else
msgBox "The were no text found in this document that matches what you're looking for. Code: ID-10-T, S-U-E"
End If
'*********************************************************************************************
' Calculate index '
numNotes = Parameter("numNotes")
initialIndex = 7
For Iterator = 1 To numNotes-1 Step 1
initialIndex=initialIndex+13
Next
resultIndex = ("index:"&initialIndex)
buttonIndex = ("index:"&initialIndex+1)
shareIndex = ("index:"&initialIndex+5)
LocalParameter("shareNote") = resultIndex
LocalParameter("share") = shareIndex
'*********************************************************************************************
' Report Status '
Public Function assertTrue( bExpression, aOptions )
Set oOptions = GetOpts( ARRAY ( _
"sEvent", "AssertTrue", _
"sLogMessage", "Expected the given expression to return TRUE" _
), aOptions)
'Return true or false
assertTrue = reportStatus(bExpression, oOptions("sEvent"), _
oOptions("sLogMessage"))
End Function
If assertTrue(userMarcus.exists(NULL)) Then
userMarcus.edit(ARRAY("Role", "Agile SCRUM Master"))
End If
'*********************************************************************************************
' Ubound Arrays '
A = "1"
B = "2"
C = "3"
i = 1
basic100 = "Basic (100%)"
ParArray = Array(A, B,C)
n = Ubound (ParArray)
msgBox n
For i = 0 To n Step 1
msgBox ParArray(i)
msgBox ParArray(i) <> Empty
If ParArray(i) <> Empty Then
Reporter.ReportEvent micPass, "Verify whether the field is populated with data", " The "&basic100&" field is not empty."
msgBox i
Else
Reporter.ReportEvent micFail, "Verify whether the field is populated with data", " The "&basic100&" field is EMPTY."
msgBox i
End If
Next
'*********************************************************************************************
' Lbound Arrays '
A = "1"
B = "2"
C = "3"
i = 1
basic100 = "Basic (100%)"
ParArray = Array(A, B,C)',(a,b,c)
n = Ubound (ParArray)
msgBox n
For i = 0 To n Step 1
msgBox ParArray(i)
msgBox ParArray(i) <> Empty
If ParArray(i) <> Empty Then
Reporter.ReportEvent micPass, "Verify whether the field is populated with data", " The "&basic100&" field is not empty."
msgBox i
Else
Reporter.ReportEvent micFail, "Verify whether the field is populated with data", " The "&basic100&" field is EMPTY."
msgBox i
End If
Next
'*********************************************************************************************
' Calculate Variable Index '
lookIndex =15
result = 0
i =6
j =0
k =4
numRows = 6
For i = 6 To numRows*3 Step 3
k = k+2
j = i-k
If (i =lookIndex) Then
resultName = j
msgbox resultName
Exit for
End If
Next
'*********************************************************************************************
' Calculate Variable Index 2'
j=0
i=6
k=4
'Index number for that column within that row
resultColumnIndex=0
'Extracted value from the flex property
rowIndex=12
'Number of rows
max=3
'The index number of the last row. e.g. for 4 rows - the last index number would be 12
range=(max+1)*3
For i=6 to range Step 3
k=k+2
' msgbox "k="&k
j=i-k
'msgbox "j="&j
If i=lookIndex Then
resultColumnIndex=j
' msgbox j
Exit for
End If
Next
msgbox result
'*********************************************************************************************
' String Compare'
'Step 1: Fetch the Text from the Text Field.
strText = Browser(b).Page(P).Frame(f).WebEdit(T).getROProperty("value")
'Step 2: Fetch the Text from the Table
strTBL_text = Browser(B).Page(p).Frame(f).WebTable(w).GetCellData(1,1)
'Step 3: Comparision
If strComp(strText,strTBL_text) = 0 then
Reporter.ReportEvent micPass, "PASS","PASS"
Else
Reporter.ReportEvent micFail,"FAIL","FAIL"
End If
'*********************************************************************************************
' Create new and close excel'
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp=CreateObject("Excel.Application")
Set xlBook=xlApp.workbooks.add
Set xlSheet=xlBook.activesheet
xlSheet.cells(1,1)="helloo"
xlBook.saveas "c:test.xls"
xlApp.quit
'*********************************************************************************************
' Send Mail'
SendTo=".......@........com"
SendToCC=".......@........com"
Subject="QTP mail"
Body1="This mail is generated from QTP Environment"
Attachment="C:\Spec.xls"
Call SendMail(SendTo, Subject, Body1, Attachment)
Function SendMail(SendTo, Subject, Body, Attachment)
Set ol=CreateObject("Outlook.Application")
Set Mail=ol.CreateItem(0)
'ol.DisplayAlerts = False
Mail.to=SendTo
Mail.CC=SendToCC
Mail.Subject=Subject
Mail.Body=Body
If (Attachment <> "") Then
Mail.Attachments.Add(Attachment)
End If
Mail.Send
ol.Quit
Set Mail = Nothing
Set ol = Nothing
End Function
'*********************************************************************************************
' Send Mail'
Function AttachHTMLAsMailContent(sSendTo, sSendToCC,sSendToBCC,sSubject,sHtmlPath)
Dim objOutlook
Dim objOutlookMsg
Dim olMailItem
' Create the Outlook object and the new mail object.
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
' Define mail recipients
objOutlookMsg.To = sSendTo
objOutlookMsg.CC = sSendToCC
objOutlookMsg.BCC = sSendToBCC
' Body of the message
With objOutlookMsg
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(sHtmlPath,1)
strText = ts.ReadAll
.HTMLBody = strText
.Display
End With
' Send the message
objOutlookMsg.Send
wait(3)
' Release the objects
set objOutlook = nothing
set objOutlookMsg = nothing
End Function
'Sample usage
'AttachHTMLAsMailContent "MyName@abc.com","","","TestResults-MultipleAttachments","D:TestCase.html"
'*********************************************************************************************
' Calling an XML file'
Dim oXML
Set oXML = CreateObject(”Microsoft.XMLDOM”)
oXML.Load sPathToXML
Set oXML = Nothing
'*********************************************************************************************
' Creating an XML file'
Set objdoc=XMLUtil.CreateXML()
objdoc.loadFile = "C:\Test.xml"
set root = objdoc.GetRootElement()
set children = root.ChildElements()
set firstchild = children.item(1)
set secondchild = children.item(1).ChildElements()
For i = 1 to secondchild.count()
secondchild.item(i).ElementName()
Next
'*********************************************************************************************
' Upadate an XML file'
createdCompanyName = Environment.Value("createdCompanyName")
Select Case serviceSelect
Case "Appraisal"
'Appraisal XML
Const XMLDataFile = "Q:\Automation Framework\Quality Center\005 Library\Appraisal.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
'Update the name of the company
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[0]/Name")
node.Text = createdCompanyName
'Save changes
xmlDoc.Save(XMLDataFile)
'*********************************************************************************************
' Create an XML file'
serviceSelection = "Home Inspection - General" 'DataTable("serviceSelect", dtGlobalSheet)
' newCompanyName = Envrionment.Value("createdCompanyName")
newCompanyName = "ABC"
Const XMLDataFile = "Q:\Automation Framework\Quality Center\005 Library\Verticals.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
Select Case serviceSelection
Case "Appraisal"
'Update the name of the company
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[0]/Appraisal")
node.Text = newCompanyName
Case "Home Warranty"
'Update the name of the company
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[1]/Warranty")
node.Text = newCompanyName
Case "Home Inspection - General"
'Update the name of the company
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[2]/Inspection")
node.Text = newCompanyName
End Select
'Save changes
xmlDoc.Save(XMLDataFile)
End Function
'*********************************************************************************************
' Read an XML file'
Const XMLDataFile = "Q:\Automation Framework\Quality Center\005 Library\Verticals.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
serviceSelection = "Home Inspection - General" 'DataTable("serviceSelect", dtGlobalSheet)
Select Case serviceSelection
Case "Appraisal"
'Get the company name
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[0]/Appraisal/text()")
msgBox "Company Name: " & node.NodeValue
Case "Home Warranty"
'Get the company name
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[1]/Warranty/text()")
msgBox "Company Name: " & node.NodeValue
Case "Home Inspection - General"
'Get the company name
Set node = xmlDoc.SelectSingleNode("/Environment/Variable[2]/Inspection/text()")
msgBox "Company Name: " & node.NodeValue
End Select
'*********************************************************************************************
' Command line execution
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = False ' Make the QuickTest application visible
'*********************************************************************************************
' Run suite QA Deployment Sanity Test
qtApp.Open "C:\Temp\simple_test", True ' Open the test in read-only mode
' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ' Run the test
'Email Status
WScript.StdOut.Write "Status is:" & qtTest.LastRunResults.Status ' Check the results of the test run
' Close the test
qtTest.Close
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object
'*********************************************************************************************
'Call scripts and execute
'Load common functions from library
Execute getTextFileContent("\\server\path\libraryFileName","Unicode")
'Set initial test run option parameter
strRunCode = "intTestRunOptionId = 2" & vbLF
'Load QTP test code
strRunCode = strRunCode & _
getTextFileContent("\\server\path\yourQTPTestName\Action1\Script.mts","utf-8")
'Execute test
Execute strRunCode
'*********************************************************************************************
'Filter email messages in MS Outlook
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
Set colFilteredItems = colItems.Restrict("[Subject] = 'Project Proposal'")
For Each objMessage In colFilteredItems
objMessage.PrintOut
Next
'*********************************************************************************************
'Lock PC after QTP run
Set obj = CreateObject("WScript.Shell")
sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
obj.Run sCmnd, 0, False
'*********************************************************************************************
'File Compare
public function FileComparison(in File1, inFile2, out Result)
{
auto SaveFile = "Somefile in which the compared files are saved for future viewing."
Result = file_compare(File1, File2, SaveFile, 0);
return(Result);
}
'*********************************************************************************************
'Outlook API
sServer = "mse20be3,mse20.exchange.ms" '"your.server.address.here"
sMailbox = "Arnold Conchas" '"mailboxName"
' build the ProfileInfo string
sProfileInfo = sServer & vbLf & sMailbox
' create your session and log on
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "mse20/username", "password", False, True, 0, True, sProfileInfo
' create your Inbox object and get the messages collection
Set oInbox = oSession.Inbox
Set oMessageColl = oInbox.Messages
' get the first message in the collection
Set oMessage = oMessageColl.GetFirst
If oMessage Is Nothing Then
MsgBox "No messages found"
Else
' loop through inbox
Do
With oMessage
' message data:
Debug.Print .Subject & vbCrLf & .TimeReceived & vbCrLf & .Text
' this triggers the clever Outlook security dialog:
'Debug.Print .Sender(1) & vbCrLf & .Recipients(1)
Debug.Print
End With
Set oMessage = oMessageColl.GetNext
Loop Until oMessage Is Nothing
End If
'Logoff your session and cleanup
oSession.Logoff
Set oMessage = Nothing
Set oMessageColl = Nothing
Set oInbox = Nothing
Set oSession = Nothing
'*********************************************************************************************
'Outlook message extraction
Dim strBody ' Body
Const olFolderInbox = 6 ' Folder Constant in VBScript.
Dim objMail ' Mail Object.
Dim strFilter ' Filter For Messages
Dim strSubject 'What are we looking for?
strSubject = "Something" 'Change this to whatever subject fragment you want.
On Error Resume Next
' **** Create Instance of Outlook Application ********* '
Set objOutlook = CreateObject("Outlook.Application")
' **** Get NameSpace of Outlook Application ********* '
Set objNameSpace = objOutlook.GetNameSpace("MAPI")
' **** Get Inbox Folder of Outlook Application ********* '
Set objDefaultFolder = objNameSpace.GetDefaultFolder( olFolderInbox )
' **** Get Mail Messages in Folder **************** '
Set objMailItems = objDefaultFolder.Items
' ***** Filter Messages by Unread Flag And Sort Then in Descending Order ********** '
strFilter = "[UnRead] = True"
Set objResMailItems = objMailItems.Restrict( strFilter )
objResMailItems.Sort "[UnRead]",True
' ***** Loop on Unread Items ************** '
For Each objMail In objResMailItems
' ******* Search a mail with the given Subject ************ '
If InStr(objMail.Subject,strSubject) > 0 Then
strBody = objMail.Body
objMail.UnRead = False 'Marke message as unread
Exit For
End If
Next
Msgbox strBody
'*********************************************************************************************
'Send Keys
Set WshShell = CreateObject("WScript.Shell")
Browser("Browser").Page("Dashboard").WebEdit("WebEdit").Set "7208"
WshShell.SendKeys "{ENTER}"
Set WshShell = Nothing
'Send Key Codes
Key ----- Argument
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Key ------ Special Character
SHIFT +
CTRL ^
ALT %
'*********************************************************************************************
'Search email web based client
Browser("micClass:=Browser").Page("micClass:=Page").Frame("html id:=canvas_frame").WebElement("innerText:=info@emailiwant.com","html tag:=SPAN","index:=0").Click
'*********************************************************************************************
'Open link from email
Define the collection
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Wait (0.5)
Set Links = Browser("micClass:=Browser").Page("micClass:=Page").ChildObjects(oDesc)
NumberOfLinks = Links.Count()
nLoopCount = 0
Do Until svType > 0 or nLoopCount = NumberOfLinks
nLoopCount = nLoopcount + 1
svOuterHTML = Links(nLoopCount).GetROProperty("outerHTML")
svType = InStr(svOuterHTML, "http://mydomain/")
Loop
Links(nLoopCount).Click
'*********************************************************************************************
'Query DB by using and caliing stored procedure
Set objDB = CreateObject("ADODB.Connection")
strDSN = "DRIVER=SQL Server; DATABASE=[databasename];APP=QuickTest Professional;SERVER=[servername];Description=Testconnection"
objDB.Open(strDSN)
Set objRec = objDB.Execute("exec [spname] '[param1]','[param2'")
Do Until objRec.EOF
Msgbox objRec.Fields("[column]")
objRec.MoveNext
Loop
Set objRec = Nothing
Set objDB = Nothing
'*********************************************************************************************
Set cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cnn.ConnectionString ="CONNECTION STRING"
cnn.open
query = "QUERY HERE"
rs.open query,cnn
rs.movefirst
msgbox rs(0)
msgbox rs(1)
'*********************************************************************************************
'Get last date of the month
MsgBox DateSerial(Year(Now), 1 + Month(Now), 0)
'*********************************************************************************************
sub LastDateOfCurMonth()
dim lstDateCurMonth, fstDateCurMonth, fstDateNxtMonth
fstDateCurMonth="01/" & Month(date) & "/" & Year(Date)
fstDateNxtMonth=DateAdd("m",1,fstDateCurMonth)
lstDateCurMonth=DateAdd("d",-1,fstDateNxtMonth)
wscript.echo "Last Date of Current Month is: " & lstDateCurMonth
End Sub
call LastDateOfCurMonth
'*********************************************************************************************
accruedPeriod = 16
eomonth = DateSerial(Year(Now), 2 + Month(Now), 0)
dateNow = Date + accruedPeriod
numDay = -DateDiff("d",eomonth, dateNow)
msgBox numDay
'Mousemove on flex
On Sun, Aug 9, 2009 at 11:29 PM, Arnold Conchas
'ManualStep "Step 1", "Type text in the note, then click the Share button on the New Note ", "A Share Note message pop up displays with the following: · 'Are you sure you want to share the selected note with the agent?' · Yes button · No button"
'ManualStep "Step 2", "Select 'Send e-mail to agent', then click the Yes button", "The pop-up closes and a notification displays in the What's New area"
'Share Note
numNotes = Parameter("numNotes")
initialIndex = 7
For Iterator = 1 To numNotes-1 Step 1
initialIndex=initialIndex+13
Next
resultIndex = ("index:"&initialIndex)
buttonIndex = ("index:"&initialIndex+1)
shareIndex = ("index:"&initialIndex+5)
LocalParameter("shareNote") = resultIndex
LocalParameter("share") = shareIndex
actualNumNotes = Browser("Underwriter").FlexApplication("Underwriter_2").FlexCanvas("mainScreen").FlexBox("insuredName").FlexPanel("Notes").FlexBox("notesContainer").getROproperty("numchildren")
If actualNumNotes => numNotes Then
Browser("Underwriter").FlexApplication("Underwriter_2").FlexCanvas("mainScreen").FlexBox("insuredName").FlexPanel("Notes").FlexBox("shareNote").MouseMove
Browser("Underwriter").FlexApplication("Underwriter_2").FlexCanvas("mainScreen").FlexBox("insuredName").FlexPanel("Notes").FlexButton("Share").Click
If Parameter("shareProducer") = "Yes" Then
producerStatus = Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexCheckBox("Producer").GetROProperty("selected")
If producerStatus = False Then
Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexCheckBox("Producer").Click
End If
Else
producerStatus = Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexCheckBox("Producer").GetROProperty("selected")
If producerStatus = True Then
Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexCheckBox("Producer").Click
End If
End If
Select Case Parameter("shareConfirm")
Case "Yes"
Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexButton("Yes").Click
Case "No"
Browser("Underwriter").FlexApplication("Underwriter_2").FlexPanel("Share Note").FlexButton("No").Click
End Select
Browser("Underwriter").FlexApplication("Underwriter_2").FlexCanvas("mainScreen").FlexBox("insuredName").FlexPanel("Notes").FlexBox("shareNote").MouseMove
Browser("Underwriter").FlexApplication("Underwriter_2").FlexCanvas("mainScreen").FlexBox("insuredName").FlexPanel("Notes").FlexBox("notesContainer").Click
End If
'*********************************************************************************************
Set olapp = createobject("outlook.application")
set inbox = olapp.getnamespace("mapi").folders
for each fold in inbox
msgbox fold.name
getsubfolders(fold)
next
msgbox inbox.count
sub getunreadmails(objfolder)
set col = objfolder.items
for each mail in col
if mail.unread then
msgbox mail.subject
msgbox mail.sendername
msgbox mail.body
msgbox mail.senton
mail.unread=false
end if
next
end sub
sub getsubfolders(objparentfolder)
set colfolders = objparentfolder.folders
for each objfolder in colfolders
set objsubfolder = objparentfolder.folders(objfolder.name)
if objfolder.name<>"notes" then
getunreadmails(objfolder)
end if
getsubfolders objsubfolder
next
end sub
'*********************************************************************************************
olFolderInbox = 6
varSubject = "Info from Closing.com" 'The subject of your mail
Set objOutlook = CreateObject("outlook.application")
Set objNameSpace = objOutlook.GetNameSpace("MAPI")
Set Inbox = objNameSpace.GetDefaultFolder(olFolderInbox)
Set Mail = Inbox.Items.Restrict("[Subject] = " & Chr(34) & varSubject & Chr(34) )
'The above line is used to filter mails by subject similarly u can use "From" in place of subject.
if sail.Count = 1 then
Msgbox "Mail Found"
Else
Msgbox "Mail Not present or there are More than one mail with same subject"
End if
'*********************************************************************************************
'Set Regular Expresssion
Set re = New regExp
re.Pattern = "Select ""Browse"" to find your picture"
Environment.Value("expectedValue") = re.Pattern
Environment.Value("checkVar") = "Select “Browse“ to find your picture"
Call checkpoint()
'*********************************************************************************************
'Create clipboard object
Set clipboard = createobject("mercury.clipboard")
'Get html file
filepath = "Q:\Automation Repository\widget.html"
for_reading = 1
for_appending = 8
'Create file system object
Set fso = createobject("scripting.filesystemobject")
'Create file
Set notepad = fso.createtextfile(filepath,for_appending)
'Write clipboard data
widget = clipboard.gettext
notepad.write vbCR
notepad.write widget
notepad.write vbCR
'Close file
notepad.close
'Preview in Browser
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","C:\Documents and Settings\","open"
Browser("Download Widget").Navigate "Q:\Automation Repository\widget.html"
' Set notepad = fso.opentextfile(filepath,for_reading)
' reading=notepad.readall
' msgbox reading