I have "This = HTMLSpan("ID=taskHeading").InnerText" and all is find as long as it finds ("ID=taskHeading").InnerText. The problem is I want the script to run a piece of code of the correct window is not displayed and this is my code.
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">This = HTMLSpan("ID=taskHeading".InnerText
If This = "Task: Collateral Add " Then
If HTMLAnchor("Caption='Data Entry'".Object = False Then
End If</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">This should say if the page is loaded then check if the tab 'data entry' has focus else run a script that loads and clicks on the right stuff.
"I want the script to run a piece of code of the correct window is not displayed"
I'm a bit confused with the heading of your post..
If you want to check for whether a screen is not present then do something accordingly, you have to use the tpAttachNoWait flag. This suppresses the exception handling and the object receiving the result of the construction function can be validated using the Exists property.
Using ".Object" looks wrong to me as it exposes you to the native methods and properties of the object you are interacting with.
Instead, use the .Exist property
If HTMLAnchor("Caption='Data Entry",tpAttachNoWait).Exists <> True THEN...
If you always do what you've always done, you will always get what you've always got!
Thanks Flagmann, about the tpAttachNoWait, but the object (tab) is found on the screen but is not the one that is clicked. The tool sees the object and then passes but the correct screen is not the one being displayed. I don't want to click on the tab if I don't have to.
I'm going to see if I can use an object (text box) on the page that should be loaded and check for that.