Jump to content
Sign in to follow this  
sobert

Getting Word from Title

Recommended Posts

Can someone tell me if it is possible to get the i.e. the 4th word of a window's title?

I need to create something where the script will only run if the 4th word in the title is i.e. "Test"

Thanks in advance.

Share this post


Link to post
Share on other sites

For the most part, yes you can. Given a window title of My Awesome Notepad Example.txt, you could do something like this:

$sTitle = WinGetTitle("[CLASS:Notepad]", "") ;get the full title
$aSplit = StringSplit($sTitle, " ") ;split the title by spaces
   ConsoleWrite($aSplit[4] & @CRLF) ;get the fourth element

If you're unable to get the class of the window, try using text inside the window (the second parameter in WinGetTitle).

Edited by JLogan3o13

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  

×
×
  • Create New...