Starter Posted February 1, 2008 Share Posted February 1, 2008 I have been using Au3 for quite some time. Very good with automating commands and programs with set parmeters. Now I have read the documentation and cannot find good help files for the following... 1. If then... When automating programs where you may or may not see a window how the do I program that choice. i.e. #RequireAdmin Run("ccleaner.exe") WinWaitActive("Piriform CCleaner") ControlFocus("Piriform CCleaner","",1020) ControlClick("","",1020) Sleep(2000) ControlFocus("Piriform CCleaner","",1021) ControlClick("","",1021) Sleep(2000) ;run reg clean ControlFocus("Piriform CCleaner","",1001) ControlClick("","",1001) Sleep(200) ControlFocus("Piriform CCleaner","",1026) ControlClick("","",1026) Sleep(2000) ControlFocus("Piriform CCleaner","",1027) ControlClick("","",1027) Sleep(2000) ;program works to this point but cant make choice without an if then statement ;it should be if window pops up finish rest of code and ;if not Exit but im not sure of the sytax ControlFocus("","",7) ControlClick("","",7) Sleep(2000) ControlFocus("","",1100) ControlClick("","",1100) Sleep(2000) ControlFocus("","",1) ControlClick("","",1) Sleep(2000) ControlFocus("","",1104) ControlClick("","",1104) Sleep(2000) ControlFocus("","",1021) ControlClick( "", "",1021) Sleep(200) I have read the stuff on if then, if else but doesnt seem to work for me. maybe a formatting issue I dont know, I followed the examples in the help file. 2. I am also wondering if any video tutorials are around maybe a link or something anyways excellent program and I look forward to someday being a au3 vet Link to comment Share on other sites More sharing options...
seandisanti Posted February 1, 2008 Share Posted February 1, 2008 I have been using Au3 for quite some time. Very good with automating commands and programs with set parmeters.Now I have read the documentation and cannot find good help files for the following...1. If then...When automating programs where you may or may not see a window how the do I program that choice.Check out AdlibEnable() in your help file Link to comment Share on other sites More sharing options...
Starter Posted February 1, 2008 Author Share Posted February 1, 2008 #RequireAdmin Run("ccleaner.exe") WinWaitActive("Piriform CCleaner") ControlFocus("Piriform CCleaner","",1020) ControlClick("","",1020) Sleep(2000) ControlFocus("Piriform CCleaner","",1021) ControlClick("","",1021) Sleep(2000) ;run reg clean ControlFocus("Piriform CCleaner","",1001) ControlClick("","",1001) Sleep(200) ControlFocus("Piriform CCleaner","",1026) ControlClick("","",1026) Sleep(2000) ControlFocus("Piriform CCleaner","",1027) ControlClick("","",1027) Sleep(2000) Func myadlib() If WinActive("Error") Then Exit EndIf EndFunc ControlFocus("","",7) ControlClick("","",7) Sleep(2000) ControlFocus("","",1100) ControlClick("","",1100) Sleep(2000) ControlFocus("","",1) ControlClick("","",1) Sleep(2000) ControlFocus("","",1104) ControlClick("","",1104) Sleep(2000) ControlFocus("","",1021) ControlClick( "", "",1021) Sleep(200) continues to work if it finds reg problems but still when making choice will not close... ?????????????????????????????????? That is if I even have the if then part right Thanks in advance Link to comment Share on other sites More sharing options...
seandisanti Posted February 1, 2008 Share Posted February 1, 2008 (edited) #RequireAdmin Run("ccleaner.exe")WinWaitActive("Piriform CCleaner")ControlFocus("Piriform CCleaner","",1020)ControlClick("","",1020)Sleep(2000)ControlFocus("Piriform CCleaner","",1021)ControlClick("","",1021)Sleep(2000);run reg cleanControlFocus("Piriform CCleaner","",1001)ControlClick("","",1001)Sleep(200)ControlFocus("Piriform CCleaner","",1026)ControlClick("","",1026)Sleep(2000)ControlFocus("Piriform CCleaner","",1027)ControlClick("","",1027)Sleep(2000) Func myadlib() If WinActive("Error") Then Exit EndIfEndFuncControlFocus("","",7)ControlClick("","",7)Sleep(2000)ControlFocus("","",1100)ControlClick("","",1100)Sleep(2000)ControlFocus("","",1)ControlClick("","",1)Sleep(2000)ControlFocus("","",1104)ControlClick("","",1104)Sleep(2000)ControlFocus("","",1021)ControlClick( "", "",1021)Sleep(200)continues to work if it finds reg problems but still when making choice will not close...??????????????????????????????????That is if I even have the if then part rightThanks in advancethe condition looks to be formated correctly, are you sure on the window title being "Error"?***edit***you need to use adlibEnable() to actually run your adlib function Edited February 1, 2008 by cameronsdad Link to comment Share on other sites More sharing options...
Starter Posted February 1, 2008 Author Share Posted February 1, 2008 the condition looks to be formated correctly, are you sure on the window title being "Error"?***edit***you need to use adlibEnable() to actually run your adlib functionThanks for the help Run("ccleaner.exe")WinWaitActive("Piriform CCleaner")ControlFocus("Piriform CCleaner","",1020)ControlClick("","",1020)Sleep(2000)ControlFocus("Piriform CCleaner","",1021)ControlClick("","",1021)Sleep(2000);run reg cleanControlFocus("Piriform CCleaner","",1001)ControlClick("","",1001)Sleep(200)ControlFocus("Piriform CCleaner","",1026)ControlClick("","",1026)Sleep(30000)ControlFocus("Piriform CCleaner","",1027)ControlClick("","",1027)Sleep(2000) Func myadlib() If ControlClick("","",7) Then ControlFocus("","",7) ControlClick("","",7) Sleep(2000) ControlFocus("","",1100) ControlClick("","",1100) Sleep(2000) ControlFocus("","",1) ControlClick("","",1) Sleep(2000) ControlFocus("","",1104) ControlClick("","",1104) Sleep(2000) ControlFocus("","",1021) ControlClick( "", "",1021) Sleep(200) Exit ProcessClose("CCleaner.exe") EndIfEndFuncProcessClose("CCleaner.exe")work well now to add a timer to run once a dayAUTOIT IS AWESOME Link to comment Share on other sites More sharing options...
seandisanti Posted February 1, 2008 Share Posted February 1, 2008 Thanks for the help work well now to add a timer to run once a dayAUTOIT IS AWESOMEalways glad to help, and yes, yes it is. 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