coucou Posted February 7, 2006 Share Posted February 7, 2006 Hi,I buid the here bellow a small AutoInstall file. It shoulld work, but time to time one of the window or both doesn't close (WinClose).May someone advise how to use a Loop Statement. Something likeDo (the Winclose)Until (the window is closed)Run("exeicosetup.exe /S") sleep(2000) If WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") Then WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") EndIf sleep(1000) If WinExists("C:\Program Files\ExeIco\Readme.txt - Notepad") Then WinClose("C:\Program Files\ExeIco\Readme.txt - Notepad") EndIfRegardscoucou Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted February 7, 2006 Moderators Share Posted February 7, 2006 If the windows always open then you could use this: Run("exeicosetup.exe /S") WinWait("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") WinWait("C:\Program Files\ExeIco\Readme.txt - Notepad") WinClose("C:\Program Files\ExeIco\Readme.txt - Notepad") Link to comment Share on other sites More sharing options...
Methos Posted February 7, 2006 Share Posted February 7, 2006 Hi, I buid the here bellow a small AutoInstall file. It shoulld work, but time to time one of the window or both doesn't close (WinClose). May someone advise how to use a Loop Statement. Something likeDo (the Winclose) Until (the window is closed)Run("exeicosetup.exe /S") sleep(2000) If WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") Then WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") EndIf sleep(1000) If WinExists("C:\Program Files\ExeIco\Readme.txt - Notepad") Then WinClose("C:\Program Files\ExeIco\Readme.txt - Notepad") EndIfRegards coucou try something like this While WinExists("windowname") WinClose("windowname") Wend that will close that window, until no windows with that name exist. Link to comment Share on other sites More sharing options...
MHz Posted February 7, 2006 Share Posted February 7, 2006 Opt('WinTitleMatchMode', 2) $pid = Run("exeicosetup.exe /S") sleep(2000) While ProcessExists($pid) If WinExists("Executable File Icons Changer") Then WinClose("Executable File Icons Changer") EndIf sleep(1000) If WinExists("Readme.txt - Notepad") Then WinClose("Readme.txt - Notepad") EndIf WEnd Sleep(2000) This will cover the duration of the installation. SubString setting for window titles may make it easier also. Link to comment Share on other sites More sharing options...
coucou Posted February 8, 2006 Author Share Posted February 8, 2006 TNX all, Yr advises certainly works, I received them after solving the problem. Here my file Run("exeicosetup.exe /S") sleep(2000) $1 = WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") $2 = ProcessExists("notepad.exe") Do If $1 = 1 OR $2 = 1 Then WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") sleep(2000) ProcessClose("notepad2.exe") EndIf Until $1 = 0 AND $2 = 0 Regards coucou Link to comment Share on other sites More sharing options...
skippynz Posted February 8, 2006 Share Posted February 8, 2006 TNX all, Yr advises certainly works, I received them after solving the problem. Here my file Run("exeicosetup.exe /S") sleep(2000) $1 = WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") $2 = ProcessExists("notepad.exe") Do If $1 = 1 OR $2 = 1 Then WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") sleep(2000) ProcessClose("notepad2.exe") EndIf Until $1 = 0 AND $2 = 0 Regards coucou wouldnt you need to put in a check to see if the process or window still exist after you have done the close otherwise $1 and $2 would still be 1 ??? for example putting in the winexists and process exists after your endif ? or do i have the whole thing messed up ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2006 Moderators Share Posted February 9, 2006 (edited) wouldnt you need to put in a check to see if the process or window still exist after you have done the close otherwise $1 and $2 would still be 1 ??? for example putting in the winexists and process exists after your endif ? or do i have the whole thing messed up ?Until $1 = 0 AND $2 = 0 Won't leave the loop until the statement is true. Edit:Do If WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") OR ProcessExists("notepad.exe") Then WinClose("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") Sleep(2000) ProcessClose("notepad2.exe") EndIf Until Not WinExists("C:\Documents and Settings\Administrator\Start Menu\Programs\Executable File Icons Changer") AND Not ProcessExists("notepad.exe")Is basically what they are trying to do. Edited February 9, 2006 by SmOke_N 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...
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