Jump to content
Sign in to follow this  
mjg

Closing application by executable or class

Recommended Posts

mjg

Hi,

I'm trying to make a script that will close an application (only knowing the executable and class) properly (by send 7 {esc} keys) but am unable to figure out how to do this.

Can anyone point me in the right direction? I tried using controlfocus but I'm unsure if that is the correct command to use in this scenario.

Thanks,

Share this post


Link to post
Share on other sites
evilertoaster

Do you know the name of the window (if any) it is using?

What about ProcessClose()?

If the window is already active and you just want to send esc 7 times use Send("{ESC 7}")

Share this post


Link to post
Share on other sites
mjg

Do you know the name of the window (if any) it is using?

What about ProcessClose()?

If the window is already active and you just want to send esc 7 times use Send("{ESC 7}")

No, I have no way of knowing what the title of the window. It is a network application and basically if user1 signs on the window will be called TMS_Workstation1 and if user2 signs on it will be called TMS_Workstation2. I don't believe I can use a wild card w/ winactivate can i?

The only issue with using process close is that the application has to be closed properly (with 7 esc keys). If it doesn't close properly, then our backups can not be performed.

I do know the class, and read somewhere that you could focus the window by just knowing the class, but was unsuccessful in my attempts.

-mjg

Share this post


Link to post
Share on other sites
PsaltyDS

Didn't test that before typing it, did'ya? :)

Look in the help file at WinTitleMatchMode:

WinTitleMatchMode

Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

The default match is String*.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
evilertoaster

I don't believe I can use a wild card w/ winactivate can i?

You can. Check out the WinTitleMatchMode option. Set it to 2

Share this post


Link to post
Share on other sites
mjg

Wow perfect, thank you very much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.