ALT Strings

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
CharlesGivens

ALT Strings

Post by CharlesGivens » Tue Feb 25, 2003 3:37 am

Hello All,

I have a script that I downloaded from the script page to do a defrag analysis on Windows 2000 professional. My scripts is as follows:

ExecuteFile>C:\WINNT\system32\dfrag.msc
WaitWindowOpen>Disk Defragmentor
Press Alt
Send Character/Text>A
Press Enter
Release Alt
WaitWindowOpen>Analysis Complete
Press Alt
Send Character/Text>d

The problem is that the Alt key never really gets sent. I have tested this with the notepad application and it works fine. Macro Scheduler flashes as if it is waiting for input. Any ideas?

Thanks

Charles

Lumumba

Post by Lumumba » Tue Feb 25, 2003 6:10 am

a) with a combination like ALT+A, to send a character doesn't need to be confirmed by pressing the Return Key (ENTER). So delete it or it has to follow the Release ALT line:

...
Release ALT
Press Enter
...

b) maybe I'm wrong. Isn't there a missing Release ALT at the end of the given code?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 25, 2003 9:23 am

Does look as if Release ALT is missing. Any Press ALT must have a corresponding Release ALT.
MJT Net Support
[email protected]

CharlesGivens

ALT String

Post by CharlesGivens » Tue Feb 25, 2003 9:51 pm

Thanks All, but it still does not work properly.

The following script still does nothing:

ExecuteFile>C:\WINNT\system32\dfrg.msc
WaitWindowOpen>Disk Degramentor
Press ALT
Send>A
Release ALT
Send>A
WaitWindowOpen>Analysis Complete
Press ALT
Send>d
Release ALT

It just does not work? Any additional ideas....

Thanks

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 25, 2003 9:58 pm

Hi,

Run the process manually. Notice the window names and keystrokes needed. Transform to a script. You have some help in the form of the script you have downloaded - even if it doesn't quite work - but you'll obviously have to do some of the work yourself.

Read the Scripting Windows for Beginner's guide in the documentation - it will help.

I would rewrite the script for you but I don't have access to Win2k at the moment and there may be something specific to your system to take into account.

Anyone with Windows 2000 able to verify this script and correct it?
MJT Net Support
[email protected]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 25, 2003 10:03 pm

Hi,

In Windows XP this works:

ExecuteFile>%SYS_DIR%\dfrg.msc
WaitWindowOpen>Disk Defragmentor
//send ALT-A-D (Action/Defragment)
Press ALT
Send>ad
Release ALT

That's all is needed. The script you have did analyze and then waited for another window to appear before proceeding to hit 'D' for defragment - but in my setup (XP) the window was named differently. The above script doesn't bother analyzing but goes straight in to the defrag.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Feb 25, 2003 10:06 pm

I may be able to access 2K system tonight, but I wonder if the spelling of the window is wrong?

WaitWindowOpen>Disk Defragmenter

If spelling is wrong, macro will wait forever for a non-existent window. Also, log the macro, what is log content showing?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 25, 2003 10:09 pm

Good spot. Yes, and I even copied it down in my post wrong. My little version of the script should be:

ExecuteFile>%SYS_DIR%\dfrg.msc
WaitWindowOpen>Disk Defragmenter
//send ALT-A-D (Action/Defragment)
Press ALT
Send>ad
Release ALT
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 26, 2003 12:29 am

I just ran the previous script (with corrected spelling) on Windows 2000 system using Macro Scheduler 7.1.17 with no problem, it ran fine. Hope that helps......
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts