Jump to content

How to use regular expression on Window text


ur
 Share

Recommended Posts

I am trying to identify the window based on the window title and text.

The title will be the "erwin DM - filename"

It is working till date, but some operating systems our application is displaying window as "erwin DM - [filename]"
 

I tried  "erwin DM - *filename*" But this regular expression is not working.
Any suggestion?

 

$sModelFile = "C:\Users\Administrator\Documents\My Models\eMovies.erwin"
$wdModel = _WinWaitActivate1("erwin DM - "&FileNameOnly($sModelFile),"")

Func _WinWaitActivate1($title,$text,$timeout=0);Will Return the window Handler
    Logging("Waiting for "&$title&":"&$text)
    $dHandle = WinWait($title,$text,$timeout)
    if not ($dHandle = 0) then
        If Not WinActive($title,$text) Then WinActivate($title,$text)
        return WinWaitActive($title,$text,$timeout)
    Else
        Logging("Timeout occured while waiting for the window...")
        Exit
    EndIf
 EndFunc
 
 
Func FileNameOnly($sFilePath)
    Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = ""
    Local $aPathSplit = _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension)
    ;_ArrayDisplay($aPathSplit, "_PathSplit of " & @ScriptFullPath)
    return $sFileName
EndFunc

 

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

×
×
  • Create New...