rberq

Members
  • Content count

    619
  • Joined

  • Last visited

  • Days Won

    15

rberq last won the day on April 6

rberq had the most liked content!

Community Reputation

8 Neutral

About rberq

  • Rank
    Expert

Contact Methods

  • ICQ
    0
  1. I think this approach will work: Use Text File Begin Process, once only, to load all entries from the file into a single text variable. That is, read the file one line at a time into T1, trim, and append its 9 characters to T2 (variable modify string/append), continue until the whole file has been loaded. When done, T2 will be an array of 9-character strings. (But you won’t need to process it as an array – see below.) Next, copy the first spreadsheet cell into the clipboard, store in text variable T3. Command If Variable %T2% contains "%T3%" tells you whether the array (file) contains that cell’s data, and you can type or delete into other cells in the row as desired. Text Type of arrow keys is good for moving from one spreadsheet cell to another. Get this working for a single row of the spreadsheet. Once you have it working for one row, add Repeat Start and Repeat End to handle all the rows one by one. Use Repeat Exit when you reach the end of the spreadsheet (that is, when copy to clipboard finds nothing).
  2. Repeat Start (Repeat 20 times) Control Key Down Text Type: c Control Key Up ... ... ... Alt Key Down Text Type: <TAB> Alt Key Up Repeat End You might also try repeating indefinitely -- or repeat an extremely high number of times. Then after the copy-to-clipboard (Ctrl-c), if the clipboard contains nothing, exit from the repeat loop. That way your macro would deal automatically with a variable number of entries in a column, as long as the last cell in the spreadsheet column is followed by a null cell. Variable Set Integer %N1% to 1 Repeat Until %N1% <> 1 Control Key Down Text Type: c Control Key Up If Clipboard Text Equals "" Repeat Exit End If ... ... ... Alt Key Down Text Type: <TAB> Alt Key Up Repeat End
  3. Usually, variable names bracketed by % can be substituted for literals. So instead of this: If Variable %LOOP[1]% Equals "2" Variable Modify Integer set %XCOORD[2]% to the contents of %TEMP[1]% try this: Variable Modify Integer set %XCOORD[%LOOP[1]%]% to the contents of %TEMP[1]% The script editor allows it, so it probably will work. I hope so -- gets rid of all the IFs -- way more elegant.
  4. I would tell you how to put values into an array, but I use Macro Express Version 3 which doesn't have arrays. My guess would be, define an integer variable, increase it by one (Variable Modify Integer) each time through the Process loop, and use the variable as the index to the slots in the array.
  5. To ignore lines starting with 5, use an IF command. Text File Begin Process: C:\1_temp\MouseRecorderPro2.txt IF FIRST BYTE OF LINE IS NOT = 5 Variable Set Integer %N[1]% to the position of "X" in %COORD[1]% Variable Modify Integer: %N[1]% = %N[1]% + 2 Variable Modify String: Copy a substring in %COORD[1]%, starting at %N[1]% and 4 characters long to %TRIMX[1]% Text Box Display: ENDIF Text File End Process Always copy 4 characters then VARIABLE MODIFY STRING (RIGHT-TRIM). That will get rid of the trailing space if it turns out to be only 3 digits. If it is 4 digits the trimming will have no effect.
  6. * Example of one line of data, in variable T1. In your macro the Text File Process will populate the text variable, rather than the Set String command. Variable Set String %T1% " X:1701 Y:580" * Set integer to position of "X:" within the data Variable Set Integer %N1% from Position of Text in Variable %T1% * Bump position up by 2 characters so N1 is pointing to the first digit instead of to "X:" Variable Modify Integer: %N1% = %N1% + 2 * What Cory said -- move four digits from the data to another variable Variable Modify String: Copy Part of %T1% to %T2% [starting position N1, number of digits 4] * Display the extracted digits to verify the extraction is working properly Text Box Display: %T2% Of course in your actual macro, you would move the extracted digits to the array instead of Text Box Display.
  7. I have done it only by installing Macro Express on the remote PC. Except in the case of some Citrix applications running on a server, when the macros were installed only on my local PC.
  8. Not really a sledgehammer, just working intelligently with the tools the scripting language makes available to you. And look how well you understand Macro Express's date abilities now. Next thing to do is put this code into a separate macro that you can run (call) from other macros, rather than have to recreate the process every time you want to use it.
  9. I have done Cory's technique, but saving in an environment variable rather than registry. The only problem I ran into was exceeding the allowable size of an environment variable. I don't know if you have to watch out for size limits with registry keys.
  10. The script I gave you in a previous post was for Macro Express Version 3. The one below is almost identical, but for ME Pro. The problem of fractional days is avoided, by converting the current-adjusted-date to a text string of format m/d/yyyy before comparing it to the future date. Again, variable %N[1]% contains the number of days difference when the macro ends. There is probably another way to cope with the fractional days, but this method works fine for small date differences. It may take an unacceptably long time to process if you are dealing with dates that are years apart. Variable Set String %T[2]% to "5/24/2017" [future date] Variable Set Integer %N[1]% to -1 Repeat Until %T[1]% Equals "%T[2]%" Variable Modify Integer %N[1]%: Increment Date/Time: Set %DT[1]% to an adjusted date/time [adjust current date forward by N[1] days] Variable Modify Date/Time: Convert to Text String [convert adjusted date to m/d/yyyy format] End Repeat Text Box Display: %N[1]% .... %T[1]%
  11. P.S. Understand that your football and our football are two different things, and different levels of violence.
  12. I use Macro Express 3, and have had little luck with date manipulation. Here’s a clever method, if I do say so myself. Use the Date/Time command in a Repeat loop until the “adjusted” date (based on today) matches the future date. When the loop ends, variable N1 contains the number of days difference between today and the future date. // Variable Set String %T2% "12/23/2017" [future date] Variable Set Integer %N1% to -1 [initialize as negative 1 to allow for future date = today] Repeat Until %T1% = %T2% [repeat until computed date = future date] Variable Modify Integer: Inc (%N1%) [increment N1 by 1 each time through loop] Date/Time: Save "M/d/yyyy" into %T1% Repeat End Text Box Display: %N1% [number of days between current and future date] // This is what the Date/Time command should look like:
  13. Variable Set Integer %N1% from Position of Text in Variable %T1% [search for the "-"] Variable Modify String: Copy Part of %T1% to %T2% [copy from position 1 to position %N1%] Variable Modify String: Save %T2% to Clipboard
  14. From your initial post, I thought you wanted the macro to continue sooner after starting Excel -- not have Excel start sooner. Big difference.
  15. No. I mean make a batch file to start Excel, then start the batch file from your macro like this: