Jump to content
Macro Express Forums

joe

Members
  • Posts

    1,002
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by joe

  1. Not directly, but it would be much easier to calculate them because the {DateTime} functions use Julian day numbers. Here is an example: // *** // *** Get the first day of the month and place it in T10. // *** // Generate a date string of the first day of the month. Date: Save DD (19) into %T1% Date: Save DD/MM/YYYY (19/03/2000) into %T10% Replace "%T1%/" with "01/" in %T10% // *** // *** Get the last day of the month and place it in T11. // *** // Get a date string of this time next month. Date: Save YYYYMMDD (20000319) into %T2% Variable Set String %T1% "{ DateTime - Go Months },%T2%,1" Write Registry String: "PgmFunction" Macro Run: { PGM Function } Read Registry String: "ReturnString1" // Change it to the first day of next month. Variable Modify String: Delete Part of %T2% Variable Modify String: Append "01" to %T2% // Convert it to a Julian day number. Variable Set String %T1% "{ DateTime - Date to Julian },%T2%" Write Registry String: "PgmFunction" Macro Run: { PGM Function } Read Registry Decimal: "ReturnDecimal1" // Subtract 1 from it and then convert it back to a date string. Variable Modify Decimal: %D2% = %D2% - 1 Variable Set String %T1% "{ DateTime - Julian to Date },%D2%" Write Registry String: "PgmFunction" Macro Run: { PGM Function } Read Registry String: "ReturnString1" // Format the date string. Variable Modify String: Delete Part of %T1% Variable Modify String: Copy %T10% to %T11% Replace "01/" with "%T1%/" in %T11% // Launch and/or activate the Windows Notepad. Activate or Launch: "notepad" OR "notepad.exe" Delay 500 Milliseconds Text Type: T10 = %T10%<ENTER>T11 = %T11%<ENTER> Macro Return <REM2:***><REM2:*** Get the first day of the month and place it in T10.><REM2:***><REM2:><REM2:Generate a date string of the first day of the month.><DD{YP000}{P000}01><DD/MM/YYYY{YP000}{P000}10><TMVAR2:21:10:00:000:000:%T1%/01/><REM2:><REM2:***><REM2:*** Get the last day of the month and place it in T11.><REM2:***><REM2:><REM2:Get a date string of this time next month.><YYYYMMDD{YP000}{P000}02><TVAR2:01:01:{ DateTime - Go Months },%T2%,1><REGWSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\Pgm Functions\PgmFunction><MACRUN2:{ PGM Function }><REGRSTR:2:HKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnString1><REM2:><REM2:Change it to the first day of next month.><TMVAR2:11:02:00:007:002:><TMVAR2:07:02:00:000:000:01><REM2:><REM2:Convert it to a Julian day number.><TVAR2:01:01:{ DateTime - Date to Julian },%T2%><REGWSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\Pgm Functions\PgmFunction><MACRUN2:{ PGM Function }><REGRDEC:2:HKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnDecimal1><REM2:><REM2:Subtract 1 from it and then convert it back to a date string.><DMVAR:02:02:1:000000000000002.0000:2:1><TVAR2:01:01:{ DateTime - Julian to Date },%D2%><REGWSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\Pgm Functions\PgmFunction><MACRUN2:{ PGM Function }><REGRSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\Parameters\ReturnString1><REM2:><REM2:Format the date string.><TMVAR2:11:01:00:001:006:><TMVAR2:09:11:10:000:000:><TMVAR2:21:11:00:000:000:01/%T1%/><REM2:><REM2:Launch and/or activate the Windows Notepad.><LAUNCHYES3:0:0112notepad<LAUNCH:notepad.exe><IMSD:500><TEXTTYPE:T10 = %T10%<ENTER>T11 = %T11%<ENTER>><MRETURN>
  2. Hello Oded! I don't remember if you have the PGM Function Library or not, so here is a short macro that will do what you want. It is written using the Macro Express Text/Date commands utilizing dynamic execution. The macro ends by setting T10 to the first day of the current month and T11 as the last day. // *** // *** Get the first day of the month and place it in T10. // *** // Place today into a variable and then convert it to an integer. Date: Save DD (19) into %T1% Variable Modify String: Convert %T1% to integer %N1% // Decrement it by 1 so that today - value = 1. Variable Modify Integer: Dec (%N1%) // Add 100 to the value so that when it is converted back // to a string we can retain the leading zero. Variable Modify Integer: %N1% = %N1% + 100 Variable Modify Integer: Convert %N1% to text string %T1% Variable Modify String: Delete Part of %T1% // Create a dynamic Macro Express command string that uses the // above variable and then execute it. Variable Set String %T2% "<DD/MM/YYYY{YP0%T1%}{P000}10>" Run Macro in Variable %T2% // *** // *** Get the last day of the month and place it in T11. // *** // Loop to count the days remaining in the month. Stop // when we hit the 1st day of the following month. Repeat Start (Repeat 31 times) // Add 100 to the value so that when it is converted back // to a string we can retain the leading zero. Variable Modify Integer: %N1% = %N1% + 100 Variable Modify Integer: Convert %N1% to text string %T1% Variable Modify String: Delete Part of %T1% // Create a dynamic Macro Express command string that uses the // above variable and then execute it. Variable Set String %T2% "<DD{YF0%T1%}{P000}02>" Run Macro in Variable %T2% // If we have hit the next month then decrement N1 and exit the loop. If Variable %T2% = "01" Variable Modify Integer: Dec (%N1%) Repeat Exit End If Repeat End // At this point N1 is still a 3-digit number so convert it to a // string and just keep just the right-two characters. Variable Modify Integer: Convert %N1% to text string %T1% Variable Modify String: Delete Part of %T1% // Create a dynamic Macro Express command string that uses the // above variable and then execute it. Variable Set String %T2% "<DD/MM/YYYY{YF0%T1%}{P000}11>" Run Macro in Variable %T2% // Launch and/or activate the Windows Notepad. Activate or Launch: "notepad" OR "notepad.exe" Delay 500 Milliseconds Text Type: T10 = %T10%<ENTER>T11 = %T11%<ENTER> Macro Return <REM2:***><REM2:*** Get the first day of the month and place it in T10.><REM2:***><REM2:><REM2:Place today into a variable and then convert it to an integer.><DD{NP000}{P000}01><TMVAR2:05:01:01:000:000:><REM2:><REM2:Decrement it by 1 so that today - value = 1.><NMVAR:09:01:0:0000001:0:0000000><REM2:><REM2:Add 100 to the value so that when it is converted back><REM2:to a string we can retain the leading zero.><NMVAR:01:01:1:0000001:2:0000100><NMVAR:05:01:0:0000001:0:0000000><TMVAR2:11:01:00:001:001:><REM2:><REM2:Create a dynamic Macro Express command string that uses the><REM2:above variable and then execute it.><TVAR2:02:01:<DD/MM/YYYY{YP0%T1%}{P000}10>><RUNMACVAR:2><REM2:><REM2:***><REM2:*** Get the last day of the month and place it in T11.><REM2:***><REM2:><REM2:Loop to count the days remaining in the month. Stop><REM2:when we hit the 1st day of the following month.><REP3:01:000000:000001:00031:1:01:><REM2:><REM2:Add 100 to the value so that when it is converted back><REM2:to a string we can retain the leading zero.><NMVAR:01:01:1:0000001:2:0000100><NMVAR:05:01:0:0000001:0:0000000><TMVAR2:11:01:00:001:001:><REM2:><REM2:Create a dynamic Macro Express command string that uses the><REM2:above variable and then execute it.><TVAR2:02:01:<DD{YF0%T1%}{P000}02>><RUNMACVAR:2><REM2:><REM2:If we have hit the next month then decrement N1 and exit the loop.><IFVAR2:1:02:1:01><NMVAR:09:01:0:0000001:0:0000000><EXITREP><ENDIF><ENDREP><REM2:><REM2:At this point N1 is still a 3-digit number so convert it to a><REM2:string and just keep just the right-two characters.><NMVAR:05:01:0:0000001:0:0000000><TMVAR2:11:01:00:001:001:><REM2:><REM2:Create a dynamic Macro Express command string that uses the><REM2:above variable and then execute it.><TVAR2:02:01:<DD/MM/YYYY{YF0%T1%}{P000}11>><RUNMACVAR:2><REM2:><REM2:Launch and/or activate the Windows Notepad.><LAUNCHYES3:0:0112notepad<LAUNCH:notepad.exe><IMSD:500><TEXTTYPE:T10 = %T10%<ENTER>T11 = %T11%<ENTER>><MRETURN>
  3. Well, it means nothing when you copy and paste it into a macro. However, the correct command line is generated each time through the loop when the macro runs. The first time through the loop it will be evaluated as: Variable Modify Integer: %N40% = %N1% + %N20% the next time it will be: Variable Modify Integer: %N40% = %N1% + %N21% and then : Variable Modify Integer: %N40% = %N1% + %N22% and so it goes.
  4. Hello Avarion! You need to familiarize yourself with dynamic program execution. Here is your example: // Set variables N20 through N30 to random integer values. Variable Set Integer %N20% to 4 Variable Set Integer %N21% to 6 Variable Set Integer %N22% to 342 Variable Set Integer %N23% to 12 Variable Set Integer %N24% to 56 Variable Set Integer %N25% to 47 Variable Set Integer %N26% to 9 Variable Set Integer %N27% to 69 Variable Set Integer %N28% to 11 Variable Set Integer %N29% to 22 Variable Set Integer %N30% to 19 // Launch and/or activate the Windows Notepad. Activate or Launch: "notepad" OR "notepad.exe" Delay 500 Milliseconds // Repeat 11 times (number of random variables). Save the current counter in N1. Repeat Start (Repeat 11 times) // Set N2 to the current counter+19, which gives us 20,21,22,23,... Variable Modify Integer: %N2% = %N1% + 19 // Generate a Macro Express command string to run. Variable Set String %T1% "<NMVAR:01:40:1:0000001:1:00000%N2%>" // Dynamically run the command string. Run Macro in Variable %T1% // Type out the values each time through the loop. Text Type: N1 = %N1%<ENTER>N2 = %N2%<ENTER>T1 = %T1%<ENTER>N40 = %N40%<ENTER><ENTER> Delay 250 Milliseconds Repeat End Macro Return <REM2:Set variables N20 through N30 to random integer values.><IVAR2:20:01:4><IVAR2:21:01:6><IVAR2:22:01:342><IVAR2:23:01:12><IVAR2:24:01:56><IVAR2:25:01:47><IVAR2:26:01:9><IVAR2:27:01:69><IVAR2:28:01:11><IVAR2:29:01:22><IVAR2:30:01:19><REM2:><REM2:Launch and/or activate the Windows Notepad.><LAUNCHYES3:0:0112notepad<LAUNCH:notepad.exe><IMSD:500><REM2:><REM2:Repeat 11 times (number of random variables). Save the current counter in N1.><REP3:01:000001:000001:00011:1:01:><REM2:><REM2:Set N2 to the current counter+19, which gives us 20,21,22,23,...><NMVAR:01:02:1:0000001:2:0000019><REM2:><REM2:Generate a Macro Express command string to run.><TVAR2:01:01:<NMVAR:01:40:1:0000001:1:00000%N2%>><REM2:><REM2:Dynamically run the command string.><RUNMACVAR:1><REM2:><REM2:Type out the values each time through the loop.><TEXTTYPE:N1 = %N1%<ENTER>N2 = %N2%<ENTER>T1 = %T1%<ENTER>N40 = %N40%<ENTER><ENTER>><IMSD:250><REM2:><ENDREP><MRETURN>
  5. Welcome to the group! Thanks Mike. The group always appreciates a compliment.
  6. Welcome to the group! It doesn't seem possible. A semi-solution would be to create a macro that uses the Wait for Key Press command. And you could even scope it to a particular window. The downside is that it would be a running macro, which means no other macros would run while this one is waiting for the <Enter> key. Wait for Key Press: ENTER Mouse Left Button Click
  7. Hello Cyberchief! Get the currently running library file name from the Registry: Set Variable %T1% to "Preferences Registry Key" Read Registry String: "Current File" <VSETMISC:T1:Preferences Registry Key><REGRSTR:2:%T1%\Miscellaneous\Current File>
  8. joe

    Citrix

    For those using Citrix, I have a question that has nothing directly to do with Macro Express. I noticed there is a "Print Screen" option in the menu. Can this be used to capture a DOS-based application and print the results to a file?
  9. Hello IceBox! The first thing is to create a CR/LF string that Macro Express understands: Variable Set %T1% to ASCII Char of 010 Variable Set %T13% to ASCII Char of 013 Replace "%T13%" with "%T13%%T1%" in %T13% <ASCIIC:1:1:010><ASCIIC:13:1:013><TMVAR2:21:13:00:000:000:%T13%%T13%%T1%> Now, as you suspected, use the Replace Substring command to strip the CR/LF from your target string (assume T1 as target). Simply leave the Replace With field empty: Replace "%T13%" with "" in %T1% <TMVAR2:21:01:00:000:000:%T13%>
  10. Hello Les! I wish you luck in your next venture and have appreciated your support for this forum. There is not a direct way to do what you want. But maybe you could create a macro to run afterwards that will loop through variables 1-99 and write the ones that are not empty to a text file along with their variable number. This would at least tell you which variables have been used. It would not work on variables used and then erased. And it will not tell you what the data for any particular variable means.
  11. Paul and jr - Very interesting. I will try some tests, but I swear this is deja vu.
  12. Hello and Welcome! Right-click the little running guy that you see in your system tray.
  13. Hello! I think it's God's way of showing us He has a sense of humor As you say, you can <Tab> back to it, but can you then highlight it (Ctrl+A) and then copy it to the clipboard (Ctrl+C) using your keyboard? If so, then you can duplicate these two actions within Macro Express: Text Type: <CONTROL>A Clipboard Copy
  14. Floyd and I both have experienced different, and sometimes strange, things when running from the Scripting or Direct Editor windows, which of course is required when debugging. We don't put too much stock into the inconsistencies as long as the macro runs perfect when run normally. One thing to check is the name of the macro you are testing from the Scripting Editor. Could the macro confuse it with your target window title as it is running? In other words, if I were running a macro that controlled the "Calculator" window, and my macro was also named "Calculator", and I was running it from the Scripting Editor, the macro could get confused as to which "calculator" window is to be accessed.
  15. Hello Markter! Are both the caching checkboxes checked (Options->Preferences->Caching)?
  16. Hello Paul! I think what you are seeing is correct. When a Variable Restore is the first command in a macro, it retrieves the values that were last placed in the memory space. As a side note, when a macro ends the memory variables remain in the memory space until a new macro is fired. This is why you can View Memory Variables in the debug window after a macro stops. What I believe happened in your case, is that your first call to meproc pushed "Now is the time" into the memory space prior to the first line (Variable Restore) firing, therefore, the text string is restored and displayed. It remains in the memory space until the next macro is run. However, since the first command to fire is Variable Restore, it retrieves the last value stored, which is "Now is the time". The memory space is cleared automatically when a macro runs without Variable Restore as the first line or when Macro Express is terminated.
  17. Welcome! Well, there is no good answer to this. Macro Express, like any other programming language, can do harm if not careful. If, for example, you create a macro to delete all files in a particular folder then that is what will happen ... no matter which language you use.
  18. Welcome! Macro Express sees no difference between the left and right Shift or Ctrl keys on you keyboard. If, for example, you have a macro set to fire when entering Ctrl+Shift+Q it does not matter which side of the keyboard you use. Remapping your keyboard is not the answer. Something else must be wrong.
  19. Welcome! From an expense point of view, A quick search on Google finds that Automate Pro is $179.95 and Automate Anywhere ranges between $109.95 and $395.95 ... Macro Express is only $39.95. And of course I like Macro Express, which is a good reason for anybody to buy it
  20. Welcome to the group! One option is to use the text Type command. Let's say you saved the user's input to string T1 using the command Variable Set String %T1% from Prompt. Now you just need to activate the other program, move to the text box and then enter the text into it using the Text Type: %T1% command.
  21. Hello Rachel! Maybe a simple solution would be to move the cursor to the line following the orange text and do the Find again only this time set the "Search" field to "Down" instead of "All".
  22. t.s. - Not really sure. It was sent to me by a friend who said they saw it during a Google image search. I'm sure it is still out there in its true size, but I only have the small gif that you see. canadian - Well, I think it may depend on the application that the Window Control is used in. Some Controls are accessible and some are not. Is there a particular application you are testing?
  23. Welcome to the group! You first need to set a variable with the current date/time: Date/Time: Save "yyyymmdd.hh.mm" into %T1% Create Folder: "c:\temp\%T1%" And don't forget there are characters that cannot be used in a folder or file name. \ / : * ? " < > |
  24. Welcome to the group! Macro Express does have its own string, integer, and decimal variables. But I suggest that you take some time to go through the tutorials and then make an attempt at a small task that would have some meaning to you.
  25. Where to begin ... wow! First, it is always a great feeling when clients tell us how much money they saved by spending some up-front to automate. If done properly, most automation tasks will save a company time in the form of man-hours. We have done so many automation tasks that they all become a fog. The latest is a system that automates a shipping process. When a sales order is generated, we have it write specific data to an external file that triggers Macro Express. Macro Express determines which, and how many, labels to print based on this data. It takes the data, manipulates it, and then fires UPS World Ship, filling in specific fields and printing labels. It also prints text labels for the boxes from BarTender software at the same time. After all labels are printed, a return table of shipping information is sent back to the Accpac accounting software where tracking numbers, shipping fees, and so forth are automatically added to the sales order. At the same time another macro, sensing that something has shipped, processes the shipment in the Accpac software, which generates an invoice and issues-out the inventory.
×
×
  • Create New...