Jump to content
Macro Express Forums

If A And B And C Exist ?


koden

Recommended Posts

I have some mails that all look like this:

 

- Job : WIXAFL1M

- Owner : 8780 CSC.CPH.CSS.SC.TRF

- code : S222

- Stepname : STEPUC

- Procname : PS1

- Jobnumber : JOB04777

- Application : AIOKDK10A

- Workstation : IXA1

- Operation text : uc job mod xapta

- Start Time : 00.15.13

- Stop Time : 10.29.50

- Date : 07-03-2006

 

I copy job: WIXAFL1M to T1

I copy code: S222 to T2

I copy date: 07-03-2006 to T3.

 

The next mail can have diff. job,code or date.

 

If the job,code and date in the next mail ALL 3 are the same as in the first mail, the mail has to be deleted, and macro should go to next mail.

 

If one of the 3 parameters is diff. in mail 2 as in mail 1, the macro should go on.

 

Until now i have not have date in the macro. Only job and code.

I copy the job and code to T1 and T2 and paste them to notepad.

Then I copy the content of notepad to T9 and in the next mail I check if T1 AND T2 are in T9.

BUT this is not working, because if:

 

mail 1 has job: A and code: 1 (put in my notepad)

mail 2 has job: A and code: 2 (put in my notepad)

mail 3 has job: B and code: 2 (put in my notepad)

mail 4 has job: B and code: 1

 

Then mail 4 will be deleted, because notepad (T9) has a B and a 1.

 

So I have to put T1,T2 and now date T3 together, and in the "next" mail check if T1,T2 and T3 are matching T1,T2 and T3 from the first mail.

 

But where can I save the 3 variables together and make a matching check on them?

Is excel a possibility, because it has fields that are numbered???

 

There is more in this Thread if you don't understand me:

 

http://pgmacros.com/community/index.php?showtopic=990

Link to comment
Share on other sites

In a single text variable you need to store each unique combination of job, code and date, delimited at each end with a unique character. Then present your new data, also delimited with the same unique character, and look for a Contains.

 

Here's an example:

After a few mails, T1 looks like this (I use / as my delimiter):

/Job1,Code1,Date1/Job1,Code1,Date2/Job2,Code1,Date1/

 

The new mail has Job1, Code1, Date1 so we look to see if T1 contains

/Job1,Code1,Date1/

It does, so this mail is deleted

 

The next mail has Job1, Code2, Date1 so we look to see if T1 contains

/Job1,Code2,Date1/

It does not, so this mail is accepted

Link to comment
Share on other sites

Thanks...

 

There is a little problem I think.

If i copy this to my T variable, it has to remember it the hole day, så taht it can compare data from each mail.

 

But will the T variable not be empty when the macro has finished??

 

I run the macro many times a day.

 

So maybe I still should use my notepad document and delimited with / at the end ?

Like this:

 

Notepad:

 

/Job1,Code1,Date1/

Job1,Code1,Date2/

Job2,Code1,Date1/

 

Does it have to be in one line or can i make new line between, as shown over here.

Link to comment
Share on other sites

I have looked at it. maybe I don't understand it fully.

Here is how I understand:

 

 

 

I use text type to get it to my notepad (the empty notepad starts with / ):

 

copy job1 into T5

copy code1 into T6

copy date1 into T10

 

 

text type: %T5%,%T6%,%T10%/

 

This will give a notepad that lokks like this:

 

/job1,code1,date1/

 

After some mails without same contains it will look like ex. this:

 

/job1,code1,date1/Job1,Code1,Date2/Job2,Code1,Date1/

 

At each mail I start with copy the content of notepad into T9

Then I:

copy job1 into T5

copy code1 into T6

copy date1 into T10

 

make an IF statement that says:

 

IF variable T9 contains variable T5

AND

IF variable T9 contains variable T6

AND

IF variable T9 contains variable T10

 

Delete mail.

 

 

BUT as I write this, I can see the problem :-))

I can't do this. I have to copy T5,T6 and T10 into a new variable like T12 and compare T9 with T12.

 

When I copy into T12 I have to make the / and comma

 

 

But I'm not sure how to copy into T12 and put / and , on

 

As you write I can copy job,code and date directly into T12....But how...??

 

I get clever and clever as more I write :-))

 

This is proberly what you mean:

 

copy job to T12 and then copy code to T12 and then copy date to T12

(i just don't know about / and ,).

compare T9 (from notepad) with T12

Same same...delete mail else paste T12 to notepad.

 

 

 

Soething that wonders me is how the macro can compare only between / and /.

And why do I need comma ??

Link to comment
Share on other sites

Notepad:

 

/Job1,Code1,Date1/

Job1,Code1,Date2/

Job2,Code1,Date1/

 

Does it have to be in one line or can i make new line between, as shown over here.

It's not clear to me why you keep referring to Notepad - as far as I can see, it's irrelevant to your problem. And if you insert a new line between different combinations of Job, Code and Date the process will simply not work.

 

Here's what you should do:

 

1) Start with an empty file somewhere, e.g. C:\Mypath\UniqueCombinations.txt, and read its contents into T1

 

2) Get a mail, and place into T2 "/" (without the quote marks), the email job (which is preferably always the same length - you can pad it out with blanks to make it so) followed by a comma, the email code (again preferably a uniform length) followed by a comma, and the email date (uniform length and format) followed by "/"

 

I use commas to help you understand the meaning of any given string simply by viewing it

 

3) Check if T1 contains T2 (it won't, because T1 is currently empty). Process the mail because it's unique. Append T2 to T1 (use the Variable Modify String - Append Text command with %T2% as the text to append, OR the Variable Set String command with %T1%%T2% as the initial value)

 

4) Continue until you've processed all messages; don't append T2 to T1 if the job/code/date combination already exists

 

5) When you've completed the current batch of messages, replace C:\Mypath\UniqueCombinations.txt with the contents of T1 (Variable Modify String/Option 2/Save to Text File)

Link to comment
Share on other sites

Thanks again...

 

Step 2 is my problem. the rest i think I have understand.

 

Specially how i copy the job,code and date into same variable (you wrote: Get a mail, and place into T2, job code and date separatet by comma).

 

If i copy job into T2 and after this code into T2, then job will be gone???

Or is it first to be set into C:\Mypath\UniqueCombinations.txt and then copy to T2 ?

 

proberly I'm on a lover level than you think :-))

 

Ps. What I mean with notepad ??? proberly the same as you with the C:\Mypath\UniqueCombinations.txt.

"A comparing document" ???

 

I will try to explain how I understand it now:

 

START:

copy content of UniqueCombinations.txt to T1

open mail

copy >job,code,date/< into T2 (this I can't understand how to do).

Check if T1 contains T2 (if: delete mail. If not: proceed)

Append T2 to T1 (if T1 did not contain T2 else append nothing)

After have running ex. 10 mails, then append T1 to UniqueCombinations.txt and save it.

END:

 

Go back to start and run when next mails arrive.

 

You have helped a lot. Thanks...

I will make a new question about how to fill up T2 with more than one copy.

Link to comment
Share on other sites

Cyberchief have now explained so I can understand it :-)

Thanks to booth of you....

 

 

// Set T10 to "comma space"

Variable Set String %T10% ", "

// Copy your first text and set to T1

Clipboard Copy

Variable Set String %T1% from Clipboard

// Append T10 to T1 to be "Text, "

Variable Modify String: Append %T10% to %T1%

// Copy next set of text

Clipboard Copy

Variable Set String %T2% from Clipboard

// Append new text to T1 (will now appear as "Text, NewText"

Variable Modify String: Append %T2% to %T1%

Variable Modify String: Append %T10% to %T1%

// Repeat Append T10 to T1, Clipboard copy, save to T2, Append to T1 as many times as needed.

Link to comment
Share on other sites

Do I need delays between variable set and modify??

And do I need to empty T2 before copy new data into T2?

Sometimes I run macro in a higher speed than 1 to 1.

 

LATER TODAY:

 

I have tested and it seems not to be.

No delays and don't empty T2

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...