Jump to content

A script to close a window with a specific title


Recommended Posts

Hi,

I need a script that would run in background and constantly block (close) programs or windows with a specified title.

so for example:

- i would tell it each time a program or window is opened that contains the word ; keyfinder, crack, ...etc it should close this windows and report to Administrator.

-actually i would like to make a blacklist for titles that are closed immediately

thanks for your suggestions.

Link to comment
Share on other sites

1. You can store blacklist to a file, where each line will contain one title

2. Get a list of windows using WinList()

3. Get number of lines in file

4. Read a line using FileReadLine()

5. Look for a title read by FileReadLine()in elemets of array returned by WinList()

Edited by ahmet
Link to comment
Share on other sites

ok. But do i need to specifie that this check process happens for each new window opened. I mean do i need to tell the script to repeat each time.

And how do i do this?

thanks

Link to comment
Share on other sites

thanks

Can i also tell the script to pause or wait until a new program/window opens, and then make(repeat) the title check?

In this way i would save CPU load i guess..?, and the script would repeat only when new window opens?

Link to comment
Share on other sites

You would have to keep repeating the 'check' to see if a new program is 'in the list' that wasn't from the previous check. Put a Sleep at the end of the 'check loop' to reduce CPU load. Sleep uses milliseconds, so 1000 is 1 second, which should be fine. Increase or decrease this value if needed.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...