djashdj
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by djashdj
-
-
Alright... i'm looking for some pro assistance on this basic problem.
I've got a text file I want to process. It is a running log accessed by another application. When key words appear I want specific commands to occur.
The log file from the other application does not clear itself. It also is held active by the application. So I start my macro by copying the file to another name.
LOGFILE.txt becomes LOG2.TXT. In summation the basic idea of the macro is below.
copy file logfile.txt log2.txt
I process log2.txt
if variable t1 contains "xyz"
text box display "it works"
end if
end process
delete file log2.txt
Meanwhile the LOGFILE.txt continues to grow with new data. When I run the macro again it processes the entire log file.
What I want it to do is process the last LINE of the log file. The log file is not a CSV, or TAB delimited file. It's essentially a basic text document... that is... SPACE delimited.
What I'd love to do is take the last line and enter EACH space delimited section into a T1, T2, T3 variable. So if the text file looked like this:
Hello My Name Is Julio123
My Brain hurts because I have too many pets.
If my macro is searching for BRAIN it will work. But as time goes on there may be more lines and the macro will look like this.
Hello My Name Is Julio123
My Brain hurts because I have too many pets.
Since yesterday I got a new job.
Now the macro will still trigger but I don't want it to. I want it to only process the LAST line or Row.
Ideally placing each word into a different %T%.
About 11 years ago I was using macro express do do this. I remember putting the entire line into a string. I can't for the life of me remember how I did this and of course I don't have my old macro.
Anyone have any ideas?
text file and variable assistance
in Macro Express 3.x
Posted
In order to get it to only process the last line of the text file here is what I've done.
begin file process
variable modify integer: %N1% = %N1% + 1
end file process
begin file process start at N1
end file process
So basically it runs through the file increasing the line count then i process the same file again only this time starting at the last line.
Hopefully this doesn't get too slow as the file gets large. (few megabytes probably) If anyone knows a more efficient way to just read the last line I'm all ears.
Also a way of getting space delimited fields as mentioned in the first post to T1 T2 T3 etc that would be great.
Thanks!
-d