Place two text items in memory for later use.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
OOsorio
Newbie
Posts: 6
Joined: Thu Nov 14, 2013 8:54 pm
Location: Miami, FL

Place two text items in memory for later use.

Post by OOsorio » Fri Feb 28, 2014 9:56 pm

I will execute a set of instructions and remember 2 pieces of information.When that process completes those 2 pieces of information have changed. I will then execute the same set of instructions and put back the original 2 pieces of information.

How can I remember those 2 pieces of information from the first pass?

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sat Mar 01, 2014 10:58 am

GetClipboard and save to a different variable. On iPad so can't provide code.
FIREFIGHTER

OOsorio
Newbie
Posts: 6
Joined: Thu Nov 14, 2013 8:54 pm
Location: Miami, FL

Post by OOsorio » Sat Mar 01, 2014 12:31 pm

Wouldn't clipboard only store one item at a time? I need two memory locations.

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Hope this helps

Post by CyberCitizen » Sat Mar 01, 2014 1:51 pm

What you can do is capture the text in the clipboard and assign it to a variable. This can be two different variables or if you know what text it needs to be you could do something like

Let>vStoredTXT1=Test Info 1
Let>vStoredTXT2=Test Info 2

Or something like this.

Send commands etc to copy text.
GetClipboard>vStoredTXT1

Send some more commands etc to copy text.
GetClipboard>vStoredTXT2

MDL>%vStoredTXT1% %CRLF% %vStoredTXT2%

Please note this was written by hand on a phone at 1:00 in the morning. Used as a guide or as a place to start.
FIREFIGHTER

JohnOlek
Newbie
Posts: 5
Joined: Wed May 14, 2014 4:20 pm

Re: Place two text items in memory for later use.

Post by JohnOlek » Wed May 14, 2014 4:47 pm

This may go beyond what you need, but I recently discovered array variables, which I think are fantastic for storing multiple values.

I have a script that needs to store a variable number of variables depending on how it's being used. I need it to start at the top of a column in an Excel worksheet and copy a specified number of beneath it. For example, if the first value is in A1 and there are 10 values in that column, I would have it grab A1-A10

Instead of creating Variable1, Variable2... Variable10, I have a loop that looks like this:

let>counter=1
while>counter<=numVariables
gosub>copyMoveDown
getClipBoard>temp
let>Steps[%counter%]=%temp%
let>counter=counter+1
endwhile

  View Snippet Page

numVariables is the number of cells I need to grab
copyMoveDown is a subroutine that copies the value of the current cell into a variable named "temp" and presses the down button to move to the next cell in Excel.

If numVariables = 10, this loop would produce the following at the end:

Steps[1] = value of A1
Steps[2] = value of A2
...
Steps[10] = value of A10

This is really helpful because I can easily reference these values in later loops by using Steps[%counter%] again.

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