sobert Posted November 11, 2014 Share Posted November 11, 2014 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. Link to comment Share on other sites More sharing options...
Moderators Solution JLogan3o13 Posted November 11, 2014 Moderators Solution Share Posted November 11, 2014 (edited) 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 November 11, 2014 by JLogan3o13 sobert 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
sobert Posted November 12, 2014 Author Share Posted November 12, 2014 Thanks for that! I apologize for being such a noob. What would be the proper syntax to get the 3rd and 4th element? I tried ConsoleWrite($aSplit[3] [4] & @CRLF) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 12, 2014 Moderators Share Posted November 12, 2014 $aSplit is a 1D array, so it would simply be $aSplit[1], $aSplit[2], etc. If you want to write multiple indexes, you would write it like so: $aSplit[3] & $aSplit[4] "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
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