rberq

Members
  • Content count

    619
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by rberq

  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:
  16. If the text box display is the first line of the macro, and is not appearing, then it sure sounds like the macro is not running at all. Check the macro's Scope tab to make sure it is Global -- not restricted to a particular window or program.
  17. What does "can't get it to do anything" mean??? Does it pop up the text box, or not??? Try starting the macro with one of the keypad characters, for example the asterisk or the + key. As Sam asked, what application are you typing into? I have seen some applications that "trap" or "block" the Ctrl key so a macro triggered by a Ctrl combination does not run at all, because ME never sees the key combination intended to start the macro.
  18. Or (similar to what Acantor (a singer???) is saying): make a bat file to start Excel; containing just the lines start c:\path\excel.exe and exit Then have your macro launch command.com with parameter /c batchfile.bat Presumably the delay will only be for the time it takes command.com to run -- not long. Worth a try.
  19. To sort of simulate your situation, I ran the following test macro: Variable Set Integer %N1% from Current Second Program Launch: "notepad" Variable Set Integer %N2% from Current Second Text Box Display: %N1% %N2% The time difference between N1 and N2, over many tests, was almost two seconds. So I am seeing delays like you describe. Can't explain it, but yes I see similar behavior to what you see. You are seeing 5 seconds, I am seeing two, but then I am starting a simpler application. If I remove the Program Launch command from my test macro, the times displayed are always identical. I would guess -- GUESS, mind you -- that ME is being a responsible Windows citizen, asking Windows to launch the application and then waiting patiently for an "all done" acknowledgement from Windows, which is some time in coming. Sorry, kind of imprecise for a technical answer, but that's the best you will get out of me.
  20. Hmmmmm. Things are looking clearer now. Notepad saved the original file as Unicode, but ME adds ANSI (non-unicode) characters. If you then open the file with Notepad specifying Unicode encoding it looks funny (Chinese). If you specify ANSI when opening it, not quite so funny; the original data has two bytes per character (Unicode), and the appended data looks fine, only one byte per character. ÿþa b c d e f g A B C D E F G abcdefgABCDEFG If you run the macro with the file not existing at all, then it is created as ANSI and the appended data is ANSI and everything looks fine. abcdefgABCDEFG If you create the file from scratch with Notepad and specify ANSI when you save it, then run the macro, everything looks fine. Variable Set String %T1% "abcdefgABCDEFG" Variable Modify String: Append %T1% to Text File abcdefgABCDEFGabcdefgABCDEFG
  21. Never mind. I thought you were doing a late April Fool's joke, but mine does the same thing. Using ME version 3.9.0.1. With Notepad I loaded "abcdefgABCDEFG" into a file, then ran these two macro instructions. Results below. I don't know if it's Chinese or Martian characters, but there it is. Variable Set String %T1% "abcdefgABCDEFG" Variable Modify String: Append %T1% to Text File abcdefgABCDEFG扡摣晥䅧䍂䕄䝆਍
  22. So show us the content of the text variable being appended, and the command(s) used to do the appending. And attach a screen shot of the text editor screen showing the result.
  23. Don't feel dumb. There are lots of neat things in ME that are easy to miss. For example, the Variable Modify String command has options to change an entire string to lower or upper case. That would be another way of doing your comparison. But I didn't remember the options were there until I looked for them a few minutes ago.
  24. When you code the command " If Variable %T1% contains "S-Shata" ", there is a checkbox option to ignore case.
  25. Try this: Use Text File Begin Process to get each line, sequentially, into a text variable. (One line on each pass through the loop defined by Text File Begin Process / Text File End Process). When the line is in the text variable (T1 for example), if variable T1 contains "S-Shata" then display the whole of T1 (the whole line) with the Text Box Display command. Text File Begin Process: "filename.txt" If Variable %T1% contains "S-Shata" Text Box Display: %T1% End If Text File End Process