Results 1 to 4 of 4
  1. #1
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    VB Script - Activate Window

    I
    You know it's time to diet when you push away from the table and the table moves.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VB Script - Activate Window

    GetObject is fairly limited. At best, you might be able to identify the container application for the mainframe program (e.g., the term emulation program). But I believe it would have to be registered as a COM Object in the Registry in order to be accessed that way. The Windows API, of course, lets you examine all the open windows, but I'm not sure there is a way to use that from VBScript. It's really a glorified batch language and not a general purpose programming language...

  3. #3
    3 Star Lounger Omega3's Avatar
    Join Date
    Jan 2004
    Location
    Los Angeles, California, USA
    Posts
    343
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: VB Script - Activate Window

    Thank you for the feedback. I was hoping this was not the case.

    As a long shot, if it is registered as a Com object, how would I go about finding it and using it in the Getobject method?
    You know it's time to diet when you push away from the table and the table moves.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VB Script - Activate Window

    Attached is an example using the Word.Application COM object. (To run this, drop the .txt and change the _ to a .) If Word is not open, it should throw an error, but I haven't bothered to handle that for this script. (That's another can of worms...) If Word is open, it should activate the first instance of Word it finds. (How it chooses, I'm not sure.) Hope this helps.
    Attached Files Attached Files

Posting Permissions

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