Jump to content
Sign in to follow this  
Sphaera_ORbis

ControlCommand

Recommended Posts

I get ControlCommand() called with illegal argument 4: "IsDisabled" (looked to good to be true) ;0

Does anyone know the correct way to handle this??

While 1

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) AND ControlCommand ("CCleaner", "Sluiten", 6, "IsEnabled", "" ) Then Exitloop

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsDisabled", "" ) AND ControlCommand ("CCleaner", "Sluiten", 6, "IsEnabled", "" ) Then

Sleep (2000)

MsgBox ( 64, "Auto-CC", "Cleaning Completed" )

ControlFocus ( "CCleaner", "Sluiten", 6 )

ControlClick ( "CCleaner", "Sluiten", 6, "left" , 1 )

Sleep (2000)

Exit

EndIf

WEnd

Edited by Sphaera_ORbis

Share this post


Link to post
Share on other sites

I get ControlCommand() called with illegal argument 4: "IsDisabled" (looked to good to be true) ;0

Does anyone know the correct way to handle this??

While 1

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) AND ControlCommand ("CCleaner", "Sluiten", 6, "IsEnabled", "" ) Then Exitloop

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsDisabled", "" ) AND ControlCommand ("CCleaner", "Sluiten", 6, "IsEnabled", "" ) Then

Sleep (2000)

MsgBox ( 64, "Auto-CC", "Cleaning Completed" )

ControlFocus ( "CCleaner", "Sluiten", 6 )

ControlClick ( "CCleaner", "Sluiten", 6, "left" , 1 )

Sleep (2000)

Exit

EndIf

WEnd

<{POST_SNAPBACK}>

some logic:

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) = 1 then the control is Enabled, when it returns 0, it's not enabled
so If NOT ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) then you check if it's "Disabled"

There is no need to have 2 commands to check the same thing

Edited by TuMbLeWeEd

Share this post


Link to post
Share on other sites

some logic:

If ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) = 1 then the control is Enabled, when it returns 0, it's not enabled
so If NOT ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" ) then you check if it's "Disabled"

There is no need to have 2 commands to check the same thing

<{POST_SNAPBACK}>

Then i think this is the way it should work, let me know if you think otherwise.

While 1

$func1 = ControlCommand ("CCleaner", "Herstel geselecteerde fouten...", 4, "IsEnabled", "" )

$func2 = ControlCommand ("CCleaner", "Sluiten", 6, "IsEnabled", "" )

If $func1 = 1 And $func2 = 1 Then ExitLoop

If $func1 = 0 And $func2 = 1 Then

Sleep (2000)

MsgBox ( 64, "Auto-CC", "Cleaning Completed" )

ControlFocus ( "CCleaner", "Sluiten", 6 )

ControlClick ( "CCleaner", "Sluiten", 6, "left" , 1 )

Sleep (2000)

Exit

EndIf

WEnd

Edited by Sphaera_ORbis

Share this post


Link to post
Share on other sites

I downloaded the program to to see myself.

When the program starts up, you will not see the progress bar. But, AutoIt info tool can see this progress bar hidden. This is a good method to know when this program is run, as it becomes visible, when cleaning process starts. When the progress bar is visible, and the run button becomes enabled, then the program cleaning process is complete. Then we just close it.

If FileExists(@ProgramFilesDir & '\CCleaner\ccleaner.exe') Then

    Run(@ProgramFilesDir & '\CCleaner\ccleaner.exe')

    If WinWait('CCleaner') Then
    ; Optional window title change and sleep ;)
        If WinSetTitle('CCleaner', '', 'CCleaner - Automated by AutoIt3') Then Sleep(2000)
        ControlClick('CCleaner', '', 3)
    EndIf

; Close the temporary warning msgbox
    If WinWait('', 'Do not show me this message again', 2) Then
        ControlClick('', 'Do not show me this message again', 4)
    EndIf

; Progressbar is hidden, but when visible and run button is enabled, then we are finished.
    Do
        Sleep(500)
    Until ControlCommand('CCleaner', '', 8, 'IsVisible') And ControlCommand('CCleaner', '', 3, 'IsEnabled', '')

    WinClose('CCleaner')

EndIf

Added good spacing for good identification purposes only.

Good luck

:(

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...