| || |
Editbox that may or may not be there
I want to extract text from various editboxes on a form/window. Sometimes the form that I attach to has one editbox that meets the criteria and sometimes there are more. (I am trying to extract email accounts from my PALM desktop software.)
What logic can I use to test for the existence of the second editbox. I tried the following to extract text from the Second editbox if that editbox existed:
If EditBox("Label = E-Mail: Index = 2").Exists Then 'if there is a second email editbox
strTempEmailAddress2 = EditBox("Label = 'E-Mail:' Index=2").Text
However, upon playback TP displays a message “Failed to Attach” to the editbox referenced in the IF statement.
What am I doing wrong?
I also tried to do this with the ATTACH method, i.e.
if Editbox.Attach = True Then...
strVariable = Editbox.Text
I got the same result.
Re: Editbox that may or may not be there
You have to use the tpAttachNoWait parameter:
If EditBox("Label = E-Mail: Index = 2", tpAttachNoWait).Exists