Jump to content

How to make case unsensitive?


Killer
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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 by stingjoel
Link to comment
Share on other sites

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

<{POST_SNAPBACK}>

But winclose only goes for the exact name on the window, not the converted name.
Link to comment
Share on other sites

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)
Link to comment
Share on other sites

...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.

Link to comment
Share on other sites

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])
Next

Lar.

<{POST_SNAPBACK}>

I got a winlist unknown function :)
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...