Evaluating a general script

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
sacredeagle
Newbie
Posts: 7
Joined: Fri May 18, 2007 11:10 am

Evaluating a general script

Post by sacredeagle » Fri May 18, 2007 11:16 am

I am evaluating Macro Scheduler, when running the general macro Notepad this is how the text looks like:
Hellow orld

I'llno ws lowdo wnt hekeysen dr atef orth ene xtli nE:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
i
'lle xiTN otepadin 5 s econds. ..12345
Not pretty at all. What could possibly be the cause of this?

Cheers,
Helgi Örn

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 12:18 pm

Looks like it's running too fast for your PC. Add the following line to the top of the script:

Code: Select all

Let>SK_DELAY=10
And change the Let>SK_DELAY=0 line to Let>SK_DELAY=10

If necessary increase the number.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sacredeagle
Newbie
Posts: 7
Joined: Fri May 18, 2007 11:10 am

Post by sacredeagle » Fri May 18, 2007 12:29 pm

Didn't change much:
HelloW orld
I'llno wslo wdo wnth eke ys endra tefor the ne xtLI NE:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Zi
'll exit Notepad in 5 seconds ...12345
I also tried 15 and 20 but no go.

This is a 3 GHz P4 with 1 GB RAM, shouldn't that be fast enough?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 12:36 pm

Very odd. Something is messing up your keyboard buffer - the spaces seem to be being processed too early! I've never seen anything like it. The actual characters are correct, but the spaces are inserted too early. Bizarre.

What language version of Windows are you using? What language keyboard layout?

What happens if you add this line to top of script:

Let>SK_LEGACY=1

Interestingly after the first line it seems to improve. Therefore I wonder if it just needs a delay after running Notepad. Try adding this line after the WaitWindowOpen line - before the Send>Hello World line:

Wait>5

That will cause a delay of 5 seconds. Probably overkill, but try it first anyway.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sacredeagle
Newbie
Posts: 7
Joined: Fri May 18, 2007 11:10 am

Post by sacredeagle » Fri May 18, 2007 12:42 pm

I did add: Let>SK_DELAY=10 before Send>Hello World
which resulted in:
Hello World
I'll now slow down the key send rate for the next line:
A B C D E F G H I J K L M N O P Q R S T U V W X Y ZI
'll exit Notepad in 5 seconds ...12345
The system is XP in swedish with a swedish keyboard layout.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 12:46 pm

Almost perfect. Try this:

Code: Select all

//Prompt the user whether to continue or not
Ask>This script will open Notepad and type in some text.  Continue?,continue

If>continue=YES

   //Run Notepad
   Run>Notepad.exe

   //Wait for Notepad to be ready
   WaitWindowOpen>Untitled - Notepad
   Wait>1

   Let>SK_DELAY=20

   //Send some text
   Send>Hello World
   Press Enter * 2
   Wait>1

   //Send some more text
   Send>I'll now slow down the key send rate for the next line:

   Wait>1
   Press Enter

   //Next line slows down the keysend rate
   Let>SK_DELAY=50
   Send>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
   Wait>1

   //More text and then count up 5 seconds before exit
   Press Enter * 2
   Let>SK_DELAY=20
   Send>I'll exit Notepad in 5 seconds ...
   Wait>1
   Send>1
   Wait>1
   Send>2
   Wait>1
   Send>3
   Wait>1
   Send>4
   Wait>1
   Send>5
   Wait>1

   //Send ALT-fx to exit Notepad
   Press ALT
   Send>fx
   Release ALT

   //A confirmation box will appear asking if you want to save changes
   //It is called "Notepad" and we need to press 'n' to say no.
   WaitWindowOpen>Notepad
   Send>n

ENDIF
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sacredeagle
Newbie
Posts: 7
Joined: Fri May 18, 2007 11:10 am

Post by sacredeagle » Fri May 18, 2007 12:50 pm

I tested turning off the program Texter http://lifehacker.com/software//lifehac ... 238306.php and then everything seems OK:
Hello World

I'll now slow down the key send rate for the next line:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

I'll exit Notepad in 5 seconds ...12345
which is a pity because Texter is a beautiful little helper.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 12:52 pm

Texter is not helping here though - it is muddling up the keyboard buffer! You can see that keys you are sending are arriving in the wrong order. We send them in the right order. So Texter is doing something before they arrive.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sacredeagle
Newbie
Posts: 7
Joined: Fri May 18, 2007 11:10 am

Post by sacredeagle » Fri May 18, 2007 1:07 pm

I changed the script back to the original and everything works OK.
I'll drop the Texter developer a line.

Thank's for helping out, I'll keep evaluating to see if the program can optimize my routines at work and give me more spare time 8)

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 1:23 pm

It is probably worth mentioning that we use Direct Access which is similar to Texter, and we have never had any problems using Direct Access in conjunction with Macro Scheduler. I have never seen it mess up the keyboard buffer like this. Direct Access monitors the keyboard and provides text substitution and allows you to create text abbreviations for common tasks. We have a bundling deal with the makers of Direct Access and can provide our customers with a 25% discount.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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