Forum Discussion

sguda's avatar
sguda
Regular Contributor
14 years ago

How do i use cmpContains propery check in the script.


I want to check the caption of the report window opened contains "DisplaySSRSReport" by using cmp Contains property.



I am getting error in the statemnet
Set MyCellContent = MyCell.WndCaption saying needs object string("DisplaySSRSReport")



sub
SSRSReportTime


 Set StopWatchObj =



 



HISUtils.StopWatch

 dim MyCell 

 dim MyCellContent

 


 




 



 



 



 StopWatchObj.Start

 


 


 Set MyCell =



 




Aliases.AcroRd32.wndAcrobatSDIWindow

 Set MyCellContent = MyCell.WndCaption

 


 


 


 if MyCellContent cmpContains "DisplaySSRSReport" then 

    StopWatchObj.Stop 



 



    Log.Message(" SSRS Report appears for Galen School Of Nursing. Execution time: " &        StopWatchObj.ToString & ". Baseline Date: 06-29-2010, Baseline Execution time: 00:00:8.406")

 


 Else



 



    Log.Message("SSRS Report not Loaded.")

 end if

 



 




 



end



sub



Can anybody suggest how do i use it.


1 Reply


  • Hi Sri,





    I am getting error in the statemnet Set MyCellContent = MyCell.WndCaption saying needs object string("DisplaySSRSReport")


    This is expected - you assign a value to the MyCellContent variable incorrectly. In VBScript, the 'Set' statement is used to assign an object reference to a variable. You mustn't use this statement in your case, as 'MyCell.WndCaption' returns a string. See VBScript's reference for more information.





    Can anybody suggest how do i use it.


    I recommend that you use the 'Create Property Checkpoint' wizard to check the WndCaption property value of the needed object. See the 'Create Property Checkpoint Wizard' help topic for more information. After you follow the wizard's steps, TC will generate the appropriate code. It will look as follows:







    According to your script, I guess <obj> will be the 'Aliases.AcroRd32.wndAcrobatSDIWindow' object. Use the generated code in your SSRSReportTime routine so that it looks as follows:

    Sub SSRSReportTime

        Set StopWatchObj = HISUtils.StopWatch

        dim MyCell 

        StopWatchObj.Start 

        Set MyCell = Aliases.AcroRd32.wndAcrobatSDIWindow

        If (aqObject.CompareProperty(MyCell.WndCaption, cmpContains, "DisplaySSRSReport", False)) Then 

            StopWatchObj.Stop

            Log.Message(" SSRS Report appears for Galen School Of Nursing. Execution time: " &        StopWatchObj.ToString & ". Baseline Date: 06-29-2010, Baseline Execution time: 00:00:8.406") 

        Else

            Log.Message("SSRS Report not Loaded.")

        End If

    End Sub