Jump to content
Macro Express Forums

joe

Members
  • Posts

    1,002
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by joe

  1. When the prompt window Browse for Folder appears, click on the tree structure until you get to the folder you want, then click OK. The complete folder path will be saved to to the target variable.
  2. In order to erase an environment variable set it to an empty string. Variable Set String %T1% "" Variable Modify String: Save %T1% to Environment Variable
  3. Hello! You cannot send keystrokes to an inactive window using Text Type.
  4. First you need to convert the space delimited file to a tab or comma delimited file, which is very easy to do. Simply read the file into a string variable, create a loop that converts all double spaces to a single space. Then convert all single spaces to a tab. Save the string back to a file. Now it is just a matter of using the Process ASCII File construct. Read each line in, convert each of the string variables to decimal variables, add the decimals to the totals, and then increment the line counter. At the end, you need to divide each of the column totals by the line counter, then save them to a file.
  5. I don't recall Macro Express getting ahead of itself when copying files. It appears to wait until the O/S reports the completed file copy operation. I've used it to copy thousands of files, both large and small, in a folder to another folder without incident. I am referring to accounting files, programs, databases, tables, indexes, and so forth that are copied on a daily basis. I set the Use Progress Bar checkbox in the File Copy command. Although it has no effect on smaller files, it does popup when copying larger files.
  6. Hello David! This is easier than the code below looks. You can use the Variable Set from File Date/Time command to get the creation time of a file. Each element (Month, Day, Year, Hour, Minute, Second) is placed into a separate integer variable. In order to generate a singe comparison string of these elements, leading zeros (or lack thereof) must be handled. That is what the Convert, Pad Left, and Replace string commands do. Once the leading zeros are inserted then the elements are concatenated into a single string, which is used to compare the elements of the next file in the loop. If the next file date string is less than the current file date string, then it becomes our "least date" string, and the file name itself is copied and held. So by the time you get to the end of the Repeat with Folder loop, you will have the file name that was created the earliest. Now you just need to add the code to copy that file to your other folders. // Set the initial "least date" comparison string to the maximum value. Variable Set String %T9% "99999999999999" // Loop through all files in the source folder. Repeat with Folder // Get the creation date/time elements of this file. Variable Set From File Date/Time // Add-in the leading zeros. Variable Modify Integer: Convert %N10% to text string %T10% Variable Modify Integer: Convert %N11% to text string %T11% Variable Modify Integer: Convert %N12% to text string %T12% Variable Modify Integer: Convert %N13% to text string %T13% Variable Modify Integer: Convert %N14% to text string %T14% Variable Modify Integer: Convert %N15% to text string %T15% Variable Modify String: Pad Left %T10% Variable Modify String: Pad Left %T11% Variable Modify String: Pad Left %T13% Variable Modify String: Pad Left %T14% Variable Modify String: Pad Left %T15% Replace " " with "0" in %T10% Replace " " with "0" in %T11% Replace " " with "0" in %T13% Replace " " with "0" in %T14% Replace " " with "0" in %T15% // Comparison the elements with the current "least date" string. Variable Set String %T16% "%T12%%T10%%T11%%T13%%T14%%T15%" If Variable %T16% < variable %T9% Variable Modify String: Copy %T16% to %T9% Variable Modify String: Copy %T1% to %T7% End If Repeat End <REM2:><REM2:Set the initial "least date" comparison string to the maximum value.><TVAR2:09:01:99999999999999><REM2:><REM2:Loop through all files in the source folder.><REP3:07:000002:000001:0001:0:01:c:\images><REM2:><REM2:Get the creation date/time elements of this file.><VFFILE:0:0:T:10:T:11:T:12:T:13:T:14:T:15:%T1%><REM2:><REM2:Add-in the leading zeros.><NMVAR:05:10:0:0000010:0:0000000><NMVAR:05:11:0:0000011:0:0000000><NMVAR:05:12:0:0000012:0:0000000><NMVAR:05:13:0:0000013:0:0000000><NMVAR:05:14:0:0000014:0:0000000><NMVAR:05:15:0:0000015:0:0000000><TMVAR2:14:10:00:002:000:><TMVAR2:14:11:00:002:000:><TMVAR2:14:13:00:002:000:><TMVAR2:14:14:00:002:000:><TMVAR2:14:15:00:002:000:><TMVAR2:21:10:00:000:000: 0><TMVAR2:21:11:00:000:000: 0><TMVAR2:21:13:00:000:000: 0><TMVAR2:21:14:00:000:000: 0><TMVAR2:21:15:00:000:000: 0><REM2:><REM2:Comparison the elements with the current "least date" string.><TVAR2:16:01:%T12%%T10%%T11%%T13%%T14%%T15%><IFVAR2:4:16:3:T9><TMVAR2:09:09:16:000:000:><TMVAR2:09:07:01:000:000:><ENDIF><ENDREP><REM2:>
  7. Hello Teoman! I think you are saying that you want to insert "writeme" after each 10th line in the target text file. To do this you will need to use the Process Text File, Append to Text String, and Save Text String to File commands. You first need to count the lines and then divide by 10. The result is how many times you will need to loop because you are inserting at every 10th line. Set up a Repeat Loop from 1 to whatever the number is and increment by 10 each time. Use the Process Text File construct inside the loop. The line you want to start with is your counter. The number of lines to process is 10. Within this construct, append the next text line and a CR/LF to a fixed text variable, say %T10%. Essentially you are reading the text file into a variable one line at a time. Place an Append to Text String command after the End Text Process command. The text to append is "writeme" plus a CR/LF. At the end of the Repeat Loop, you will want to process the remaining lines so they too are appended to your fixed string. After that, just write the fixed string back to a text file.
  8. Hello Burt! Yes, you can do this. Are you basing which files to copy strictly on the file count, date added, or something in the file name sequence? Also, what are your plans for copying the next time? Do you start fresh, or do you check if a file has already been copied?
  9. Richard - The PGM Functions Library contains advanced variable save and restore functions, however, they are meant to be used during a single run session of set of macros. Kevin's idea of saving the last number used in an INI file is your best bet. And don't forget that an INI file is a text file, and like any other text file it can be edited. So, if you ever need to change the last number used you can do so.
  10. This will work: Wait for Text: "/" OR Wait for Key Press: ESC <WAITTXTN2:000000:000000:/><OR><WAITKEY2:000000:000000:48>
  11. I have not tested the following, but it should work just fine. Create another macro with a single Run Macro <your :05 macro> command line. Set the schedule to Run on Startup. When you reboot your computer, the newly created macro will run, which in turn, runs your scheduled :05 macro one time. And the :05 macro will continue to fire from then on at its scheduled time.
  12. joe

    .php

    Not sure what is happening with these links. I will look into it.
  13. The coolest script in the world is the one that works for you. I could not write anything better than the one that works the way you need it to work. Congrats on you success!
  14. You may or may not be able to accomplish your task using Window Controls. It depends on how the Access application was written. But give it a try!
  15. Your additional code seems correct. The gobblygook at the bottom of the Code section is the actual code of example above it. You can cut-and-paste it to you macro.
  16. A macro can be set to automatically fire when a particular window gains focus. If your USB drive launches a window when you plug it in, then you should be able to do it.
  17. The Switch / End Switch construct only works with exact matches. In other words, contains or does not contain is not possible. Therefore, you need to use the If / Else / End If construct for your testing. The following code should do the job: If Variable %T1% contains "flyttet" // ... // Process mail // ... Else If Variable %T1% contains "oprettet" AND If Variable %T1% does not contain "nordea" // ... // Process mail // ... Else // ... // Delete mail // ... End If End If <IFVAR2:1:01:7:Tflyttet><REM2:...><REM2:Process mail><REM2:...><ELSE><IFVAR2:1:01:7:Toprettet><AND><IFVAR2:1:01:8:Tnordea><REM2:...><REM2:Process mail><REM2:...><ELSE><REM2:...><REM2:Delete mail><REM2:...><ENDIF><ENDIF>
  18. Macro Express monitors the standard Windows keyboard and mouse hooks. Many games however, use DirectX which bypass the Windows hooks. If this is the case, a macro program will not work. Even if this is not the problem, Macro Express is designed to "engage" a key on the upstroke only and not the downstroke, which means holding a key down will not be recognized.
  19. I based my answer on what you wrote above. The one-second delay after the window launches, and before any other command is run (such as Window Reposition), is on the Advanced tab.
  20. The PIL message means that the name and code used to license Macro Express is stolen or fraudulent. To correct this, you must purchase a license.
  21. Jeff - Are you sure these run perfectly on an older machine, but not on a newer dual-core machine? If so, then the problem is not in the macros themselves, but rather something going on between Macro Express and the dual-core machine. At least that it the way it appears. Have you contacted Insight?
  22. Here is one way to do it: // Set CR/LF Variable Set %T13% to ASCII Char of 013 Variable Set %T10% to ASCII Char of 010 Replace "%T13%" with "%T13%%T10%" in %T13% // Set input and output files Variable Set String %T10% "c:\temp\test.txt" Variable Set String %T11% "c:\temp\out.txt" // Count lines in the input file Variable Set Integer %N1% to 0 Text File Begin Process: "%T10%" Variable Modify Integer: Inc (%N1%) Text File End Process // Create a text variable of lines from input file (last-to-first) Variable Set String %T9% "" Repeat Start (Repeat %N1% times) Text File Begin Process: "%T10%" Variable Modify String: Append "%T1%%T13%" to %T9% Text File End Process Repeat End // Copy text variable to output file Variable Modify String: Save %T9% to Text File Macro Stop <REM2:Set CR/LF><ASCIIC:13:1:013><ASCIIC:10:1:010><TMVAR2:21:13:00:000:000:%T13%%T13%%T10%><REM2:><REM2:Set input and output files><TVAR2:10:01:c:\temp\test.txt><TVAR2:11:01:c:\temp\out.txt><REM2:><REM2:Count lines in the input file><IVAR2:01:01:0><BTFBEG:001:000001:000000:%T10%><NMVAR:08:01:0:0000001:0:0000000><BTFEND><REM2:><REM2:Create a text variable of lines from input file (last-to-first)><TVAR2:09:01:><REP3:01:%N1%:0000-1:%N1%:1:02:><BTFBEG:001:N00002:000001:%T10%><TMVAR2:07:09:00:000:000:%T1%%T13%><BTFEND><ENDREP><REM2:><REM2:Copy text variable to output file><TMVAR2:17:09:00:000:000:%T11%T><MSTOP>
  23. Check out the Repeat / End Repeat command constructs. There are several. You would place your copying / pasting commands within one of these constructs. The logic flow would be something like this: Repeat until whatever Activate app A window Copy field to clipboard Activate browser Paste from clipboard Process pasted field Repeat loop
×
×
  • Create New...