1.

Solve : AUTO CLEAN UP?

Answer»

I am running Windows XL and have programmed it to do an auto clean up to remove the Int Temp Files at a certain time each day as they do not clear themselves out when the computer is shut down.
My problem is that it only goes as far as ASKING me to carry on to clean the selected files and then asks me if I am sure, just as if I had OPENED the prog manually.
How can I get the clean up to complete itself WITHOUT me having to click TWICE to get it done. It means that if I am not at the desk, it doesn't get done.I guess you could have a script to press Enter twice for you.
Do you think something like that might work?I have it set up under the 'Schduled Tasks' via the Control Panel, but it does not complete the task on its own.If you need it to click on confirmation boxes, a script running with the scheduled task should work.

Here's what I'm suggesting.

Code: [Select]set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 5000
For i = 1 to 1
    WshShell.SendKeys "{TAB}"
WScript.Sleep 500
    WshShell.SendKeys "{TAB}"
WScript.Sleep 500
    WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
    WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
Next
WScript.Sleep 5000 means it will wait 5 seconds before starting its next commands.

WshShell.SendKeys "{TAB}" is basically like pressing TAB on the keyboard. I put those in there as an example in case the confirmation boxes aren't selected.

WScript.Sleep 500 means it will wait half a second (500 miliseconds) before executing the next command.

WshShell.SendKeys "{ENTER}" press Enter.

For example, this script will wait 5 seconds before pressing TAB. It will then press TAB again after half a second, and then Enter twice a second apart.

Save that as filename.vbs In Notepad (file --> Save as --> File.vbs) and have it RUN with the other program.

Note: you can CHANGE the order of events simply by changing the time in between the commands or just adding some.

I hope that made sense to you.Thanks, will give it a go.



Discussion

No Comment Found