SPONSORS:






User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Boolean search?

  1. #1
    BMD
    BMD is offline
    Advanced Member
    Join Date
    Mar 2002
    Location
    Earth, USA, New York, Western
    Posts
    759
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Boolean search?

    This is to cut the text from the properties page and then look though it for the words Delivered or Transferred. It cut and checks the text but on the verify page on the left is the two words and on the right is the text, even if the word is there the test does not find it? What I'm I doing wrong?

    [-] testcase Properties ()
    [ ] GroupWise.TreeView1.Select ("/BRUCE D*****/Mailbox")
    [ ] GroupWise.TreeView1.Select ("/BRUCE D*****/Sent Items")
    [ ] Sleep (0.3)
    [ ] GW.ListView1.PopupSelect (50, 100, "Properties") //The (50, 100, "Properties") picks the third item in the list.
    [ ] Properties.SetActive ()
    [ ]
    [ ] Properties.OWL_Window1.SCCVIEWER1.SCCDISPLAY1.Type Keys ("<Ctrl-Home>")
    [ ] Properties.OWL_Window1.SCCVIEWER1.SCCDISPLAY1.Type Keys ("<Ctrl-Shift-End>")
    [ ] Properties.OWL_Window1.SCCVIEWER1.SCCDISPLAY1.Type Keys ("<Ctrl-c>")
    [ ] Properties.Close ()
    [ ] GroupWise.TreeView1.Select ("/BRUCE D*****/Mailbox")
    [ ] LIST OF STRING lsExpected = {"Delivered","Transferred "}
    [ ] LIST OF STRING lsText = Clipboard.GetText ()
    [ ] STRING sExpected, sClip
    [ ] BOOLEAN bFound = FALSE
    [-] for each sExpected in lsExpected
    [-] for each sClip in lsText
    [ ] bFound = MatchStr (sExpected, sClip)
    [ ] break
    [ ] break
    [ ] Verify (lsText,lsExpected)

    Thanks for all your help.
    Bruce.


    ------------------
    There but by the grace of God go I.

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    I'm not completely clear on what it is that is happening with your results, but you might consider using StrPos to look for your expected string. iPos = StrPos(sClip, sExpected)

    Then if iPos is greater than 0, you know you found your target text.

    ------------------

  3. #3
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    Unless the words "Delivered" and "Transferred " (do you want that trailing space?) exist in a line of lsText by themselves, MatchStr() will not find them.

    If they can appear somewhere inside the text on a line, then change them to *Delivered*" and "*Transferred*" to ignore leading and trailing text.


    John


    ------------------

  4. #4
    BMD
    BMD is offline
    Advanced Member
    Join Date
    Mar 2002
    Location
    Earth, USA, New York, Western
    Posts
    759
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    [ ] LIST OF STRING lsExpected = {"Delivered","Transferred "}
    [ ] LIST OF STRING lsText = Clipboard.GetText ()
    [ ] STRING sExpected, sClip
    [ ] BOOLEAN bFound = FALSE
    [-] for each sExpected in lsExpected
    [-] for each sClip in lsText
    [ ] bFound = MatchStr (sExpected, sClip)
    [ ] break
    [ ] break
    [ ] Verify (lsText,lsExpected)

    Does not work and I tryed both bFound = MatchStr (lsExpected, lstext) and iPos = StrPos (lsExpected, lstext). Both return that they need a string and can't check a list of string and I can't convert the variables. Can you tell I'm getting mad

    the H key is now stuck to me forehead. ouch

    ------------------
    There but by the grace of God go I.

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    Originally posted by BMD:

    I tryed both bFound = MatchStr (lsExpected, lstext) and iPos = StrPos (lsExpected, lstext). Both return that they need a string and can't check a list of string and I can't convert the variables.
    <HR></BLOCKQUOTE>


    That's not surprising because MatchStr() takes two strings as arguments, not a list of string such as 'lsExpected' or 'lstest'.
    You should really try the wildcard solution mentioned earlier:
    lsExpected = {"*Delivered*","*Transferred*"}

    Also resubmit you code surrounded by tags:
    &#091;CODE&#093;

    YOUR STUFF

    &#091;/CODE&#093;

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>

    Originally posted by BMD:
    Can you tell I'm getting mad

    <HR></BLOCKQUOTE>
    Yes

    ------------------


    [This message has been edited by johntest (edited 09-18-2002).]
    Tempus fugit, Carpe Diem, et al

  6. #6
    BMD
    BMD is offline
    Advanced Member
    Join Date
    Mar 2002
    Location
    Earth, USA, New York, Western
    Posts
    759
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    [CODE / WORKING SYNTAX JUST NOT PASSING OR FAILING THE TEST?]

    [ ] LIST OF STRING lsExpected = {"*Delivered*","*Transferred*"}
    [ ] LIST OF STRING lsText = Clipboard.GetText ()
    [ ] print (lsText)
    [ ] print (lsExpected)
    [ ] Verify (lsText, lsExpected)
    [CODE END]

    The verify screen has the two lines in the expected side *Delivered* and *Transferred*. On the actual side is the clipboard text, even if either word is in the LIST OF STRING, it still failes? The code works it just does not do anything useful.

    Thanks for all the help.
    Bruce.

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by BMD:

    The verify screen has the two lines in the expected side *Delivered* and *Transferred*. On the actual side is the clipboard text, even if either word is in the LIST OF STRING, it still failes? The code works it just does not do anything useful.
    <HR></BLOCKQUOTE>

    Try this:

    Please Note:
    Verify (lsText, lsExpected)
    will simply compare these two lists.
    If lsText = {"My", "letter", "has", "not", "been", "Delivered"}
    the the difference viewer will be displayed because it is a completely different list to
    {"Delivered", "Transferred"}

    ------------------
    Tempus fugit, Carpe Diem, et al

  8. #8
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    Bruce,

    There appears to be several points of confusion.

    1. The first you've fixed with the inclusion of asterisks in the lsExpected entries. MatchStr will now work.

    2. The second involves the logic in the test inner loop. You're setting the boolean value from the result of the MatchStr but you don't follow it up with a test to break out of the loop. As coded, it'll just fall out on the first iteration.

    3. And finally, "Verify (lsText,lsExpected)" will never pass unless the Clipboard text is an exact match to lsExpected. And that likely isn't very useful.

    Copy the following code block into a new test script window and run it. Then populate the Clipboard with your actual text strings using a manual Copy operation, and run it again. Note: Click on the square-dotted box in the results file to see a comparison window.



    Hope this helps.

    John


    ------------------


    [This message has been edited by John J. Miller (edited 09-18-2002).]

  9. #9
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by John J. Miller:
    Bruce,


    <HR></BLOCKQUOTE>
    I think this code needs another break statement for the outer loop. If it matched on the first word, but not the second, then bFound would be set back to false, and the program would erroneously print:
    'ERROR - Did not find a match!'


    ------------------
    Tempus fugit, Carpe Diem, et al

  10. #10
    BMD
    BMD is offline
    Advanced Member
    Join Date
    Mar 2002
    Location
    Earth, USA, New York, Western
    Posts
    759
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Boolean search?

    I always get not found? I put in the second break in but it always passes and always is not found?

    [CODE]
    [-] LIST OF STRING lsExpected = {...}
    [ ] "*Delivered*"
    [ ] "*Transferred*"
    [ ] LIST OF STRING lsText = Clipboard.GetText ()
    [ ] BOOLEAN bFound
    [ ] STRING sClip, sExpected
    [-] for each sExpected in lsExpected
    [-] for each sClip in lsText
    [ ] bFound = MatchStr (sExpected, sClip)
    [ ] if (bFound == TRUE) // leave if a match is found
    [ ] break
    [ ] break
    [-] if (bFound == FALSE)
    [ ] LogError ("ERROR - Did not find a match!")
    [-] else
    [ ] Print ("Found a Match!")
    [ ] Verify (lsText, lsExpected)
    [ ] Print (lsText)
    [ ] Print (lsExpected)
    [ ] Print (sExpected)
    [ ] Print (sClip)
    [CODE \ ]

    ------------------
    There but by the grace of God go I.

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 09:22 PM.

Copyright BetaSoft Inc.