Jump to content
Macro Express Forums

ehercun

Members
  • Posts

    23
  • Joined

  • Last visited

Recent Profile Visitors

121 profile views

ehercun's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. So it appears that it was a bug Bob. Strange that no one else has noticed it. Don't people use arrays?
  2. Hey Bob, Haha, I actually JUST emailed them. Again, I was hoping that I was missing something stupid, but once AGAIN, it appears to be more complex. Thanks for your time either way.
  3. I've even "stepped through" and watched how the variables changed through the macro and it seemed like the macro completely disregarded the condition in the IF statement and wrote to the file anyway. I've tried messing with different conditions just to play around with it and it seems that the IF statement completely disregards what I'm telling it to do!
  4. Yes, I am clearing (and saving) the output file before each use. Otherwise, it appends the results to the end of the text file.
  5. Hey Bob, Thanks for the reply. I am aware that it's not the same as removing all duplicates, and I didn't mean to use the word sort. Process is probably a better word. The logic seems fine which is why I do not understand why it's not working. Regards.
  6. Bob, That worked beautifully! I feel like I'm actually slowly progressing toward my goal (and learning on the way of course!) thanks to you guys. Well, surprise, surprise, I ran into another problem. I was attempting to sort my text file to rid it of any consecutive duplicates (ie. if consecutiveEntry <> previousEntry copy to text file, counters++) and it turns out that after running the macro, consecutive duplicates remained. Here is the code: <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CRLF%"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%LF%"/> <GET CONTROL Flags="1" Program_Name="NOTEPAD.EXE" Class="Notepad" Title="MyStrat.txt - Notepad" Control="\"Edit\",\"1\"" Variable="%C1%" Caption="MyStrat.txt - Notepad" Partial="FALSE" Wildcards="FALSE"/> <GET CONTROL TEXT TextVar="%Test2%" ControlVar="%C1%"/> <SPLIT STRING Source="%Test2%" SplitChar="%CRLF%" Dest="%Log2%" Index="1"/> <GET ARRAY LENGTH Array="%Log2%" Dest="%ARlength%"/> <VARIABLE SET INTEGER Option="\x00" Destination="%counter%" Value="1"/> <VARIABLE SET INTEGER Option="\x00" Destination="%counter2%" Value="0"/> <GET CONTROL Flags="1" Program_Name="NOTEPAD.EXE" Class="Notepad" Title="temp1.txt - Notepad" Control="\"Edit\",\"1\"" Variable="%C2%" Caption="temp1.txt - Notepad" Partial="FALSE" Wildcards="FALSE"/> <REPEAT UNTIL Variable="%counter%" Condition="\x04" Value="%ARlength%"/> <IF VARIABLE Variable="%counter%" Condition="\x00" Value="1" IgnoreCase="FALSE"/> <VARIABLE MODIFY STRING Option="\x12" Destination="%Log2[%counter%]%" Filename="C:\\Users\\Eugene\\Desktop\\temp1.txt" CRLF="TRUE"/> <ELSE/> <IF VARIABLE Variable="%Log2[%counter%]%" Condition="\x01" Value="%Log2[%counter2%]%" IgnoreCase="TRUE"/> <VARIABLE MODIFY STRING Option="\x12" Destination="%Log2[%counter%]%" Filename="C:\\Users\\Eugene\\Desktop\\temp1.txt" CRLF="TRUE"/> <END IF/> <END IF/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%counter%" Value1="%counter%" Value2="1"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%counter2%" Value1="%counter2%" Value2="1"/> <END REPEAT/> To make it easier for testing, here is the list of items in my text file to be sorted. cby cake ads bec ilmn etp etp tk smi oii tif tre dps slab tre rdy chs chs chs chs fhn tk tk ctxs ctxs ctxs tk fst mir axs axs car fhn dnr cby tk axs smi cby utiw exr Is it just me or is ME a bit slow at processing bigger arrays when compared to other languages? I might be able to keep my array rather short by deleting all the entries in the original text file but I have to make sure that I don't lose any new data that's written to the text file in the process. On another note, should I even bother attempting to use a text file to create some kind of a FIFO buffer? The only potential problem that I can see is that Windows may not like one macro writing to the end of the text file, while another reads the beginning of the text file and subsequently deletes each entry after being "read" (I send each line being read to another program but this is not relevant for now). This would have been so much easier with PERL haha. Also, would anyone happen to know how to detect an empty entry in a string array so that I don't have to process the entire array? I tried using "" for my repeat until condition, but I could see under "show variables" that it still ended up processing the entire array even though only a tenth of the array was actually filled with entries. I must say that I really wasn't expecting my first macro to be THIS complex... Regards.
  7. I should also add that new entries are added to the bottom of the text file and sometimes, blocks of new entries are added at once. I should have also mentioned what it is that I'm trying to accomplish, and that is that I have to see if the newest line is not equal to the previous one. Which is all that I'm after.
  8. John, This text file is visible like you would be writing to it yourself. It seems that every time the program writes to the text file, the text file becomes "active" for a split second and then back to whatever program that was focused (selected in other words) beforehand. Haha, it just came to me right now that I could try to activate this macro based on a window becoming visible/focused; but I digress. Here's a sample of the entries: lvlt lvlt lvlt lvlt cby cby cby lvlt lvlt lvlt pde pde pde pde cby ilmn lvlt lvlt game swhc cby cby tk jdsu lava lava lava cby cby cby klic reg reg reg dltr cby life cell life mea mea pde pde pde alth oii tco tco There's probably several thousand of these new lines added per day. I would like to have as little delay as possible between a new entry being added and storing the entry in an array. Regards.
  9. Hi John, Thanks for your reply. A program is creating those new lines to the opened text file at random times. It sounds strange but that's what's happening and I really would like to be able to store each new line into an array. Hopefully I won't have to create a separate macro to save the file every few seconds and analyze the file itself. Regards.
  10. I'm trying to read all the text from an opened notepad file via controls and I'm running into some problems. I tried using the following code to get control of the notepad file, get control text, and then used the split string command on <Enter> to enter the text into an array. <GET CONTROL Flags="1" Program_Name="NOTEPAD.EXE" Class="Notepad" Title="MyStrat.txt - Notepad" Control="\"Edit\",\"1\"" Variable="%C1%" Caption="MyStrat.txt - Notepad" Partial="FALSE" Wildcards="FALSE"/> <GET CONTROL TEXT TextVar="%Test2%" ControlVar="%C1%"/> <SPLIT STRING Source="%Test2%" SplitChar="<ENTER>" Dest="%Log2%" Index="1"/> When I test run the code, then click "Debug" then "Show variable values", I only see the first entry in my notepad file in the variable Test2. However, for troubleshooting purposes, I tried separating each entry by a space and then I see all the values under Test2. Unfortunately, I am unable to change the way they are being entered into notepad. Is there any way to get ME to monitor when changes are made to the opened (not saved) notepad file on the fly and only then activate the macro? Or do I just have to run this every few seconds to see if anything has been added to the notepad file. Thanks!
  11. Oh and I'd like to add that when the entries are separated by spaces rather than <Enter>, then I get the entire list when I open "Show Variable Values". Why is that?
  12. Hey Cory, I hope you enjoyed your holidays. Anyway, I tried your code to get control of the notepad file, and copy the text from the notepad file. I test ran the code, then clicked "Debug", "Show Variable Values" and I only see the first entry of the text file (which has several hundred entries). Any ideas? Perhaps I am not using an array.
  13. Sounds good. I have already sent the email to you guys (probably around 1:20pm pacific). Looking forward to your reply. Thanks!
  14. That's alright. Thanks for getting back to me anyway. I was hoping that I was doing something wrong but it seems that the problem is a little more complex. Should I still post this topic in the Pro forums? Regards.
×
×
  • Create New...