alexpere Posted November 2, 2004 Posted November 2, 2004 I have a proposal for two new functions... ProcessWinGetTitles("process") - returns the titles of windows associated with a process in an array of strings ProcessWinSetTitle("process", ???) - sets the title of a window associated with a process (not sure how the window would be specified) I've already had a bit of a look at doing this myself using EnumWindows and GetWindowThreadProcessId but wanted other people's feedback first. I also haven't done any development on AutoIt before so not sure if there's a set way of getting approval and working on things. Al.
Administrators Jon Posted November 2, 2004 Administrators Posted November 2, 2004 There's been a WinGetTitles or WinList on the todo list for ages, just a matter of finding time to code it - I might do it next as it's a fairly big ommision. The process version would be a natural extension.
alexpere Posted November 25, 2004 Author Posted November 25, 2004 I really needed it so I've coded in ProcessWinGetTitles() . I'm not sure if I'll get to ProcessWinSetTitle() though. Code submission to Jon forthcoming... Alex.
alexpere Posted December 22, 2004 Author Posted December 22, 2004 Hi Jon, Any news on when this functionality will be added to unstable? I can't wait for it... Alex.
alexpere Posted December 22, 2004 Author Posted December 22, 2004 :"> Are you able to give me a couple of examples of how to use it? I can't find anything in the docs of the latest unstable except for WinGetProcess. Help much appreciated!
CyberSlug Posted December 22, 2004 Posted December 22, 2004 You probably need to use a combination of the following functions: WinGetProcess ProcessList WinSetTitle WinGetProcess (maybe) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
alexpere Posted December 22, 2004 Author Posted December 22, 2004 Thanks CyberSlug, I hadn't thought of that. Hopefully it works! Jon e-mailed me to say he was putting it in but as I can't find it and unstable has code freeze I'm stressing a bit!!
alexpere Posted December 31, 2004 Author Posted December 31, 2004 Just to close this out, here are my results which work great for simple programs with only one window (all I need): Func _ProcessGetFirstWinTitle($process) ; Check given process actually exists $pid = ProcessExists($process) If Not $pid Then _Logthis("Given process does not exist: " & $process) Return 1 EndIf ; Get window list $winList = WinList() ; Find which windows go with this process For $i = 0 To $winList[0][0] - 1 $testPid = WinGetProcess($winList[$i][1]) If $testPid = $pid Then Return $winList[$i][0] EndIf Next Return 0 EndFunc Func _ProcessSetFirstWinTitle($process, $newTitle) ; Set window title as given by _ProcessGetFirstWinTitle() $title = _ProcessGetFirstWinTitle($process) WinSetTitle($title, "", $newTitle) EndFunc Thanks for pointing me in the right direction CyberSlug!
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