SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Waiting for Beyond Compare to load

    Hi all

    Sorry if this has been asked by someone before, but I am stuck!

    Beyond compare is used within TC as a file comparison tool. Some files load quickly, and the selection of File Differences Report to save the differences works ok. I have a problem though when it takes 10 seconds or so to load, as the script tries to save before loading completes.

    There are two possible ways I thought to check for loading - one is a button on the toolbar which is disabled once loading finishes, but the ObjectProperties cannot focus on the one button, only the whole section. The second way is a note in the screen footer bar saying Loaded in n seconds. Again, I can only grab the whole bar, and nowhere can I find the text to look for.

    I then found the help topic which recommends the following code to wait for loading:
    Sub Test
    i = 0
    Set p = Sys.Process("Notepad")
    Do
    Set w = p.WaitWindow("*", "Open", -1, 5000)
    i = i + 1
    Loop Until (w.Exists And w.VisibleOnScreen) Or (i > 10)

    If Not (w.Exists And w.VisibleOnScreen) Then
    Log.Warning "Window not found."
    Else
    Log.Message "Window was found."
    End If
    End Sub

    I can use this, but the problem is that checking for Beyond Compare to load doesn't help, as it will say that it is loaded. What I need to do is wait until the differences files are ready.

    Hopefully what I have typed makes some sense. Sorry if its long but its hard to explain! If anyone can fathom out what I need to do, it would save me literally hours of my day.

    Thanks

    Steve

  2. #2
    Senior Member
    Join Date
    Aug 2008
    Location
    Toledo, Ohio, United States
    Posts
    106
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Waiting for Beyond Compare to load

    If the app is in a not responding state (hourglass / donut cursor) you can check to see when the app responds to begin.

    <font class="small">Code:</font><hr /><pre>

    function WaitForResponse()
    {
    FolderBegin("Waiting for response");
    try
    {
    var elapsed = 0;
    var dotNetProcess = dotNET["System_Diagnostics"]["Process"]["GetProcessById"](Sys["Process"]("iss4")["ProcessID"]);
    while(!dotNetProcess["Responding"])
    {
    aqUtils["Delay"](1000, "Waiting for a response from ISSv4\nElapsed: " + ToStr(elapsed) + " sec");
    elapsed += 1;
    dotNetProcess = dotNET["System_Diagnostics"]["Process"]["GetProcessById"](Sys["Process"]("iss4")["ProcessID"]);
    }

    }
    catch(ex)
    {
    WriteErr("Waiting for response failed due to exception", ex["description"]);
    }
    FolderEnd();
    }

    </pre><hr />
    -------------
    Aaron T Foley
    Software Tester
    Solana
    -------------
    Mind Cemetary - Blog
    Twitter
    -------------

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Waiting for Beyond Compare to load

    Hi,

    When the file processing is completed, a message starting with "Load time" is displayed in the tool's status bar. You can make TestComplete wait until the message appears by using the following code:

    <font class="small">Code:</font><hr /><pre> // JScript

    //...
    var wStatusBar = Sys.Process("BC2").VCLObject("FileViewerForm").VCL Object("StatusBar");
    WaitForLoading(wStatusBar);
    //...

    function WaitForLoading(wStatusBar)
    {
    var str = "Load time";
    while (wStatusBar.wText(2).indexOf(str) &lt; 0)
    {
    Delay(500, "Waiting for Beyond Compare...");
    }
    }
    </pre><hr />
    Regards,
    Allen - SmartBear Support

  4. #4
    Senior Member
    Join Date
    Sep 2008
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Waiting for Beyond Compare to load

    Thats a great help, thanks.

    Would you be able to supply this in VB please?

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,049
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Waiting for Beyond Compare to load

    Hi,

    Here is the code in VBScript:

    <font class="small">Code:</font><hr /><pre> ' VBScript

    '...
    Set wStatusBar = Sys.Process("BC2").VCLObject("FileViewerForm").VCL Object("StatusBar")
    WaitForLoading(wStatusBar)
    '...

    Sub WaitForLoading(wStatusBar)
    Dim str
    str = "Load time"
    Do While InStr(wStatusBar.wText(2), str) = 0
    Call Delay(500, "Waiting for Beyond Compare...")
    Loop
    End Sub
    </pre><hr />
    Regards,
    Allen - SmartBear Support

  6. #6
    Senior Member
    Join Date
    Sep 2008
    Posts
    108
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Waiting for Beyond Compare to load

    Many thanks Allen

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:52 AM.

Copyright BetaSoft Inc.