Get Clipboard as a variable in a loop

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Neib74656
Junior Coder
Posts: 29
Joined: Fri Sep 10, 2021 10:51 pm

Get Clipboard as a variable in a loop

Post by Neib74656 » Fri Sep 10, 2021 10:59 pm

Hello Everyone,

I have written the following script

GetClipBoard>Q,0
wait>WaitTime
SetFocus>Shipment 3*
wait>WaitTime
MouseMoveRel>410,268
LClick
wait>WaitTime
Let>N=0
if>Q>0
Let>Q=Q*1
Repeat>N
Let>N=N+1
Send +
wait>WaitTime
Until>N=Q
endif

The script copies a value from an Excel and should then press the + key in another program the value from the cell in Excel (Variable Q). I can see in the debugger that it is properly setting Q=2 but the loop will not end even once N=2 and therfore N=Q. It seems that the getclipboard function might be storing the value from Excel not as an integer?

I have tried changing the format of the cell in Excel to number with no decimal places but same result the loop just keeps repeating forever. I have also tried using INPUT and entering Q when running the script and in that case the loop ends correctly when N=2 and Q=2 IE N=Q.

Any help is appreciated :)

Neib74656
Junior Coder
Posts: 29
Joined: Fri Sep 10, 2021 10:51 pm

Re: Get Clipboard as a variable in a loop

Post by Neib74656 » Sat Sep 11, 2021 1:18 am

I should specify the reason for

Let>Q=Q*1

Was an attempt to see if I could force the variable into a numerical value as I assumed that was what the issue was.
However that also did not work.

Neib74656
Junior Coder
Posts: 29
Joined: Fri Sep 10, 2021 10:51 pm

Re: Get Clipboard as a variable in a loop

Post by Neib74656 » Sat Sep 11, 2021 1:31 am

Hello everyone

For anyone who comes accross this I was actually able to resolve this by using XLGetSelectedCell and setting the cell variable to Q.

This script now works every time!

User avatar
Grovkillen
Automation Wizard
Posts: 1128
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Get Clipboard as a variable in a loop

Post by Grovkillen » Sat Sep 11, 2021 6:19 am

Try longer variable names as a start.
Let>ME=%Script%

Running: 15.0.27
version history

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