SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    TE function for finding last opened window

    Hi all,

    I'm trying to write a function that will return the last putty window that I have opened. I thought that this would be easy, but I cannot seem to get QTP to recognize the window!

    Here is my current function:

    Public Function GetLastPutty ()

    Set putty_obj = Description.Create
    putty_obj("micclass").value = "TeWindow"
    last_putty = Desktop.ChildObjects(putty_obj).Count
    putty_obj("index").value = last_putty

    Set GetLastPutty = TeWindow(putty_obj)

    End Function

    "last_putty" will always return 0.

  2. #2
    Member
    Join Date
    May 2004
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    First try highlighting the TeWindow to know if the below code is working (with one TeWindow).

    Set putty_obj = Description.Create
    putty_obj("micclass").value = "TeWindow"

    TeWindow(putty_obj).highlight

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    Put more properties and see if it helps. Like regexpwndclass.

  4. #4
    Junior Member
    Join Date
    Sep 2009
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    Could it be because TeWindow objects do not support run-time object properties (this is what object spy is telling me)?

  5. #5
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    Those are native properties and shouldn't be confused with run-time properties

  6. #6
    Junior Member
    Join Date
    Sep 2009
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    I'm just curious as to why I cannot identify any objects using "TeWindow" as the object's class. Could it be that my terminal emulator plugin is not configured or installed properly? I can detect the window just fine using the object spy, but I cannot record (by using the record function of QTP) keystrokes. The only thing I was able to do was highlight the window using:

    putty_obj("emulator status").value = "Unavailable"

    Although, I feel that this is NOT a good property to run this test with.

  7. #7
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    If TeWindow is not recognized as TeWindow then it's definitely add-in configuration issue. what type of TeWindow is that?

  8. #8
    Junior Member
    Join Date
    Sep 2009
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    The weird thing is that the object spy will detect the putty window as a TeWindow, but the only way I can use it is if I use the "emulator status" property.

  9. #9
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    What happens when you add it to OR?

  10. #10
    Junior Member
    Join Date
    Sep 2009
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TE function for finding last opened window

    I am able to successfully add the TeWindow and TeTextScreen to the OR, but am unable to send keystrokes to that window. I am also unable to add more than one TeWindow to the object repository. This is such bizarre behavior. For the moment, I am trying to send keystrokes by making putty_obj a "Window" object. Now, I'm having a hard time using the index property. Here is my code:

    Public Function GetLastPutty ()

    Set putty_obj = Description.Create
    putty_obj("micclass").value = "Window"
    putty_obj("regexpwndtitle").value = "PuTTY"
    f = Desktop.ChildObjects(putty_obj).Count
    putty_obj("index").value = f - 1

    Set GetLastPutty = Window(putty_obj)
    End Function

    Oddly enough, this always sends keystrokes to the second terminal i have opened (i currently have 8 windows open).

 

 

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 05:46 AM.

Copyright BetaSoft Inc.