COMBO VARIABLE NOT WORKING

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Tue Aug 29, 2006 1:26 am

I have been watching this thread with interest, so I know you have covered quite a bit of ground with Marcus and Me_Again.

I just want to make a few comments about your code.

1. before you have your code do ANYTHING that should go to a specific window, ALWAYS setfocus> on that window first. Just good practice...save you a lot of debugging.

2. When you create an array variable (k[%y%]) for example, you should address it EACH time in the script as Send>k[%y%] .....in my opinion. This is much clearer than wrapping the entire variable (as opposed to the array member) in the percent sign.

3. When you are interacting with an application (Notepad, Word, whatever,...) you should ALWAYS build in small Wait> commands even between Press/Release commands to allow the processor a little time to catch up. You can quickly overload a cpu without something like:

Press CTRL
wait>.05
Send>A
wait>.05
Release CTRL

etc....

These are just some guidelines from mistakes I have made personally.

also, on the forum if you will state the end-result you are trying achieve, then we can all suggest the best possible solution, instead of fixing these tiny code snippets.


Don't get frustrated, keep plugging.....

rusty9075
Newbie
Posts: 14
Joined: Sun Aug 27, 2006 4:46 pm

COMBO VARIABLE NOT WORKING

Post by rusty9075 » Tue Aug 29, 2006 4:59 am

Thanks SkunkWorks

It did appear that by adding some waits it improved the reliability. I still am having small problem Here is the new code:


let>y=0
repeat>y
let>y=y+1
let>k[%y%]=file


wait>0.2
press lshift
press right
wait>0.1
release lshift
wait>0.1
press ctrl
wait>0.1
send text>c
wait>0.1
release ctrl
wait>0.2

gcb>file
wait>0.2
press ctrl
wait>0.1
send text>v
wait>0.1
release ctrl
wait>0.1

press right

wait>0.5




until>y=9

press end
press enter*2


send text>%k[5]%



What I have done is open a text file with the following text:

1 2 3 4 5 6 7 8 9

I place my cursor before the "1" and run the code

The macro then copies each number and assigns it a variable. My Problem is that in this example "send text>%k[5]%" results in sending the number "4". Shouldn't "send text>%k[5]%" result in the text number "5". When I run it with "send text>%k[6]%" it returns the number "5", "send text>%k[4]%" returns the number 3, etc..it seems to always be 1 variable off. Am I missing something obvious here?

Also (rembember I a newbie) what does "Send>k[%y%] " do. I didn't quite understand its purpose and why it is useful.

Thank you for your help

Rusty9075

rusty9075
Newbie
Posts: 14
Joined: Sun Aug 27, 2006 4:46 pm

COMBO VARIABLE FIX

Post by rusty9075 » Tue Aug 29, 2006 4:49 pm

Hi

Hey, I figured out my last problem, I just needed to move my "let>k[%y%]=file" later in the code after the GCB. Thanks again for all those who helped me figure this stuff out. I really appreciate the help you gave to me.

Thanks
Rusty9075

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