Jump to content

Window Active/Exists help


Recommended Posts

i've tried a few things to do this but they all involve me typing in exact text

im trying to get this

#NoTrayIcon

While 1
Sleep(10)
If WinExists("YouTube - party in the usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Party in the USA - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Party in the Usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Party In The Usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Party In The usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - miley cyrus party in the usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley cyrus party in the usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus Party in the Usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus Party In The Usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus Party In The USA - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus Party In The usa - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - miley cyrus - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley cyrus - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus - Mozilla Firefox")Then Lockup()
If WinExists("YouTube - Miley Cyrus - Mozilla Firefox")Then Lockup()
    
HotKeySet ("{esc}", "nothing")
HotKeySet ("{rwin}", "nothing")
HotKeySet ("{lwin}", "nothing")
HotKeySet ("{rctrl}", "nothing")
HotKeySet ("{lctrl}", "nothing")
HotKeySet("{Pause}", "ExitFunc")
WEnd
Func ExitFunc ()
ConsoleWrite ("> Loop Ended" & @CRLF)
Exit
EndFunc

Func Lockup()
    ProcessClose("firefox.exe")
    While 2
    MouseMove(0,0)
    WEnd
EndFunc

Func nothing()
EndFunc

to work but as you can see i have to type in exact text is there anyway for this to work just when the words

"miley cyrus" or "party in the usa" come up?

i only have it workig on youtube right now i almost want it to work like this example but w/ firefox

AutoItSetOption("WinTitleMatchMode", 4)

; Get the handle of a notepad window that contains "this one"
$handle = WinGetHandle("classname=Notepad", "this one")
If @error Then
    MsgBox(4096, "Error", "Could not find the correct window")
Else
    ; Send some text directly to this window's edit control
    ControlSend($handle, "", "Edit1", "AbCdE")
EndIf
Edited by fred666777
Link to comment
Share on other sites

This will match any of the window titles you listed with just one line.

(?i) at the start of the regular expression pattern makes the match case insensitive.

If WinExists("[REGEXPTITLE:(?i)party in the usa|Miley Cyrus]")Then Lockup()

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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