Hi Mauro,
The script is more than four months old - it does not work with the current version of the sample.
The only observed way to work with Prof-UIS controls is to expose them by using the Text Recognition technology, so, before running the script, you need to add
Afx:400000:4803*,
ProfUIS-DockBar,
ProfUIS-ControlBar and
tooltips_class32 class names to the list of accepted windows as it is described in the
Text Recognition Technology Support help topic. Also, I've made some modifications to the script, try using it:
' Before executing the TextRecognitionSample routine, download the
' http://www.prof-uis.com/download/samples/win32/All_Prof-UIS_Samples.zip archive,
' unzip it and run the ProfStudio-m.exe sample application.
Sub TextRecognitionSample
Dim p, wMain, wMenu, strItem
Set p = Sys.Process("ProfStudio-m")
Set wMain = p.Window("Afx:400000:8*", "*")
wMain.Activate
Set wMenu = wMain.Window("ProfUIS-DockBar", "Text Editor").Window("ProfUIS-ControlBar", "Menu bar")
strItem = "File|New"
If ClickItem(wMenu, strItem) Then
Log.Message "The '" & strItem & "' menu item was successfully clicked."
End If
End Sub
Function ClickItem(wMenu, strItem)
Dim p, arrayItem, menuItemObj, wSubMenu
ClickItem = False
arrayItem = Split(strItem, "|")
If Not ClickChild(wMenu, "Text", arrayItem(0)) Then
Exit Function
End If
Set p = getProcess(wMenu)
Set wSubMenu = p.Window("Afx:400000:4803*")
If Not ClickChild(wSubMenu, "Text", arrayItem(1)) Then
Exit Function
End If
ClickItem = True
Log.UnlockEvents
Log.Event "The '" & strItem & "' menu item was clicked."
End Function
Function ClickChild(wMenu, strProp, arrayItem)
Dim menuItemObj
ClickChild = False
Log.LockEvents(1)
Set menuItemObj = wMenu.FindChild(strProp, "*" & arrayItem & "*")
If Not menuItemObj.Exists Then
Log.UnlockEvents
Log.Error "The '" & arrayItem & "' menu item was not found."
Exit Function
End If
menuItemObj.Click
ClickChild = True
End Function
Function getProcess(obj)
Do While Not IsSupported(obj, "ProcessName")
Set obj = obj.Parent
Loop
Set getProcess = obj
End Function