Jump to content
Macro Express Forums

One variable per line


Recommended Posts

Hello,

 

I just bought your pro version (N.B from France), excellent tool.

 

I have two problems :

1st :

I have a list in clipboard :

Maggie
Yubie
Ned
Rufus
Lily
I wan't to put each line in a variable (Maggie to T1, Yubie to T2...) but I don't find how to do it...
2nd :
I have a second list :
Rufus
Maggie
Yubie
Tata
Ned
Toto
Titi
Lily
I wan't to save in variables, only the names of the first list, but in the order of the second list ?
Can someone help me please ?
Link to comment
Share on other sites

We need something to distinguish one word (name?) from the next. Where did the list in the clipboard come from? Is there anything that separates the end of one name from the beginning of the next -- Carriage Return or New Line characters? Maybe just capitalization at the beginning of each name?

Link to comment
Share on other sites

You can help youself by try it out. But anyway... Every beginning is difficult

You can download the full macro at the end of post - see attachment

Variable Set to ASCII Char 13 to %T[97]% // Save "Carriage Return" in string variable %T[97]%
Variable Set to ASCII Char 10 to %T[98]% // Save "Line Feed" in string variable %T[98]%
 
// merge both variable %T[97]% and %T[98]% to %new_line%
trigger the same behave like pressing < Enter > on keyboard
Variable Set String %new_line% to "%T[97]%%T[98]%"
 
// Save all content in string variable %full_uncut_content_clipboard%
Variable Set String %full_uncut_content_clipboard% from the clipboard contents
// Now, the content from clipboard is in string variable %full_uncut_content_clipboard% but how we get it into T[x] variable ?
// With "Split String" ... (Variables - Split String)
Split String "%full_uncut_content_clipboard%" on "%new_line%" into %T%, starting at 1
// We say: Split String %full_uncut_content_clipboard% on every end of line %new_line%
 
// And put them into %T% variable beginning with %T[1]%
continue with %T[2]%, %T[3]% untill all data is split
 
// Now you can do the 2nd job
Variable Set String %T[20]% to "Tata"
Variable Set String %T[21]% to "Toto"
Variable Set String %T[22]% to "Titi"
// Now we bring it into the correct order
// Remeber:
%T[1]% = Maggie
%T[2]% = Yubie
%T[3]% = Ned
%T[4]% = Rufu
%T[5]% = Lily
Text Box Display: Show all Names



You learn faster when you try out some thinks. So see this is a special case.
Welcome to Macro Express Pro

Look_Up

Save content from clipboard.mex

Edited by Look_Up
Link to comment
Share on other sites

Hello,

 

I'm not a begginer, I done a lot of very stable macros, but for this problem, I just don't know how to do. :/

 

rberq

I tried pixels etc... Wrong way.

 

 

Look_Up

Wow, interesting way ! I try to understand, thank you !

 

 

Cory

What is CRLF ? I don't understand.

Link to comment
Share on other sites

You can help youself by try it out. But anyway... Every beginning is difficult

 

You can download the full macro at the end of post - see attachment

 

 

Variable Set to ASCII Char 13 to %T[97]% // Save "Carriage Return" in string variable %T[97]%
Variable Set to ASCII Char 10 to %T[98]% // Save "Line Feed" in string variable %T[98]%
 
// merge both variable %T[97]% and %T[98]% to %new_line%
trigger the same behave like pressing < Enter > on keyboard
Variable Set String %new_line% to "%T[97]%%T[98]%"
 
// Save all content in string variable %full_uncut_content_clipboard%
Variable Set String %full_uncut_content_clipboard% from the clipboard contents
// Now, the content from clipboard is in string variable %full_uncut_content_clipboard% but how we get it into T[x] variable ?
// With "Split String" ... (Variables - Split String)
Split String "%full_uncut_content_clipboard%" on "%new_line%" into %T%, starting at 1
// We say: Split String %full_uncut_content_clipboard% on every end of line %new_line%
 
// And put them into %T% variable beginning with %T[1]%
continue with %T[2]%, %T[3]% untill all data is split
 
// Now you can do the 2nd job
Variable Set String %T[20]% to "Tata"
Variable Set String %T[21]% to "Toto"
Variable Set String %T[22]% to "Titi"
// Now we bring it into the correct order
// Remeber:
%T[1]% = Maggie
%T[2]% = Yubie
%T[3]% = Ned
%T[4]% = Rufu
%T[5]% = Lily
Text Box Display: Show all Names

 

 

You learn faster when you try out some thinks. So see this is a special case.

Welcome to Macro Express Pro

 

Look_Up

 

Hi again,

 

Your script is not dynamic. I want it to saves the name list in the order of the clipboard, and not with a previously defined order. And the lines to remove "Tata Titi Toto" can be other ; I want the script deletes all the names that are not in the first list.

 

I search because it's funny, but I think I will not find alone.

 

I learnt <SPLIT STRING Source="%full_uncut_content_clipboard%" SplitChar="%new_line%" Dest="%T%" Index="1"/>

It's very good.
Now I just need a function to keep only the names in bold, before putting them in T variables (because I need them to be in T1 T2 T3 etc. and not T1 T4 T5 T7 for exemple) :
Rufus
Maggie
Yubie
Tata
Ned
Toto
Titi
{other random lines}
Lily
Link to comment
Share on other sites

Please STOP FULL QUOTE from my post !!!

 

Whatever you want to try... Now you know how to get content from clipboard to a variable. Try thinking yourself.

 

You can create your own variables and copy one value to another with "Variable modify string" (Copy Whole Text)

 

 

In other case you should tell me exactly what you want to do. Is the second list also in clipboard ? In which order do you want sort the list ? Which person has a higher priority ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...