Jump to content
Macro Express Forums

Les Hazlett

Members
  • Posts

    32
  • Joined

  • Last visited

Les Hazlett's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you both, MGuyM and Paul, for your helpful responses. Paul, I was wondering if the ME macro is actively looking for the semaphore flag. It seems that it would be. If so, does this cause any processor loading concern or is there some simple way to avoid this? Les
  2. Hi, I haven't posted for a long time. I have successrully executed other applications from ME, so I understand how to Launch Programs. What I would like to find out is if it is possible to interface to code written in other languages. I am considering an application in which I really need arrays, lists, indexes etc. It would be convenient if I could tie this application into an existing set of ME macros. Is it possible in Macro Express to call a procedure writen in a language like Python or VB, pass it parameters, and get parameters returned to Macro Express? I spent some time searching for various key words here in the Forum but found nothing close. Hope there is someone who has tried this before. Thanks, Les
  3. Is there a way to get a text file containing a list all the variable used in a macro? I need to go back and document all my macros. My latest macros have a variable map within the macro. After the last executed statement I created a list (using Remarks) of all variables used and how they are used. This may be a previously discussed item. If so I appologise I just don't have time to search the archives. I am leaving my company and trying to document a large collection of macros before I go. Using ME has been great. I've been inactive for several months but really benefited from this Forum when I was writing a lot of Macros. Thanks to all of you who helped me so much. Les Hazlett
  4. Randall, I would like to see your code, but as I said, I won't get to look at it for several weeks. Thanks, Les
  5. Joe, Thanks for your response. >>Also, can you post the native code of the example shown here? It might help. No one would want to look at the two huge macros I am integrating but here are the example commands. <IVAR2:05:13:98:%T13%><NMVAR:09:05:0:0000001:0:0000000><TMVAR2:10:95:98:001:N05:><NMVAR:01:05:1:0000005:2:0000002><TMVAR2:11:98:00:001:N05:> >>Do I understand that you are combining macros? There are no CR/LFs in native Macro Express code. What am I missing? When integrated into one job, the first macro runs the second macro. The CRLFs are in the data being processed, not in the ME code. When run separately, the first macro writes a CRLF delimited file and the second one reads it. I thought that it would be faster to leave the large text string in RAM than writing the file and reading it back with Text File Processing loop. It turned out to be slower. The strings are 2-5 megabytes. In a repeat loop, the five instructions that I posted do the eqivalent of the Text File Process instruction loop. It puts the data into T98, one line at a time, and deletes the line from the input string. Instruction 1 finds the position of the first CRLF. The text of the CRLF is held in a text variable T13. 2. Decrimenting N5 makes it point at the last character in the first line of data. 4. Increasing N5 by 2 makes it point to the LF so that the first line including the CRLF can be deleted by instruction 5. Oh how I wish there was a command for Text String Process. 1 Variable Set Integer %N5% with Postion of Text in Variable %T98% 2 Variable Modify Integer: Dec (%N5%) 3 Variable Modify String: Copy Part of %T98% to %T95% 4 Variable Modify Integer: %N5% = %N5% + 2 5 Variable Modify String: Delete Part of %T98% I don't understand how block deletion of the CRLFs would help me in any way. Randall responded with concurrance that the Text File Processing is faster for large strings. - - - I wonder if anyone else has any knowledge of this - either measured or anecdotal - - - - . Les
  6. Hi, I am in the process of integrating two macros. I assumed that it would be faster to work with the data from the first macro without writing it to a file and reading it back with the second. However, it seems that using Text File Processing is so much faster than manipulating the large string, that it is actually slower. Perhaps someone can advise. The data (file) structure is lines ending with CRLF. I replaced the Text File Begin Process/Text File End Process loop with a Repeat Until/Repeat End loop which works fine. I capture the lines with the following instructions: Variable Set Integer %N5% with Postion of Text in Variable Variable Modify Integer: Dec (%N5%) Variable Modify String: Copy Par of %T98% to %T95% Variable Modify Integer: %N5% - %N5% + 2 Variable Modify String: Delete Part of %T98% This works but is slower than writing and reading text files. Thanks for any help, Les
  7. Hi Randall, Yes - we use Tab delimited text strings/files mostly. After getting stuck with limited string sizes in the VB Quicksort method, we took another approach. This approach was easier because we didn't need a true sort. I just posted this macro as a separate topic - "ALMOST SORTING". We are delighted with this macro. It does what we need and it is very fast. It easily handled the "live" file that choked the VB Quicksort macro. Les
  8. Here is the ShowLineGroup.mxe file promised in the original posting. Les ShowLineGroup.mxe
  9. The PGMACROS.COM forum is a wonderful resource for learning to use Macro Express. We’ve gained a lot from the ideas and advice found there. We always wanted to give back something of value. Our new LineGroup macro works so well that we want to share it with other ME users. REQUIREMENTS At our company, we use ME to process text and database files. We needed a way to sort the records in these files. Our requirement is “almost sorting” - not really a sort. We need to group related records together. The order of the records within a group is not important. The order of the groups is not important. We call it “grouping”. DATA FORMATS The lines are records and the fields in the records are delimited with Tabs. The first field in each line is the “key” field. Our LineGroup macro re-orders the lines so as to group records having the same key field. GROUPING ALGORITHM The algorithm for this macro is “elegantly simple”. It mostly consists of two Switch/Case blocks, the second one inside of the Default Case of the first. As designed, it collects 30 groups per pass through the unsorted lines. The key fields are held in “Key” variables T21–T50. The grouped lines are held in “Line” variables T51-T80. The macro reruns itself recursively to collect all the groups, 30 in each pass. EXPLANATION OF MACRO For many ME users, the script may be easier to understand than the following explanation: -- In the first Switch/Case block lines are moved to the appropriate “Line” variable if their key is held in one of the “Key” variables. If not, control passes to the Default Case. In the second Switch/Case block a blank “Key” variable is found, assigned the key of the current line, and the line is put into the associated “Line” variable. When all the “Key” variables are in use, the current line is held in an excess buffer to wait for a later recursion of the macro. Lines with duplicate keys are added to the “Line” variables by the first Switch/Case block. Because blank keys are common, we made a special case for records with blank keys. They are grouped first before any groups with keys. PERFORMANCE To test the algorithm, we made the Switch/Case blocks only 5 groups wide (T21-T25 for “Key” variables and T51-T55 for “Line” variables). The execution speed was so fast that we have never bothered to make it any wider. As is, it groups 1,659 lines of ~ 600 characters per line in 10 seconds. There were 44 different “Key” fields in the test file, requiring nine recursions. In comparison, it takes ME 35 seconds to parse the original line format before grouping and 14 seconds to format the lines after grouping. MACROS ATTACHED The LineGroup.mxe file is attached. To demonstrate how it works, the ShowLineGroup.mxe file will be attached to the first reply to this message. It should be obvious how it provides the data and sets up the global variables needed by the LineGroup macro. The data in the ShowLineGroup macro is just for demonstration. It is not the “live” data used for performance testing. Both macros have lots of comments to help you understand how they work. Just run the ShowLineGroup macro to see both the un-grouped source data and the grouped results shown side by side. We hope that someone out there benefits from this very fast “Almost Sort”, we certainly have. We would also like to see the concept put to other uses. We welcome your comments and opinions. If, I am slow in responding to any replies, it is because I leave next week for a 3 week vacation. Happy Grouping Les Hazlett Automated Mailing Services Fargo, ND LineGroup.mxe
  10. I was so excited when I got my linesort macro running. Then I tested it on larger and larger data sets. It runs great (fast) until it gets too large a data file. Then, ME reports - "Macro Express Player has encountered an error and will be closed." I would have expected that it would slow dramatically if it needed to use virtual memory. I wouldn't have expected that it would blow its mind and wipe out ME. Does anyone have any idea what happened? I'm not sure what to report to help you determine the problem. I am running ME 3.5.0.1 under XP Pro - Media Center. My computer has 512 MB RAM and over 100 GB of open hard drive. This is rough but perhaps useful: Largest file to run was ~60KB. I was sorting ~290 lines that were ~330 characters long. It only took 5 seconds to sort. It failed with a file of ~120KB It failed again with a file of ~80KB Being able to sort is great, but how big a real job will I be able to sort? Les
  11. Floyd, Sorry that my response was confusing. Your macro runs correctly with ME version 3.5.0.1. The way it ran with the corrupted "repeat" statement was deceptive because the macro ran "except for repeating". You did a fine job of documenting both your ME macro and the VB script. The documentaion and your last message will be quite valuable to those of us trying to use Quicksort. I am deep into doing what you discribed - using default parameters. All was going very well until I developed a strange problem. I had removed much of the ME code and even put some of the defaults into the script. Now, for some reason it intermittently stalls in the Repeat Until %N1% <> %N1 loop after the Program Launch %T6%%T7%.vbs. Sometimes it works and sometimes it stalls. When it works the sort is correct. When it stalls, both temporary files are in the temp folder and they are correct. Once it stalls, it continues to stall until I clear out the temporary files that are left when the macro is aborted. Then it works again - once. Perhaps you have some idea how this could happen. If you can help, but this type of discussion is inappropriate for the Forum, please use my email - <lesjanehazlett@email.com>. I am temporarily running again "dangerously" by deleting the repeat loop and merely waiting indefinely for file ready. Quicksort is fast and it is great to have the ability to sort. Thanks, Les
  12. Thanks Floyd, After importing the MXE again all is well. The error was deceptive. The macro ran and performed as you described except that it didn't automatically repeat when finished. I can't even guess how it got messed up. Back to my study of your great macro. Les
  13. Sorting is a wonderful addition to Macro Express capability. Thanks Floyd for providing it. Now I must try to adapt it to what I am doing. I confess I am lost in your macro. I understand what you are doing in general but not some of the specific statements you use. I would like to discover the answers in the ME documentation and not ask "dumb" questions. But, I have tried and am stuck. If there is documention to answer my questions please point me to it. //Loop until user chooses to cancel Text Type: <REP3:08:000002:000002:0001:1:01:N1 Text Type: I don't understand what this does. When I run the macro, there is no user involved "delay" prior to the Variable Type dialog box. I don't understand how to execute commands such as a Repeat within a Text Type statement. I can't find anything about it in the documentation. // Reset variables that are to be reused. Text Type: <CLEARVAR1:T:1:2> Same problem. I don't know how to execute commands with a Text Type statement. I can use the CLEARVAR command from the Script Editor and it does what I expect. When I try to use this CLEARVAR1 command in a Text Type statement it doesn't clear T1 & T2 or do anything else that I can observe. Wonderful mysteries. Give me a clue and I will study further and learn to understand. Thanks again for the sorting method. I am anxious to make it work. Les Hazlett Fargo, ND "It's snowing snowing snowing snowing"
  14. We have a manual operation that we do all the time. It would be very valuable to find a better way. We currently FTP newly created files from PC workstations to one of four different folders on production equipment (multiple machines). It is easy to do. . Open the FTP application . Select the destination equipment . Select the target folder . Transfer the file . . Repeat the above for each new file and each machine that needs it. How good it would be if we could drag the file to a "Hot Folder" or icon that would trigger an ME macro to determine the machines that need it, the target folder, and make the FTP transfers. I know how to implement the ME logic and do the FTP transfers. I don't know how to do create a hot folder that would trigger an ME macro. I can't find anything about drag-n-drop to an executible macro (mxe). The solution may have more to do with Windows than with ME. Can anyone out there help me find a solution? Les
  15. Joe, With regard to your questions: 1. Yes, as you would expect, my XP Pro machine is NTFS formatted. 2. No, I don't need to send Zip files to any customers but I do need to receive them from a customer. The Zip files I receive are decoded properly with the built-in XP Zip support. However I still have the problem that I need to automate the processing of these files and don't know the best approach to get to the data with ME. Thanks, Les
×
×
  • Create New...