Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,195
  • Joined

  • Last visited

  • Days Won

    61

rberq last won the day on March 4

rberq had the most liked content!

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

rberq's Achievements

  1. Here's a variation on acantor's idea: Insert a "Label" statement just before or after the Text Box Display, and include the label name in the header and/or text of the box. No matter how much macro code is added or removed, you can find the label using the Script Editor. // :abc // Label abc Text Box Display: abc //
  2. Repeat Start (Repeat 10 times) Text Type (Simulate Keystrokes): <ARROW DOWN> Delay: 10 milliseconds End Repeat Has the advantage that you don't have to count how many you have put in the command. And easy to change just by modifying the Repeat command. Delay may or may not be needed depending on the application you are interacting with.
  3. Repeat Start (Repeat 2000 times) Variable Set Integer %in% to a random value between 1000 and 19999 Variable Modify Integer %in%: Convert to Decimal (%indecimal%) Variable Modify Decimal: %individed% = %indecimal% / 100 Variable Modify Decimal %individed%: Convert to Text String (%instring%) Variable Modify String: Append %instring% to text file, "c:\temp\numbers.csv" Text Box Display: Values End Repeat Macro Return
  4. I cheated, because I wanted to use real-world values. I was surprised that my real numbers had the same tiny discrepancy as your Monte Carlo simulation.
  5. If the macro chooses random values, and if the random function works properly, then by definition statistical theory says you will get a very small percentage difference. So to more closely match real finance, I downloaded six hundred credit card charge amounts from my bank -- the most that I could access online. The percentage difference was -- wait for it -- 0.020499%. I thought the result might be skewed because so many items are priced as x dollars and 99 cents. But scanning the numbers, there were few charges like that, because most purchases were not single items but a roll-up for many items.
  6. Macro command Variable Modify String has options that would allow you to take form data, concatenate multiple data items, and write the concatenated string to a file. For example, with values a, b, and c from the form: // Variable Set String %line% to "" // set line null Variable Modify String %line%: Append Text (") // line contains double-quote Variable Modify String %line%: Append Text String Variable (%form_data_1%) // line contains "a Variable Modify String %line%: Append Text (",") // line contains "a"," Variable Modify String %line%: Append Text String Variable (%form_data_2%) // line contains "a","b Variable Modify String %line%: Append Text (",") // line contains "a","b"," Variable Modify String %line%: Append Text String Variable (%form_data_3%) // line contains "a","b","c Variable Modify String %line%: Append Text (") // line contains "a","b","c" Variable Modify String: Append %line% to text file, "c:\test|filaname.csv" // write line to file // Even though the last command writes to a "text" file, the fact that you use the .csv extension on the file name will make Windows, Excel, etc. consider it to be the csv file type.
  7. If your data is in a CSV file, it is especially easy. (If the data is in an Excel sheet, you can save it as a CSV file, manually or as the first step of your macro.) The instructions ASCII File Begin Process and ASCII File End Process constitute a repeating loop that read the CSV file one line at a time and place that line's data into an indexed array. For example, call your array "ARY". If the first line of the CSV file is "a","b","c","d" then ARY(1)=a, ARY(2)=b, ARY(3)=c, ARY(4)=d Then you type or paste the array entries into the form, and continue with the next line of the CSV file. There is no visible jumping back and forth between the file and the form, unlike between a spreadsheet and the form, because the CSV file is not visible on the computer screen. Macro logic is something like this: Open data-entry form if it is not already open [Beginning of loop] ASCII File Begin Process (file name and array dimensions are defined within this command) (data from one CSV line is automatically placed into array) Paste ARY(1) into form Paste ARY(2) into form Paste ARY(3) into form Paste ARY(4) into form ASCII File End Process (control automatically returns to do the next CSV line) [End of loop, falls through to next instruction after entire CSV file has been processed] Macro Exit
  8. "A foolish consistency is the hobgoblin of little minds" (Emerson) "But it has its comforts" (me)
  9. I am running MX Pro 6.6.2.1, Windows 10. Both the Macro Explorer window and the Script Editor open as you describe. As I recall, this behavior appeared when I updated to 6.6.2.1. Like you, I wrote little macros to size and position them to my preferences -- in my case, full screen for both. Previously, the windows always opened full-screen, probably because that was the size and position I had last used.
  10. Often there is text in a button that you can search for, that gives focus to the button. This code finds the Log Out button on a particular page and "presses" the button by typing ENTER. Text Type (Simulate Keystrokes): <CTRLD>f<CTRLU>log out<ESC> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <ENTER> Sometimes you can search for text that reliably precedes or follows the button, then tab forward or backwards to the button similar to what Cory described.
  11. Above, in a macro -- works for me. Program Launch: "Excel" (Normal) Parameters: Delay: 500 milliseconds Text Type (Simulate Keystrokes): 12/15/2023<ENTER> Text Type (Simulate Keystrokes): =a1-2<ENTER> Text Type (Simulate Keystrokes): <ARROW UP> Delay: 250 milliseconds Text Type (Simulate Keystrokes): <CTRLD>c<CTRLU> Delay: 250 milliseconds Variable Set String %dat% from the clipboard contents Text Box Display: Date-%dat%
  12. acantor, I have some code that looks like yours, and it gets complex if you want it to work one-hundred percent correctly over month ends and year ends and leap years, never mind the occasional leap century. Here's a way I just tested manually. It worked well, though visually you might not like it flashing on your screen while the macro runs: 1- Open Excel (new, empty spreadsheet) 2- Paste your known date into cell A1 3- Arrow down to cell A2 4- Type "=A1-2" and ENTER -- decrements the date by two days 5- Arrow back up to cell A2 6- Ctlr-c to copy the two-days-previous date into the clipboard 7- Open Notepad and paste (or, in a macro, set a text string from the clipboard) 8- Close Excel At least with my Excel 2010, Excel treats the mm/dd/yyyy as a date for calculation but as text when I copy to clipboard. I haven't tried putting the above logic into a macro, but as I say, it works when I do it manually.
  13. Just a shot in the dark -- do you have a command like this Keystroke Speed: 30 milliseconds at the beginning of your macro? It may be that the "typing" is over-running the application -- characters being presented faster than the application can absorb them. Edit: My posting overlapped with acantor. But I see we are thinking along the same lines.
  14. If you are still using an old version of ME, without GOTO, perhaps you could put the whole macro (or the portion where you want to start over) in a Repeat loop. For example, SET T99 = "GO" REPEAT UNTIL T99 = "STOP" .... .... IF T7 = 2 then open notepad and set the number 2 ELSE SET T99 = "STOP" END IF END REPEAT MACRO END
×
×
  • Create New...