Jump to content
Macro Express Forums

Les Hazlett

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by Les Hazlett

  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
  16. Joe, Thanks for your response. I am using the built-in XP Zip support. The interface is strange but I never had any reason to look for other tools while doing this operation manually. Now I want to automate it. With manual operation the Zip "file/folder" operates like a folder. Double-click it and it opens to expose the zipped files. But ME sees the Zip "file/folder" as a file and doesn't allow folder operations. I see from a Google search "XP Zip" that there are methods to disable the built-in XP Zip support if using some other Zip program such as WinZip. What would you recommend?, looking for a solution with the built-in XP Zip support or using some other Zip program? Les
  17. I have tried and failed to use both file and folder commands on a .zip file. Is it possible to open a zipped file/folder and move an internal file from the zip folder to another location so that it can be processed? I know that I can open the folder containing zip file and and then mouse around until I get to the internal file. But, is there a better way? Oh yes - I am running XP Professional Thanks for any help. Les
  18. Noggin, I tried to run a macro that runs another application while the computer is locked. You were oh so right. The macro aborts when it tries to open the application and wait for it's window title. I definitely need a different strategy for running jobs on the off shift. If I can't run the macros that I need with the computer locked, I must find a way to keep it unlocked. Alternatives I can think of: 1. Keep the machine physically protected. 2. Run the macro on another machine that has no sensitive data. 3. Run the macro from a new user account that has no access to the sensitive data. I would still like to learn why the machine stalls at 1:10 AM. I will run the 5 minute logging macro during the night tonight without locking the machine to see if it still happens. Any thoughts, Les
  19. Noggin, thanks for the reply. ....have it set to run every 5 minute indefinitely? It was! 1. Any other timed macro starting or already running at 6am..... Nothing was running when the Six AM macro first failed to run. Now the 5 minute log could be running but doesn't between 1:13 AM (today) and when I unlock my machine. 2. Other events (only you know what your pc is connected to) may interfere with timing. I really suspected this - so last night I had my 5 minute logger log to both a file on a file server and one in my computer. Neither logfile was updated after 1:13AM. So it isn't the network. Still puzzled. 3. If the macro is screen-dependent, as far as I am aware it will not work I need to know more about this. Not sure what determines if a macro is screen dependent. The tasks I want to run execute other applications that show on the screen when they run. I will set up a test to try this in the early evening - before my machine takes a siesta at 1:1x AM. Thanks, Les
  20. Hi, I serched this sight for hibernate, sleep, and lock-computer and didn't find anyone else with my problem. I have a number of macros that are timer initiated that run without issue. When I try to run one at 6:00 AM before I get to work, it never runs. I wrote a simple logging macro that records the time of day in a file when it runs. It is set to run every 5 minutes. At 5:00 Pm I left my XP Pro machine running but locking the computer using the Cntrl/Alt/Del Windows Security screen. This morning I discovered that the macro ran every 5 minutes until 1:10 AM and then not again until I got to work and unlocked the computer. Then it started to run again. My Power Options - Properties Monitor turn off: 2 hours Hard disk turn off: Never System standby: Never Hibernation: Not enabled Any ideas? Thanks, Les
  21. Thanks Joe, So easy, I'm embarassed not seeing it. Guess that I was fixated on doing it directly in one statement. Les
  22. How can I insert a computed register name in a Text string? This question may not be clear in words. Let me use an example. N2 contains the number of the D register that I wish to name in a Text string. When N2 = 20, the Text string should be "Abc...xyz %D20%". When N2 = 34, the Text string should be "Abc...xyz %D34%". I have tried various combinations of extra % characters and 'single' and "double" quotes. Nothing seems to work. I must be missing something easy. Thanks, Les
  23. Thanks to you all for the excellent coverage of this topic. I have been slow to respond because of requirements of my "real" work. I finished the essential part of the macro capability I was doing and have now used it successfully. I had to make several concessions to meet my required production date. One of the features I delayed was the reporting section where I needed to collect the statistics on the frequency of occurence. I just got back to writing that section and have written it using the "Run Macro in Variable" technique. It works great and FAST. Thanks for the very useful method. Les
  24. A few message back, I said: "Also, I think that I could avoid the conversion-increment-conversion by appending a character to the INI field and counting the characters later with the Variable Set Integer to the text length for the field. This should be faster and I have more memory than time. I plan to do a timing comparison to learn how much faster." That was sure a bad idea. As the length of the field grew, the time required to append to it grew - a lot. In 10,000 iterations, conversion-increment-conversion was faster than appending. If anyone has any guidance on timing commands, please provide here or as a separate topic. Thanks, Les
  25. Thanks Floyd for pointing me to the documentation. I hadn't seen it and followed the notation in the drop down list. The drop down list shows MONTH to be M or MMMM and MINUTE to be mm. When I selected (h:mm:ss AM/PM) in the drop down list, and edited it to eliminate the fields that I didn't need, I ended up with (mm:ss). It seemed reasonable that this would work or that there should be someway to ask for minutes without asking for hours. Guess not. Les
×
×
  • Create New...