Hello all,
Trying to figure out how to get this script to close the Defrag program when it finishes. Here's what I have so far:
ExecuteFile>C:\WINDOWS\system32\dfrg.msc
WaitWindowOpen>Disk Defragmenter
Press ALT
Send Character/Text>ad
release alt
This all works fine. However, when the defrag finishes, a window pops up (titled Disk Defragmenter) asking if I want to analyze or close. How do I wait until the defrag is over (which could be minutes or hours) and then press the appropriate key and close the program. I want to be able to schedule this overnight and complete automate the process, with no dialog screens left open.
Thanks.
Win XP Defrag Script question
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I can't get this to work, and I think the reason is that the 2nd window that pops up has the same title as the first "Disk Defragmenter". Therefore, any WaitWindowOpen command happens immediately.Bob Hansen wrote:Use another WaitWindowOpen> command, waiting for the prompt window.and then use a PushButton> or similar command to select the button and finish it.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Try something like this (window names are no good here):
Code: Select all
//Wait for prompt window actions
Let>WF_TYPE=3
WaitWindowOpen>DiskDefrag*
SetFocus>DiskDefrag*
PushButton>.......
WaitWindowClosed>DiskDefrag
//Wait for prompt window to finish, then close main window
Let>WF_TYPE=1
SetFocus>Defrag*
Press ALT
Press F4
Release ALT
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
I ended up going a completely different way with this. Fortunately Defrag offers a command line utility that works nicely.
Let>RP_Wait=1
Run Program>defrag c:
Let>RP_Wait=1
Run Program>defrag d:
This seems to work fine. I never could get the other script to properly recognize the pop up dialog, close it and then close the Windows defragmenter. Plus this one will work for multiple drives, whereas the other script would only work for the C: drive (I think).
Thanks.
Let>RP_Wait=1
Run Program>defrag c:
Let>RP_Wait=1
Run Program>defrag d:
This seems to work fine. I never could get the other script to properly recognize the pop up dialog, close it and then close the Windows defragmenter. Plus this one will work for multiple drives, whereas the other script would only work for the C: drive (I think).
Thanks.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact: