Jump to content
Macro Express Forums

Need Copy/paste Help


koden

Recommended Posts

hello

 

I have 2 programs + notepad.

In the program A i get mails with inf. I have to copy and paste to fields in

program B.

 

The inf. I have to copy looks like this:

 

BALPSTN

U24722

32992 firstname lastname (sometimes a middle name)

Service Center

44202020 lokal 0

 

I copy this (all in one copy) from the fprogram A to notepad and then I first copy

line 1 to program B, back to notepad and copy line 2 to program B.

this is a lot of jumping from window to window.

But it works...

 

My problem is the middle name.

Sometimes there are a 3 field with middlename.

 

Can macro express see if there in line 3 are 3 or 4 numbers/words???

 

Hope yoy understand...

Link to comment
Share on other sites

Okay...

I have looked in help.

But i'm not sure what i need to use

 

control or variable???

 

I would like to copy 5 words from one program and put them into another program one by one.

But how do i put the 5 copys into 5 variables/controls and then paste them out again one by one???

 

I think I need something like this:

 

tab to the field i will copy

ctrl+c

put in variable T1

tab to next field

ctrl+c

put in variable T2

do this 5 times i get T1 to T5

 

activate program B and ctrl+v T1 to T5 in the right places...

 

But how do I do this ????

Link to comment
Share on other sites

Your description sounds very close. However, you will not be able to use Ctrl-v to post the data because the clipboard no longer contains what you need. Just 'Text Type' the variables containing the data. Here it is in macro commands:

// Activate the application you are copying from

// Tab to the first field to copy from

 

// Copy to the clipboard

Text Type: <CONTROL>c

// Put content of clipboard into a variable

Variable Set String %T1% from Clipboard

 

// Tab to the next field

Text Type: <TAB>

// Copy to the clipboard

Text Type: <CONTROL>c

// Put content of clipboard into a variable

Variable Set String %T2% from Clipboard

 

// Repeat as needed but change the variable you copy to

Text Type: <TAB>

Text Type: <CONTROL>c

Variable Set String %T3% from Clipboard

 

Text Type: <TAB>

Text Type: <CONTROL>c

Variable Set String %T4% from Clipboard

 

Text Type: <TAB>

Text Type: <CONTROL>c

Variable Set String %T5% from Clipboard

 

// Activate or launch the program where you want to put the data

Activate or Launch: "notepad" OR "notepad.exe"

 

// Change the following to put the data into the program in whatever order you need ...

Text Type: %T1%<TAB><TAB>%T4%<ENTER>%T2%<TAB>%T3%<TAB><TAB>%T5%<ENTER>

Link to comment
Share on other sites

YES....working fine..THANKS!!!

But of course I have got another problem :-)

 

I have copyed a line into notepad with this information:

 

11111 firstname middlename sirname

 

The numbers is the employe number.

The person sometimes don't have a middle name:

 

11111 firstname sirname

 

I have to copy this 3 or 4 inf. into the T variables.

But i get a problem when there is no middlename.

 

I will explain with an example:

 

I copy the first 11111 into T1

Then I copy the first name into T2

Then i copy the middle name into T3

and last the sirname into T4

 

But when the person has no middlename, then the sirname will be copyed to T3

 

Thats bad because when I paste the T variables in my other program, then the wrong inf. get to the wrong fields...

 

Do You see/understand what i meen???

Any idea to how I fix this?

 

My own suggestion is:

If the macro in some way can see/test if there in the line is 3 or 4 numbers/word, then it could be fixed. Is that possible??

Or any bether ideas??

Link to comment
Share on other sites

maybe the solution is to check how many blanks/spaces there is between each word/number ????? Can makro express do that??
Macro Express has an extensive list of Variable commands. You can use the Variable Set String and Variable Modify String commands to do this.

 

However, I would take a different approach. Before you 'read' the values into the variables, make sure you clear the variables T3 and T4

Variable Set String %T4% ""
Variable Set String %T3% ""

Then you can do something like this:

If Variable %T4% = ""
 Text Type: <TAB>%T3%
Else
 Text Type: %T3%<TAB>%T4%
End If

Link to comment
Share on other sites

It's working. i use different T variables as first writed. but hope you understand anyway.

 

BUT....

 

 

 

username

user number

first name

middle name (when no middle name this is last name)

Last name (when no middle name this is blank).

phone number

 

I copy phone number to T1 and so on until username into T6.

But my problem is that when there is no middle name, T2 is just a blank.

But when i paste T2 it is making a line shift???

 

So if there is a middle name it looks like this, if i copy and paste in notepad:

 

First my macro copy this into T1-T6

 

username

user number

first name

middle name

Last name

phone number

 

Paste from T1 to T6 gives this:

 

phone number

Last name

middle name

first name

user number

username

 

Thats okay and works.

 

But when there is no middle name notepad looks like this before copy into T1-T6.

 

username

user number

first name

Last name

 

phone number

 

And this is what comes out of pasting T1-T6:

 

phone number

 

 

Last name

first name

user number

username

 

 

As you can see there is 2 blanks after phonenumber.

It's proberly because the ctrl+c copy a blank and see it as a line shift.

But what can i do about that?

 

My test macro is attached

Cursor start position is under phone number left.

testmacro.mxe

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...
×
×
  • Create New...