Killer Posted November 25, 2004 Posted November 25, 2004 I am trying to make a program to block certain elements from opening and running. I will have to match the names of these elements. However I observed WinTitleMatchMode is case sensitive. If I specify Notepad to block, I can't block those with titles like NOTEPAD, NotePad, notepad. Anyway to overcome this?
stingjoel Posted November 25, 2004 Posted November 25, 2004 (edited) Change it into upper case or lower case, then check it... If StringUpper(WinGetTitle("")) = "NOTEPAD" Then MsgBox(0, "", "Notepad Window") EndIf or If StringLower(WinGetTitle("")) = "notepad" Then MsgBox(0, "", "Notepad Window") EndIf Edited November 25, 2004 by stingjoel
Killer Posted November 25, 2004 Author Posted November 25, 2004 Change it into upper case or lower case, then check it...If StringUpper(WinGetTitle("")) = "NOTEPAD" Then MsgBox(0, "", "Notepad Window") EndIforIf StringLower(WinGetTitle("")) = "notepad" Then MsgBox(0, "", "Notepad Window") EndIf<{POST_SNAPBACK}>But winclose only goes for the exact name on the window, not the converted name.
stingjoel Posted November 25, 2004 Posted November 25, 2004 Try this... $WinTitle = WinGetTitle("") If StringUpper($WinTitle) = "NOTEPAD" Then MsgBox(0, "", "Notepad window..." & @CRLF & "Click OK to close it!") WinClose($WinTitle, "") EndIf
this-is-me Posted November 25, 2004 Posted November 25, 2004 That only works on the currently active window. There is also a winlist function in the unstable that would show all the windows, and you can do a loop to see if one has notepad in the title. Who else would I be?
Killer Posted November 25, 2004 Author Posted November 25, 2004 Try this...$WinTitle = WinGetTitle("") If StringUpper($WinTitle) = "NOTEPAD" Then MsgBox(0, "", "Notepad window..." & @CRLF & "Click OK to close it!") WinClose($WinTitle, "") EndIf<{POST_SNAPBACK}>I need it to work with Opt("WinTitleMatchMode", 2)
this-is-me Posted November 25, 2004 Posted November 25, 2004 ...And your point is? Who else would I be?
Killer Posted November 25, 2004 Author Posted November 25, 2004 ...And your point is?<{POST_SNAPBACK}>My point is, I need it to work with Opt("WinTitleMatchMode", 2) .That option will catch all window titles regardless example: to close the windows Notepad will be closed with Note, pad, Notepads. But I can't close Notepad titles using notepad, notePad because of the case sensitive.
this-is-me Posted November 25, 2004 Posted November 25, 2004 ..still, your point is? You haven't even tried the code you have been submitted or you wouldn't be saying something like this. Who else would I be?
Killer Posted November 25, 2004 Author Posted November 25, 2004 ..still, your point is? You haven't even tried the code you have been submitted or you wouldn't be saying something like this.<{POST_SNAPBACK}>Those code doesn't even close my notepad windows.
this-is-me Posted November 25, 2004 Posted November 25, 2004 As I said before, unless the currently active window is one with a title of notepad, then it won't work. Larry's script, however, will work on the latest unstable. Who else would I be?
Killer Posted November 25, 2004 Author Posted November 25, 2004 I don't see WinList documentations yet...but, this works...$array = WinList() For $i = 1 to $array[0][0] If StringInStr(StringUpper($array[$i][0]),"NOTEPAD") Then _ WinClose($array[$i][0]) NextLar.<{POST_SNAPBACK}>I got a winlist unknown function
Killer Posted November 25, 2004 Author Posted November 25, 2004 http://www.autoitscript.com/autoit3/files/unstable/autoit/<{POST_SNAPBACK}>Does the unstable version means the compiled program will sometimes fail?
this-is-me Posted November 25, 2004 Posted November 25, 2004 No, means that the function names are unstable (can change function names from version to version) Who else would I be?
Killer Posted November 25, 2004 Author Posted November 25, 2004 No, means that the function names are unstable (can change function names from version to version)<{POST_SNAPBACK}>Thanks. will try that.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now