Traxex84 Posted July 5, 2011 Share Posted July 5, 2011 Hello, I am fairly new to AutoIT I have been teaching myself and reading a few tutorials to get the hang of it all. Pretty much what I wanted to know if there is a variable for process'? Right now I am using $WindowName = "Window Name Here" Now I want to make it run off a process as some programs such are Internet Browsers have a changing window name depending on what website you are on so is it possible to use firefox as a variable similar to $WindowName but $ProcessCommandHere = "Firefox.exe" Thanks for the help Link to comment Share on other sites More sharing options...
JohnOne Posted July 5, 2011 Share Posted July 5, 2011 (edited) Run("firefoxpath/firefox.exe") will give you process ID of firefox instance if successfull. WinGetHandle("wintitle","") will give you window handle Edited July 5, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Traxex84 Posted July 5, 2011 Author Share Posted July 5, 2011 (edited) Someone pointed me in the right direction this is what I have so far, but it only runs once. If I try to run it again it will not rename its self a second time. Any help? $NEW_TITLE = "New name here" While 1 If ProcessExists("firefox.exe") Then $windows = WinList() $number_of_windows = $windows[0][0] For $i = 0 To $number_of_windows Step 1 If StringInStr($windows[$i][0], "firefox") > 1 Then WinSetTitle($windows[$i][0], "", $NEW_TITLE) EndIf Next While 1 Sleep(1000) If not ProcessExists("firefox.exe") Then ExitLoop EndIf WEnd EndIf Sleep(1000) WEnd Edited July 5, 2011 by Traxex84 Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 (edited) Because the script enter in the second loop and keeps there until the process stop of existing.Try this.$NEW_TITLE = "New name here" While 1 If ProcessExists("firefox.exe") Then $windows = WinList() $number_of_windows = $windows[0][0] For $i = 0 To $number_of_windows Step 1 If StringInStr($windows[$i][0], "firefox") > 1 Then WinSetTitle($windows[$i][0], "", $NEW_TITLE) EndIf Next ;~ While 1 ;~ Sleep(1000) ;~ If Not ProcessExists("firefox.exe") Then ;~ ExitLoop ;~ EndIf ;~ WEnd EndIf Sleep(1000)I only commented out the lines of the second loop.A Tip: you can tidy your scripts using the tidy tool inside the SciTe(If you use SciTe as editor)SciTE ---> Tools ----> Tidy AutoIt SourceAnother Tip: You can use WinExists to look the window by his class and check any instance of this.And Other tip: maybe you can put the existance of the window like the condition for the loop.Example:While WinExists("CLASS:MozillaUIWindowClass]") ;Script here Wend Edited July 5, 2011 by monoscout999 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