Jump to content

Click OK button after Batch Command has finished


PAB
 Share

Recommended Posts

Good evening,

I have been having trouble with getting a Batch Script to click "OK" after the Batch Command has finished . . .

Clean_PopUp.JPG.3cb6d7c322bee0c0f20d531c02bbf99e.JPG

On investigation, I came across this site which might help me resolve this.

Here is the part of the Batch Command that I am having trouble with . . .

cleanmgr.exe /VeryLowDisk /d C

Everything else in the Batch Script is automated and runs without ANY problems.

Is there a way that I can incorporate an Autoit Command to replicate [ virtual ] pressing the "OK" button please?

Stay SAFE, Best Regards.

Link to comment
Share on other sites

Sorry, I could NOT find a way to edit my above post.

I should have mentioned that "OK" is obviously the ONLY option available, so the focus is on it. By that, I mean that getting the Script to replicate pressing ENTER, will also work.

Thanks. 

Link to comment
Share on other sites

You could also use /sageset, /sagerun switches for example the code below should be the same as running "cleanmgr.exe /VeryLowDisk" (untested).  The script would be the same checking every box in cleanmgr and then clicking ok, without any dialogue.
note: sageset/sagerun doesn't support the /d option.

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;~ Use StateFlagsxxxx, where xxxx is 0 - 9999
Local $sStateFlags = "StateFlags0100"
Local $sVolumeCacheRoot = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
Local $sVolumeCacheKey
Local $i = 1
While 1
    $sVolumeCacheKey = RegEnumKey($sVolumeCacheRoot, $i)
        If @error Then ExitLoop
    ;~ Uncomment line below to write to registry
    ;~  RegWrite($sVolumeCacheRoot & "\" & $sVolumeCacheKey, $sStateFlags, "REG_DWORD", 2)
    $i += 1
WEnd
;~ Uncomment to run cleanmgr
;~ Run("cleanmgr.exe /sagerun:100")

 

Link to comment
Share on other sites

  • 2 months later...

try this code:

ControlClick("Disk Space Notification","","Button1")

or what subz say's:

#RequireAdmin
Local $sStateFlags = "StateFlags"
Local $sVolumeCacheRoot = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
Local $sVolumeCacheKey
Local $i = 1
   $Drive = InputBox("Drive Disk:","(C or D or E etc.')","default")
While 1
            If @error Then ExitLoop
    $sVolumeCacheKey = RegEnumKey($sVolumeCacheRoot, $i)
                           if $sVolumeCacheKey = "" Then ExitLoop
    $inputValue = InputBox($sVolumeCacheKey,"Enter '1' or '0' ","default")
  RegWrite($sVolumeCacheRoot & "\" & $sVolumeCacheKey, $sStateFlags, "REG_DWORD", $inputValue)
    $i += 1
WEnd
 Run("cleanmgr.exe /d "&$Drive)

 

 

Edited by ad777

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...