Jump to content
Macro Express Forums

Repeat Until does not recognize text


sunilvedula
 Share

Recommended Posts

HI All,

 

stuck with something imp . my loop when i use repeat until does not work. i am giving the code, if any ideas pls forward. I tried for around 5.5 hrs unable to resolve it. Also converted the text to ascii but still did not work. I have initally tried saying Repeat until T1="ORDLTR" it was copying that text and going down without stooping. Can anyone help me out

 

<TEXTTYPE:<SHIFTD><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><SHIFTU>><MSD:500><CLIPC><TVAR2:01:03:><TMVAR2:01:01:00:000:000:><ASCIIV:2:0:1>
<REP3:06:000001:000002:0002:0:01:79><TEXTTYPE:<ARROW DOWN><ARROW DOWN><ARROW DOWN>><MSD:500><TEXTTYPE:<SHIFTD><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><SHIFTU>><MSD:500><CLIPC><TVAR2:01:03:><TMVAR2:01:01:00:000:000:><ASCIIV:2:0:1><ENDREP>

Link to comment
Share on other sites

What the heck are you trying to do? What application are you working in and what are toy trying to accomplish.

 

You use N2 for ASCII value but I only see this used for the exit of the loop. But here you're exiting if it equals 97 which is "a". If you are searching for something that begins with "a" why don't you just use "a" for comparison?

 

Also if you're plowin thru a large block of text like in Excel why don't you copy the entire thing first and do all the rest in memory?

 

BTW, if you are using Excel check out F5 for selecting cells.

Link to comment
Share on other sites

Hi cory,

 

i am sorry if it got u confused. i am working on a mainframe sessions. i have an number (approx 4000 numbers/accounts)) in an excel sheet. with that number i need to pull some cased ids in the sessins. i do an a command in sessions (ifnd) which takes me to those case ids. now i need to locate the case id which has the name "ordltr". what my macro does is that it copies the "ordltr" onto a clipboard t1. NOw i was asking to compare if t1= "ordltr". if not to go to the next case id and do the same until it finds. Once it finds i want it go to the left of the screen (for which i used arrow left) to copy the case id where the ordltr is found. NOw the case id which it copied it has to go to excel and paste the id next to the number it copied.

 

what i have written is

repeat until t1="ordltr"

texttype <arrow down> <arrowdown> arrowdown>

select the case id shiftd<aroow riht> <arrowright> etc...

clipboard copy

save the variable to t1

repeat end

 

then i asked to copy the case id by going left in session and then go to excel and paster beside the number.

 

this one did not work because it went on repeating in the loop.

 

i also tried using t1<>"ordltr" thinking maybe the logic was not right. then it was copying the next case id but not the one beside the ordltr. it was going one step down and copying.

 

then i tried to convert the ordltr to ascii which gave me 79 and i asked to do the same then it was copying the next case id but not the one beside the ordltr. it was going one step down and copying.

 

 

i need to get it done by today EOD. see if you can reply fast as i am waiting for your guidance.

Link to comment
Share on other sites

You might want to try replacing the Clipboard Copy command with a Text Type of <CTRLD>c<CTRLU>. We're not quite sure why but some programs don't like the Clipboard Copy command.

 

Another thing that happens with MS Office programs, including Excel, is that you copy something like 'ordltr' to the clipboard but the clipboard contains 'ordltr<CR><LF>' (CR = Carriage Return, LF = Line Feed). So you may have to use a Variable Modify String: Strip CR/LF from %T1% command after your Variable Set String %T1% from Clipboard command.

Link to comment
Share on other sites

Hi Kevin,

First of all thanks for that input. IT worked. Now comes the issue. i changed the system and used the macro with the same logic it doesnt work. it makes no sense to me. i will be testing on other system to check if it is that kind of issue. i am surprised and confused. i used the Variable Modify String: Strip CR/LF from %T1% and it did work but when changed the system it gives error. Can u help me understand!:(

Link to comment
Share on other sites

Then you should hire me post haste. :) Seriously I wish I had more time but I have things I need to get done today. Having said that paying customers always are prioritized before volunteer work...

 

First off the ASCII command you use is designed to convert one letter to it's ASCII value. If you try to convert a string with multiple charcters I think it only returns the ASCII decimal value for the first character. So "allen" and "adam" will appear the same in your If test.

 

Now if I were you I would not use Excel but rather CSV or better TSV files and the ASCII or Text File Process command. You will need to take about 5 minutes to learn it but once you do you will realize a huge benefit that will reap instant rewards. Also I would output the results to a TSV file as well instead. Again it takes a few minutes to understand it but once you do you will realize it's a far superior way to accomplish the task. If you are interested start by looking at the help for these commands and I'll explain how you can create these as your output as well. I think you have Joe's book as well? He has a good writeup there. Also check out my page with the section on Tab CRLF and Hex editing.

 

How this would work is you would use the TSV file as a list of account numbers and each repeat will pick up the next number in the var. Then you look it up in your terminal emulators, grab what you need, and push it back out to a results TSV or even simple text file.

 

I'm guessing you're using a terminal emulator? The last bank I was working with was using a TE to access the mainframe and we simply polled the entire screen with a CTRL+A and parsed out the data we needed. Worked slick and fast especially since we didn't have to keep switching back to Excel.

 

You know I was thinking of creating a simple macro to demonstrate how to do this. Hmmmm.... perhaps now is the time...

Link to comment
Share on other sites

Not without more or clearer information. Give us something to go on.

 

 

hi kevin,

 

i find this stupid but alas! that is what happened. i changed the computer from one desk to another. the logic i wrote

 

repeat until t1="ordltr"

texttype <arrow down> <arrowdown> arrowdown>

select the case id shiftd<aroow riht> <arrowright> etc...

clipboard copy

save the variable to t1

repeat end

once it finds the ordltr it would just copy the adjacent case id and go to excel and paste it else it would go on searching for the ordltr.

 

i used strip cr/lf for the variable and it worked. as i said when i changed the computer (i went to another desk) IT DOESNT WORK.

 

let me give u another example. in another project of mine i was copying data from e-champs(application of ours) and one particular data it was copying but was not inputting in excel. i found this funny and absurd as it worked last time.

 

so i checked in another computer and to my surprise it did work. what makes these thing happen like this.

 

?????? :angry::(

Link to comment
Share on other sites

Then you should hire me post haste. :) Seriously I wish I had more time but I have things I need to get done today. Having said that paying customers always are prioritized before volunteer work...

 

Hi cory,

 

you are as usual wonderful. i wish i could hire you than ask u for simply advice. i need to wait a little more time till i get that official authority to be able to pay or else get a hike (or promotion which is due).

 

Now if I were you I would not use Excel but rather CSV or better TSV files and the ASCII or Text File Process command. You will need to take about 5 minutes to learn it but once you do you will realize a huge benefit that will reap instant rewards. Also I would output the results to a TSV file as well instead. Again it takes a few minutes to understand it but once you do you will realize it's a far superior way to accomplish the task. If you are interested start by looking at the help for these commands and I'll explain how you can create these as your output as well. I think you have Joe's book as well? He has a good writeup there. Also check out my page with the section on Tab CRLF and Hex editing.

 

How this would work is you would use the TSV file as a list of account numbers and each repeat will pick up the next number in the var. Then you look it up in your terminal emulators, grab what you need, and push it back out to a results TSV or even simple text file.

 

I'm guessing you're using a terminal emulator? The last bank I was working with was using a TE to access the mainframe and we simply polled the entire screen with a CTRL+A and parsed out the data we needed. Worked slick and fast especially since we didn't have to keep switching back to Excel.

 

You know I was thinking of creating a simple macro to demonstrate how to do this. Hmmmm.... perhaps now is the time...

 

will try to understand the funcitonin of CSV or TSV. JOe's book has not still reached me. waiting eagerly for that. but if you see my early post u will understand where i am stuck with. and as u said it is true that converting to ASCII doesnt help much here.

If u have time look into the post and advice (will pay u later once i get my dues; :lol: )

 

 

But guys on a serious note i am indebted to all of you for ur help withut which i would not have reached where i am today. thanks for all .

Link to comment
Share on other sites

hi cory,

 

it is of great help and i cant tell u how imp it is. it jsut changed the way i look at it. Few doubts:

how many cells or number can it process and store at a time.

can i process a txt file containg 1000 number /accounts or what is the max limit for the tsv file. now i can accomplish huge tasks with ease. thanks for ur tutorial. it was GREAT!

 

NEXT is the problem with the repeat until is not resolved. we have screen like DOS which work on mainframes and we call them sessions or pega.

 

now when i input the account number and if the account number is found (assume) then it has to search for ordltr and then copy the case id adjacent to it and paste it. i tried various options as i mentioned earlier. strip cr/lf worked fine but alas! it didnt when i changed the computer (used on another system). i will try again and let u knwo the result asap.

Link to comment
Share on other sites

how many cells or number can it process and store at a time.
Millions, I've never hit a limit. I routinely process files with 30k lines with no problem. But if you run from disk as opposed to memory like I mentioned you might notice slightly slower performance. If you use ASCII File Process you are limited to 99 variables which limits the maximum number of columns but when they get more than 10 columns or so I use the tab eater method I mentioned which is practically unlimited.
or what is the max limit for the TSV file
Your hard drive size I suppose.

 

When I work in terminal emulators or command prompts that don't have 'controls' I usually do a screen cap or have the TE dump the screen to file. For instance I send the account number and I keep polling the screen ever second. By that I mean capture or read from file until some indicator, often a status line in the display, satisfies a condition. Lets say the status line at the bottom that literally contains"Status:processing" and changes eventually to "Status:Ready". If the poll variable is T1 I keep testing by doing Repeat until T1 Contains "Status:Ready" with a one second pause inside. This is how to effect flow control. Once I get to the screen I need I extract the contents. Depending on the terminal emulation this is often a fixed number of characters in. For instance most are 80 char so lets say it always appears in the same place on the screen 20 in on line 12. Each line is 80 char plus 2 for CRLF so 82*12+20=1004. So I Copy Part of Text 8 chars or whatever at position 1004. But if the number isn't consistent I will instead look for the position of a label like "Order Number:", adjust for the beginning of what I want, and save that to N1 and do the same Copy Part of Text.

 

If you can show me a screen shot of what you have making sure not to include sensitive data I could probably help you more.

Link to comment
Share on other sites

hi cory,

 

i will try to send you some screen shots. what have i done is i captured around 4000 acccounts which were to be processed and the result to be found (case ids) captured in MESample. passed it tosamplesource. then made it process. it is being processed for 11hrs. today when i get back to office maybe i will get the result. will let u know today once i am in office.

Link to comment
Share on other sites

Here's another 'trick' I learned. Initially my impulse was to do everything in one big macro. Later, due to inevitable glitches and such, I learned to break it into stages. So, for instance, I might have one macro that snatches the screen capture and dumps it into a text file with the account number in a folder. Then I might have another macro that parses those files and yet another that runs off and does something with the parsed information. This also allows more than one machine to run at the same time as well as isolating problems. Also you can have Macro 1 running while you develop macro 2.

 

If you're doing a lot of records and you have access to more than one computer you might consider parallel tasking. I once wrote a harvesting macro that ran on several machines at many different locations and coordinated their work thru FTP. You see I had a deadline and after I did the initial macro I did the math and realized I was going to be short about 3 days! So to cut the time I ran it on several machines. Worked great.

 

Oh, here's another trick. If running unattended I add little emails to myself of progress and such. But what if the macro halts because one time it couldn't find C1? Well I set the option to clear error messages after 10 seconds and then have a macro that scheduled to run every minute that takes a screen shot and emails it to my email account and sends an SMS message to my cell phone. Oh, and disables itself or hits a pause. If it's a huge macro with thousands of iterations it should run for a long time preventing any other macro from running. So if the other macro is allowed to run then that means the first one blew up. This way I know right away if I have a problem instead of hours later when I check myself.

Link to comment
Share on other sites

Here's another 'trick' I learned. Initially my impulse was to do everything in one big macro. Later, due to inevitable glitches and such, I learned to break it into stages. So, for instance, I might have one macro that snatches the screen capture and dumps it into a text file with the account number in a folder. Then I might have another macro that parses those files and yet another that runs off and does something with the parsed information. This also allows more than one machine to run at the same time as well as isolating problems. Also you can have Macro 1 running while you develop macro 2.

 

very true. will try to implement in those lines in future of my projects. will discuss in detail later.

 

If you're doing a lot of records and you have access to more than one computer you might consider parallel tasking. I once wrote a harvesting macro that ran on several machines at many different locations and coordinated their work thru FTP. You see I had a deadline and after I did the initial macro I did the math and realized I was going to be short about 3 days! So to cut the time I ran it on several machines. Worked great.

 

Need to learn still how to work through FTP. if i know will also help me a great deal as i am hadling 5-6 projectes in a day/month.

 

Oh, here's another trick. If running unattended I add little emails to myself of progress and such. But what if the macro halts because one time it couldn't find C1? Well I set the option to clear error messages after 10 seconds and then have a macro that scheduled to run every minute that takes a screen shot and emails it to my email account and sends an SMS message to my cell phone. Oh, and disables itself or hits a pause. If it's a huge macro with thousands of iterations it should run for a long time preventing any other macro from running. So if the other macro is allowed to run then that means the first one blew up. This way I know right away if I have a problem instead of hours later when I check myself.

 

Cory i know of the option (i have seen it) of send emails but never used it. will try it . also just intereseted how do we send SMS to our phones (which if possible) will be of great help as u said.

 

Also cory the 11hr macro has run well without any erros and the result was delivered. it actually ran for more than 12hrs.

Link to comment
Share on other sites

I'm happy you are having success, congratulations. There is something very satisfying about making these boxes do some real work for us eh?

 

When you're ready for the FTP let me know and I'll give you some ideas on how to do it.

 

There are several ways to send yourself SMS (cell text messages) to your phone. There is software you can command, web portals and email. I like using email because ME has a nice little sendmail feature. Most cell phone companies have what they call email gateways for SMS and once you learn the convention you can address the email properly. For instance I'm with Sprint and the convention is [TelephoneNumber]@messaging.sprintpcs.com. Here's a list of common ones. Don't forget the limitations of SMS of course and try to send yourself a book.

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