Only works fine pressing Left Shift

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
yodrako
Newbie
Posts: 6
Joined: Sun Sep 03, 2006 5:48 pm

Only works fine pressing Left Shift

Post by yodrako » Wed Sep 06, 2006 6:22 pm

Hi, I'm spanish...my english is very bad, but I'll try to explain my problem

I have a script with a loop. The script copy a text of web and paste in excel. If de loop execute one time there aren't problems. If are 2 or more loops, Macro Scheduler (v.8) hold on.
I removed the loop and I extended the code, but the problem continued again.

I discover if before the second time the loop execute, I press the key left shift, it run fine. I prove to put the command "Press Lshift" but it doesn't work, the only solution it's press manually the key.

How can i solve it?

Sorry with my English..

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

Post by Marcus Tettmar » Wed Sep 06, 2006 6:36 pm

Do you have a "Release LShift" to correspond with the "Press LShift" - do you make sure you repeat the key before the next loop? Do you ensure the correct window has the focus - do you have a SetFocus line before the key sends? Does the focus shift before the next loop iteration? Is the loop jumping too fast? Do you need a Wait statement somewhere? Have you tested it with the debugger?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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

Post by pgriffin » Wed Sep 06, 2006 7:02 pm

Post the code and we can try to help you. Without seeing the code, it is almost impossible to know why it seems to be failing.

8)

yodrako
Newbie
Posts: 6
Joined: Sun Sep 03, 2006 5:48 pm

Post by yodrako » Wed Sep 06, 2006 7:16 pm

using the debugger, the problem is here, in Ldown, do the key shift seems press

CapsOff
MouseMove>471,376
Wait>2.45
LClick
Wait>0.11
MouseMove>1164,275
Wait>4.1
Press Page Down * 7
Wait>0.02
MouseMove>974,733
Wait>4.57
Press Shift * 10
Wait>0.49
LDown
Wait>1
Press Shift * 2
Wait>1
LUp
Press Shift * 18
Send>
Wait>1.23
Wait>1
MouseMove>64,37
Wait>1.1

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 Sep 06, 2006 7:24 pm

Need more code, no loops found here to analyze.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

yodrako
Newbie
Posts: 6
Joined: Sun Sep 03, 2006 5:48 pm

Post by yodrako » Wed Sep 06, 2006 7:32 pm

all code:


Let>n=0
Let>k=0

Repeat>n
Input>n,Whatt page (0-14) should be %n% ?
IF>n>14
Let>n=-1
ENDIF
Until>n>-1
Let>k=n

Repeat>k






Let>WW_TIMEOUT=5
CapsOff
MouseMove>98,434

Gosub>rc
Wait>t
Wait>1

LClick

Wait>2.5
MouseMove>938,267
wait>2
Press Page Up * 6
Wait>1.51
LClick



Let>d=0

Repeat>d
IF>nrc
Wait>0.2
Let>d=d+1

ENDIF


Until>d=n
Gosub>rc
Wait>t
Press Enter



Let>WW_TIMEOUT=5
CapsOff
MouseMove>471,376
Wait>2.45
LClick
Wait>0.11
MouseMove>1164,275
Wait>4.1
Press Page Down * 7
Wait>0.02
MouseMove>974,733
Wait>4.57
Press Shift * 10
Wait>0.49
LDown
Wait>0.02
Press Shift * 2
Wait>0.02
LUp
Press Shift * 18
Send>
Wait>1.23
MouseMove>64,37
Wait>1.1
LClick
Wait>0.14
MouseMove>113,124
Wait>1.15
LClick
Wait>0.09
MouseMove>468,784
Wait>0.5
LClick

//to excel


Let>WW_TIMEOUT=5
CapsOff
MouseMove>62,145
Wait>2.64
RClick
Wait>0.18
MouseMove>160,225
Wait>1.7
LClick

Wait>0.1
Press Down * 2
Wait>0.6
Press Enter
WaitWindowOpen>Pegado especial
MoveWindow>Pegado especial,0,60
ResizeWindow>Pegado especial,491,303
Wait>0.11
MouseMove>68,147
Wait>0.3


LClick
Wait>0.5


IF>n1



Let>WW_TIMEOUT=5
CapsOff
MouseMove>279,783
Wait>0.1
LClick
WaitWindowOpen>Microsoft Excel - Libro1
MoveWindow>Microsoft Excel - Libro1,-4,-4
ResizeWindow>Microsoft Excel - Libro1,1288,778
Wait>0.01
MouseMove>105,431



Let>k=k+1

Let>z=n
Let>n=0
Let>n=z





Let>n=n+1


Until>k=14


Message>all OK %n%


//SRT


SRT>rc
Repeat>t
Random>10,t
Until>tt=t/10
End>rc

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

Post by pgriffin » Wed Sep 06, 2006 7:33 pm

Why are you pressing SHIFT 10 times? in the normal course of an application, you might Press SHIFT then RELEASE SHIFT at some point before continuing.

LDown (just for clarification) is the act of Pressing the left Mouse Button.

Does your application use Shift to move between fields? what application are you automating?

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

Post by pgriffin » Wed Sep 06, 2006 7:45 pm

ok, Why don't we all start over on this one.

I suggest you try to write (in as much detail as possible) the actual process you are trying to automate. Do not just post code bits. My guess is that we can show you how to create a quality end-user application if you can describe what it is you want.

You are trying to capture data from a screen? Then maybe write it to Excel?

yodrako
Newbie
Posts: 6
Joined: Sun Sep 03, 2006 5:48 pm

Post by yodrako » Wed Sep 06, 2006 7:47 pm

First time I record the movements, copy a text of a web, change to excel, paste, leave the cursor in the correct position for the next loop, advance one page of web...again.

I use this program (it's very very good) since one week. Because I record, after write more code, the loop...and press shift 10 times is automatic, I don't write, was the program.

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

Post by Marcus Tettmar » Wed Sep 06, 2006 8:13 pm

You have no Release LShift statements. Therefore subsequent calls of this will be problematic since it thinks LShift is already pressed and thus all subsequent keysends will be sent WITH LShift. At the end of the loop add this:

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

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

yodrako
Newbie
Posts: 6
Joined: Sun Sep 03, 2006 5:48 pm

Post by yodrako » Fri Sep 08, 2006 7:01 pm

mtettmar wrote:You have no Release LShift statements. Therefore subsequent calls of this will be problematic since it thinks LShift is already pressed and thus all subsequent keysends will be sent WITH LShift. At the end of the loop add this:

Release LShift

I added that, and the problem continue... perhaps I should to do a new script...

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