GerryKeely Posted September 29, 2006 Share Posted September 29, 2006 I am using winlist to extract a program title from another application.Part of the code is as follows Opt("WinTitleMatchMode",2) $app = "CodeVisionAVR" $w = WinList($app) if $w[0][0]=0 Then MsgBox(0,"",$app & " is not open") Exit EndIf $msg = $w[2][0] ConsoleWrite($msg) the title returned is "CodeVisionAVR - freq_count.prj - [c:\cvavr\myfiles\freq_count.c]" which is correct. However sometimes this does not return the correct information and I have to use $w[1][0] instead.Its as if the values returned by $w[1][0] and $w[2][0] are crossed. Is this a problem with windows(I have windows XP-Home) Regards Gerry Keely Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 29, 2006 Moderators Share Posted September 29, 2006 Try running your app with this$aWin = _WinGetTitleByExe('notepad.exe') For $iCC = 1 To $aWin[0] MsgBox(64, 'Info', $aWin[$iCC]) Next Func _WinGetTitleByExe($sExe) Local $aPList = ProcessList($sExe) Local $sHold, $aWList = WinList() For $iCC = 1 To $aWList[0][0] For $xCC = 1 To $aPList[0][0] If WinGetProcess($aWList[$iCC][1]) = $aPList[$xCC][1] And _ BitAND(WinGetState($aWList[$iCC][1]), 2) And _ $aWList[$iCC][0] <> '' Then $sHold &= $aWList[$iCC][0] & @LF EndIf Next Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), @LF);return a 1 based array Return SetError(1, 0, 0) EndFuncYou've preset with yours saying that the 2nd window returned would be the window you wanted, that's not always the case. With the above code, you can get all the windows names from the actual process that is running. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
GerryKeely Posted September 29, 2006 Author Share Posted September 29, 2006 To SmOke_N Thank you very much for your reply. I'll give that a try. Regards Gerry 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