• VB Script – Activate Window

    Author
    Topic
    #406744

    I

    Viewing 1 reply thread
    Author
    Replies
    • #845688

      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…

      • #846488

        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?

        • #846841

          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.

        • #846842

          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.

      • #846489

        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?

    • #845689

      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…

    Viewing 1 reply thread
    Reply To: VB Script – Activate Window

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: