AutomatedQA: Award-winning tools for software development and quality assurance

Home  »  Support  »  Message Boards

AutomatedQA Message Boards

Newsgroups become obsolete, our new Forums are available here.

Board:automatedqa.public.testcomplete
Subject:Re: Unable to read caption of a form
Date:Fri, 18 Dec 2009 09:52:17 -0800
From:AutomatedQA Support
From:AutomatedQA Support <support@automatedqa.com>
Hi Michael,

<<
  Log["Message"](w["WndCaption"] == "*t*"); //Log 3 
>>
When you use the "*t*" string in the line above, it means that you want to compare the string
with the caption whose value should be "*t*". I suppose that you want to determine whether
the 't' character belongs to the caption. In this case, you need to use the indexOf method.
Here's an example:

if (w["WndCaption"].indexOf("t") > 0)
    Log["Message"]("TRUE");

Please read the following MSDN article for more information:
http://msdn.microsoft.com/en-us/library/53xtt423(VS.85).aspx

--
Best regards,
Jared - AQA Support
~~~~~~~~~~~~~~~~~~~~~

Michael St.Peter wrote:
> Jared,
> 
> Well, I changed the one item in my code from ["Caption"] to ["WndCaption"]
> and I can get the caption that I am looking for, however, my compare does
> not work.  I'm using a small function right now.
> function Test2()
> {
>   var w = P3PlusProcess["Form"]("Ponemah Physiology Platform*")["Panel"]("Workspace")["WaitMDIWindow"]("DRa*",
> 3000);
>   if (w.Exists)
>     Log["Message"](w["WndCaption"]); //Log 1
>   else
>     Log["Message"]("The object doesn't exist"); //Log 2
>   
>   Log["Message"](w["WndCaption"] == "*t*"); //Log 3  
>   Log["Message"](w["WndCaption"] == "DRa  1% complete");//Log 4  
>     
>   x = P3PlusProcess["Form"]("Ponemah Physiology Platform *")["Panel"]("Workspace")["MDIWindow"]("DRa*")["WndCaption"];
>   Log["Message"](x); //Log 5
> }
> 
> The caption of the window is changing about once a minute, maybe less.  What
> doesn't make sense is that Log 3 will come up as 'False' while Log 4 comes
> up as 'True' when the dialog is at 1%.  Of course, when it is no longer 1%,
> Log 4 changes to False.  I just don't understand what I am doing wrong where
> Log 3 is reporting False.  Also note that Log 1 and 5 come up with the same
> information.
> 
> Mike
> 
> "AutomatedQA Support" <support@automatedqa.com> wrote:
>> Hi Michael,
>>
>>> 1.) Does the changing of the title of the form affect TC where a refresh
> 
>>> is recommended?
>> You can try using the WaitMDIWindow method, which will refresh the object
> 
>> tree before obtaining an object, together with the Exists property. Here's
> 
>> an example:
>>
>> var w = Sys["Process"]("PPP3")["Form"]("Ponemah Physiology 
>> Platform*")["Panel"]("Workspace")["WaitMDIWindow"]("DRa*", 3000);
>>  if (w.Exists)
>>    Log["Message"](w["Caption"]);
>>  else
>>    Log["Message"]("The object doesn't exist");
>>
>> Does this work for you? If you still get the error message, tell me how
> 
>> often the caption of the window changes. Also, post here the entire function
> 
>> in which you obtain the window.
>>
>> As for the second question, the problem cannot occur because there's the
> '%' 
>> character in the caption.
>>
>> -- 
>> Best regards,
>> Jared - AQA Support
>> ~~~~~~~~~~~~~~~~~~~~~
>>
>> "Michael St.Peter" <mstpeter@datasci.com> wrote in message 
>> news:4b211c94$1@news.automatedqa.com...
>>> David,
>>>
>>> I can try, but the files required to create the issue of having the title
>>> of the forms are several gigabytes.  Before sending I do have a couple
> of
>>> questions.
>>> 1.) Does the changing of the title of the form affect TC where a refresh
>>> is recommended?
>>> 2.) One of the characters in the title is '%'.  Could my coding (or 
>>> something
>>> in TC) not like this character?
>>>
>>> Thanks,
>>>
>>> Mike
>>>
>>> AutomatedQA Support <support@automatedqa.com> wrote:
>>>> Hi Michael,
>>>>
>>>> We were unable to reproduce the problem here. Could you zip your entire
>>> project suite
>>>> folder along with logs and send us the archive via our Contact Support
> 
>>>> Form
>>> (http://www.automatedqa.com/support/message/)?
>>>> --
>>>> Best regards,
>>>> David - AQA Support
>>>> ~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>> Michael St.Peter wrote:
>>>>> Using the object browser, I am viewing the form with the full name:
>>>>> Sys["Process"]("PPP3")["Form"]("Ponemah Physiology Platform  - 
>>>>> TEST_750-490sp2.RVW
>>>>> (User: St.Peter)")["Panel"]("Workspace")["MDIWindow"]("DRa  14% 
>>>>> complete")
>>>>> In my script I use the following name:
>>>>> P3PlusProcess["Form"]("Ponemah Physiology Platform 
>>>>> *")["Panel"]("Workspace")["MDIWindow"]("DRa*")["Caption"]
>>>>> However, the script cannot see the object because 'Object Expected'
> is
>>> typically
>>>>> returned.  The first two modifications that I made, for other objects,
>>> I
>>>>> have not had any problems.  The last mod, changing "DRa  14% complete"
>>> to
>>>>> "DRa*" seems to be where my issue lies.  The caption for the form 
>>>>> changes
>>>>> until it reaches 100% and then it goes to "DRa".  Why can I not get
> the
>>> caption
>>>>> with my modified code?
> 



Copyright © 1999-2008, AutomatedQA, Corp. All Rights Reserved.
Legal | About | Contact