Variable naming inside of a loop

Share your macros, knowledge, solutions, services, ...
Post Reply
alex
Posts: 1
Joined: Wed Nov 29, 2017 12:24 am

Variable naming inside of a loop

Post by alex » Wed Nov 29, 2017 12:35 am

Good afternoon,

I am using Perfect Keyboard Pro and I am trying to write a macro that will split information from the clipboard into separate variables based on the number of lines.

Sample Data

Main
KF100
.W47 1994

KE4300 .B47

The goal of this is to pretty it up and then put back together.

I think I want to process line by line. So I have created a loop based on the number of lines that at the moment displays each line in a message box. Not sure how to create a variable that increments itself based on the number of lines

<cmds>
<clp_copyselected>(0)
<varset>("CallNumber=_vClpText","")
<msg>(100,100,"%CallNumber%","Message",1)
<var_oper>(NumberOfLines,"%CallNumber%",TEXT_GET_NUMOFLINES,"2","", "0")
<msg>(100,100,"%NumberOfLines%","Message",1)
<varset>("Counter=1","")
<varset>("LineCounter=1","")
<begloop>(NumberOfLines)
<var_oper>(Line,"%CallNumber%",TEXT_GET_LINE,"%Counter%","", "0")
<msg>(100,100,"%Line%","Message",1)
<varset>("Counter=EXPR(%Counter%+1)","")
<endloop>

Ideally line would be renamed line1, line2, etc...

Is this possible?

Post Reply