Micro Focus QTP (UFT) Forums
regular expression on Window object - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: regular expression on Window object (/Thread-regular-expression-on-Window-object)



regular expression on Window object - qupi - 11-16-2012

QTP 11.
Window 7 64Bit.
I have an object which has text is "User Promoted Notification Area" (this is system tray area)
I tried to regular express the object with their text because of that object will be different on WinXP (e.g: Notification Area)

What I tried:
?Notification Area
.*Notification Area
+Notification Area
$Notification Are
Notification Are$

But the object can not be found. (even on Object Repository Identified or Runtime)

Please help!!


RE: regular expression on Window object - ssvali - 11-16-2012

Try as

*Notification Area


RE: regular expression on Window object - qupi - 11-16-2012

I tried but it does not work too.

I tried this case:
.*Notification Area
--> Now error is it is not unique then I have to defined "Ordinal Identifier" = "Index, 0)

Problem now,
Unexpected error when: Window("Window").WinToolbar("Notification Area").GetItemsCount


RE: regular expression on Window object - Ankesh - 11-16-2012

post your complete code. Let us also know what are you trying to achieve.


RE: regular expression on Window object - qupi - 11-19-2012

@Ankesh,

It is simply,
1. I wanna get the list of running program icon on SystemTray.
2. Get the position.
3. Click on it.

NOTE: The problem only happens on Win7 (my current working station is 64Bit)

Here is my sorted code:
Code:
nItems = Window(objWindow).WinToolbar(Notification Area).GetItemsCount
    
    For nItem = 1 To nItems
        'Get Name
        sItemName = Window(objWindow).WinToolbar(Notification Area).GetItem(nItem)
        If  sItemName = strAppName Then ' if the name is required Application
            x = Window(objWindow).WinToolbar(Notification Area).GetROProperty("abs_x")
            y = Window(objWindow).WinToolbar(Notification Area).GetROProperty("abs_y")    
            objWidth = Window(objWindow).WinToolbar(Notification Area).GetROProperty("width")
            ApproxIconWidth = objWidth / nItems              ''  ApproxIconWidth = TotalWidth / Total items count
            objX =(ApproxIconWidth *  nItem - 1)       ''Formula used -  ApproxIconWidth *  ItemNumber - Gutter (i.e. space between two icons - Let gutter = 1)
          Window(objWindow).WinToolbar(Notification Area).DblClick objX,2,micLeftBtn 'Double left click on icon                
        End If
    Next