Close window Irrespective of Screen Resolution

  • Hi, I wonder whether someone may be able to help me please.


    From the research I've carried out I've found many examples of creating a vb script using specific screen co-ordinates to find a specific point on a screen and click on this, in my case the close window button.


    But could someone tell me please is it possible to construct a script which finds the 'close' button and clicks on this each time even if the screen resolution changes and hence, the screen co-ordinates have changed.


    Any help would be gratefully received.


    Many thanks and kind regards


    Chris

  • Re: Close window Irrespective of Screen Resolution


    What are you trying to close? There are generally easier ways than what you describe.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Close window Irrespective of Screen Resolution


    Bog basic, simplest way to close a window



    Add to a module and call passing the FULL title of the window.

    Code
    CloseIt "Untitled - Notepad"


    It does a clean close, you will be prompted if the app prompts to save changed data on closing... but you never mentioned anything about that.

  • Re: Close window Irrespective of Screen Resolution


    Hi rory, thank you for taking the time to reply to my post.


    I'm looking to close the open window, which cytop has been bale to provide a solution for.


    Many thanks and kind regards


    Chris

  • Re: Close window Irrespective of Screen Resolution


    Hi cytop, thank you for taking the time to reply to my post and for putting the solution together which is exactly what I was after.


    Many thanks and kind regards


    Chris

  • Re: Close window Irrespective of Screen Resolution


    It is very basic, meant more as an example and is based on the information in your original post (Not a lot, I'm afraid).


    I'm sure you'll find its limitations at some point.

  • Re: Close window Irrespective of Screen Resolution


    Hi cytop, no this is fine, it will give me something to work with.


    Kind regards


    Chris

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!