Jump to content
Macro Express Forums

any way to process unlimited lines from text file


Recommended Posts

Hi,

 

I'd like to be able to process more than 100 lines from a text file. Is there a way to do that?

 

I'm using Text File Begin Process and Text File End Process.

 

My code right now is always referring to the first element in an array %T[1]% and as the code loops through, it seems to be consecutively reading each line of text from my data file into %T[1]% as desired and then the macro stops at about line 100 though there are more lines of data in the text file.

 

Could I just put the Text File Begin Process loop in another loop and have it continue through the file up to 100 lines at a time? (If there's a better way I'd like to know!) With this method would I just use a variable to set the "begin processing on record"?

 

Some more things I had questions about

 

My macro is going to be sending numeric data to a browser form and updating the form per number added. Is it worth using IE to get to check for the browser action being completed?

 

If my macro is clicking a button in a browser form, is there a way to make that step more certain, in case the button doesn't appear in exactly the same place each time the screen reloads? (The button is too many tabs into the screen to try to use tabs, I think.)

 

I do not have much experience with Macro Express in writing code type macros and none in the past few years.

 

Have a nice day

John

Link to comment
Share on other sites

I'm sorry--I didn't save my data file with the line that let me test over 100 lines of data and once I saved the file, the macro processed the entire 100+ lines, so that question seems resolved.

 

I'd still appreciate any answers or comments!

 

Have a nice day

John

Link to comment
Share on other sites

I highly recommend making separate posts for different questions.

 

As for the issue about the imitation of more than 100 lines there is none. If you have 1000 lines Text File Process will process them. Now are you trying to load an array? I can't tell exactly what you are doing. Please post a stripped down example of your code. I suspect you incrementing the array pointer and using the built in "T" variable. But until I see an example that mimics your code I don't want to waste time writing up all the possible solutions in my mind.

 

As for entering data in a web form you have just jumped into the deep end of the pool. One of the most daunting tasks in MEP is handling the timing and interaction with a web browser in large batches. But let's talk about that after we get your other problem fixed.

Link to comment
Share on other sites

Thank you for the responses. The project that I'm helping with is moving forward so quickly that the tast my macro was supposed to address is basically completed. My macro may have helped a co-worker get a revised version working better. So, I don't necessarily have to get this resolved--though I'd still be glad for the opportunity of learning. So, I will say that again :) This is not necessarily a "have to know"/"please answer" question, and my note is wordy :) I have not yet read the article that Joe mentioned, however, I plan to. Thank you. Here's my macro.

 

<GET CONTROL Flags="0" Program_Name="IEXPLORE.EXE" Class="IEFrame" Title="Web of Science [v.5.13.2] - Web of Science Core Collection Results - Internet Explorer" Control="\"\",\"Frame Tab\",\"Web of Science [v.5.13.2] - Web of Science Core Collection Results - Internet Explorer\",\"TabWindowClass\",\"\",\"Shell DocObject View\",\"\",\"Internet Explorer_Server\"" Variable="%C1%" Caption="Web of Science [v.5.13.2] - Web of Science Core Collection Results - Internet Explorer" Partial="FALSE" Wildcards="FALSE"/>
<MACRO PLAYBACK SPEED Speed="1"/>
<TEXT FILE BEGIN PROCESS Filename="C:\\Users\\j-fullerton\\Documents\\Macros\\data.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%T[1]%" _PROMPT="0x0003"/>
<WINDOW ACTIVATE Title="Web of Science" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<WAIT FOR WINDOW TITLE Title="Web of Science" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<DELAY Flags="\x02" Time="100"/>
<MOUSE MOVE Option="\x01" X="3037" Y="344" _PROMPT="0x000A"/>
<MOUSE LEFT BUTTON DOWN/>
<MOUSE LEFT BUTTON UP/>
<DELAY Flags="\x03" Time="100"/>
<TEXT TYPE Action="0" Text="<TAB>%T[1]%<TAB>%T[1]%<TAB><SPACE>"/>
<WAIT FOR WEB PAGE Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<WAIT FOR CONTROL Control="%C1%" Option="\x00" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<MESSAGEBOX Caption="Continue?" Message="Continue?" Icon="0"/>
<TEXT FILE END PROCESS/>

 

As, I said, I found that the command "text file" was actually working on an unlimited number of lines, so as far as I know, that resolved my main question.

 

As Cory said, the web automation was where I next began to find questions.

 

The macro as is was working well--the significant drawback was that because of timing issues, I had to add the messagebox button click (that let me "see" that the webpage button was in place before letting my macro continue) however that made processing each data file take more time and much more interaction. The macro without the messagebox seemed to be working acceptably well when I did a test case, however, when I signed on to the project user account, I wonder if timing got changed somehow, because I began to see timing errors before I added the messagebox.

 

I decided to use Internet Explorer for the benefit of "wait for web page". My co-worker (newer to Macro Express than me, yet advancing very quickly) said he thought Google Chrome was responding better to either this macro or a revised macro than Internet Explorer (and I wondered if Google Chrome could be emulating whatever "wait for web page" is checking, maybe a flag?)

 

The actual task was adding many items selected by number from a commercial library database search to a marked list. The marked list was accessed by clicking a web button, then a panel seemed to open with a few radio buttons, input forms, and buttons. As the web page refreshes flew by, it seemed to me that even though I was initially waiting for the starting button to be available (with "wait for control") however, that button was sometimes momentarily appearing not in its "official" or final location because a preceeding button in the form had not been drawn yet. My "wait for control" was just waiting for the button with its text label to be displayed--not yet trying to combine with wait for that button in the correct location (x,y coordinates). As I said, the project passed by the need for this to be resolved. (It was a fairly extensive task, if it had been addressed manually, however, I was out for 2 days, and the project went past the need for my macro).

 

My strategy for the next step was to use "wait for control" with the button text and then an additional "wait for control" with the x,y position. I don't know if I would have kept going with a pixel color check.

 

Have a nice day
John

 

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