Jump to content
Sign in to follow this  
Starter

Coaching

Recommended Posts

Starter

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

Share this post


Link to post
Share on other sites
seandisanti

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

Share this post


Link to post
Share on other sites
Starter

#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

Share this post


Link to post
Share on other sites
seandisanti

#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

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 function

Edited by cameronsdad

Share this post


Link to post
Share on other sites
Starter

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 function

Thanks 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 clean

ControlFocus("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")

EndIf

EndFunc

ProcessClose("CCleaner.exe")

work well now to add a timer to run once a day

AUTOIT IS AWESOME

Share this post


Link to post
Share on other sites
seandisanti

Thanks for the help

work well now to add a timer to run once a day

AUTOIT IS AWESOME

always glad to help, and yes, yes it is.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.