Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,203
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. A hex value expressed by two characters can be anything from x'00' to x'FF', which is decimal 0 to 255. So you could (1) Generate a random integer from 0 to 255. (2) Using Macro Express's integer arithmetic, divide the generated integer by 16, ignoring the remainder, and you will have a quotient from 0 to 15 representing the leftmost hex character. (3) The remainder from the above division will likewise be an integer from 0 to 15 repesenting the rightmost hex character. (4) Use a simple lookup array, or a series of IF statements, to convert the two integers to letters/numbers. IF QUOTIENT = 0 THEN LEFTLETTER = '0' IF QUOTIENT = 1 THEN LEFTLETTER = '1' ... ... IF QUOTIENT = 14 THEN LEFTLETTER = 'E' IF QUOTIENT = 15 THEN LEFTLETTER = 'F' ... ... IF REMAINDER = 0 THEN RIGHTLETTER = '0' IF REMAINDER = 1 THEN RIGHTLETTER = '1' etc. There is probably a more elegant way to do it, but I'm into brute force this morning.
  2. On a couple occasions I set up ME on an always-active network server to do off-hours functions like this. Depends whether you have such servers available, whether you have permission to use them, and so on. You might not even need ME if you can use the Windows scheduler on the server to start the job.
  3. From Samrae's example -- would this work, to launch it directly from ME without a batch file? Program Launch: "Powershell.exe"
  4. Go methodically through the commands and use them one by one in very simple macros. Use the Help system. When you do something for learning purposes, make frequent use of Text Box Display so you can see the result. Sounds tedious and probably is, but I should have done it early on. I still occasionally find command options that I have never used. A couple simple examples: // Variable Set String %T1% " ABCD " Variable Set String %T2% " EFGH " Variable Modify String: Append %T2% to %T1% Text Box Display: T1 result is ***%T1%*** Variable Modify String: Trim %T1% Text Box Display: T1 result is ***%T1%*** // Variable Set String %T1% "000123" Text Box Display: T1 result is %T1% Variable Modify String: Convert %T1% to integer %N1% Text Box Display: N1 result is %N1% Variable Modify Integer: Convert %N1% to text string %T1% Text Box Display: T1 result is %T1% //
  5. Didn't you already ask the first question in another thread? I believe the answer was, the scheduled macro will not run again if the previous instance is still running. I would recommend you do some testing to make sure that is true. For your related question, this should work: 1) When your macro starts, create a temp file -- let's call it marker.txt. 2) Start the batch script. 3) Use a Repeat loop to check over and over for the existence of marker.txt. Do not exit from the Repeat loop as long as the file exists. Somewhere inside the Repeat loop, include a few seconds delay -- this is just so looping won't chew up so much processor time. 4) As the last step in your batch script, delete marker.txt. 5) Next time the macro goes through the Repeat loop, the file will no longer exist, so exit from the Repeat and the macro can continue with whatever else it needs to do.
  6. This is what I think Cory is saying, simplified just a little: :BEGIN (generate a random number between 60 and 120) Repeat until RAND > 60 Variable Set Integer (random) RAND (max 120) Repeat end Repeat until RAND = 0 Wait for time to elapse (1 minute) Subtract 1 from RAND Repeat end Do whatever stuff the macro is intended for GOTO :BEGIN This will ALWAYS wait between one and two hours, though you said you want it USUALLY to wait that long. You can expand the random number range if desired to get some times less than an hour or more than two hours.
  7. The Macro Express Help feature is good for looking up something like this. I found the following note: Note 1: If a macro is scheduled to run every 1 second and the macro takes 5 seconds to execute, then this function will not operate properly. A bit ambiguous. I tested with a very simple macro scheduled to run every 15 seconds and display a text box that went away only when I clicked OK. If I did not click to allow the macro to end, a second text box did not appear no matter how long I waited. Don't know if the second (or third or fourth etc.) instance was queued, or was running but frozen, or what. You could set up a test macro and experiment with various timings to get a better feel.
  8. Take a look at Cory's suggestion, though -- his is simpler to program. Execute the macro only once, so it does its thing then idles for the random time before doing its principle function again, generating a new random interval, and so on. You don't even have to intervene to start it running, just schedule it to run when Macro Express is started. My thinking is kind of stuck at the Macro Express 3 level which doesn't allow for more than one macro to run at a time -- therefore I missed the option of having your macro run only once for a duration of many hours or even days. With ME3 if the macro runs continuously, then no other macros can run. With ME Pro a long-running macro doesn't block other macros from running.
  9. Schedule your macro (with Macro Express) to run every 1 minute. Durin each run of the macro: If "timer file" does not exist, generate a random number between 60 and 120 (because you want between 1 and 2 hours). Store the number in a text file ("timer file"). If "timer file" DOES exist, read it, decrement the number by 1, and check whether the number has reached zero. If not, store the new (decremented) number in "timer file" and exit from the macro without doing anything else. If time HAS reached zero, delete "timer file" and do whatever other stuff the macro is intended for. Because you have deleted "timer file", next time the macro runs 1 minute later the whole scheduling process will begin again. If you have Macro Express run your macro every 5 minutes, instead of every 1 minutes, then the decrement described above would be 5, not 1. And so on -- since you have a fairly broad time range for your random runs, it is not really necessary to check "timer file" as often as every minute. Somebody will probably embarrass me with a much simpler method, but that's all I have come up with for now.
  10. Thanks for the clarification. Perhaps you could add a few lines to the Macro Express HELP topic to explain this. I admit it seems intuitively obvious what the Wait should do, but obvious isn't quite good enough for some of us literal-minded OCD folks.
  11. I set up a test macro to copy a large block of text, switch into Notepad or Word, then type the text. After typing it displays the begin and end time for typing. I could detect no difference with and without the Wait Text Playback. So, I don't know what the command is good for, either. I wonder if it had some use in much earlier versions of Windows. // // Variable Set Integer %N1% from Current Minute Variable Set Integer %N2% from Current Second Text Type: <CTRLD>a<CTRLU> Delay 300 Milliseconds Macro Run: 0_Generic_Copy_To_Clipboard Variable Set String %T1% from Clipboard Delay 300 Milliseconds Text Type: <ALTD><TAB><ALTU> Delay 500 Milliseconds Text Type: %T1% Wait Text Playback Variable Set Integer %N3% from Current Minute Variable Set Integer %N4% from Current Second Text Box Display: Begin / End Times // //
  12. Are you saying you have it working with Macro Express? What settings?
  13. Here are a couple links I found through Google. I tinkered a bit but didn’t get it to work yet. Basically a script file and a batch file to execute the script. If you can get it to work then you can run (launch) the batch file from Macro Express. Script “testgmail.ps1”: $EmailFrom = “myemailname@gmail.com” $EmailTo = “addressee@yahoo.com” $Subject = “test subject line” $Body = “test text” $SMTPServer = “smtp.gmail.com” $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) $SMTPClient.EnableSsl = $true $SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“myemailname”, “myPasswrd”); $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body) pause Batch file: cd\windows\system32\WindowsPowerShell\v1.0 powershell c:\temp\testgmail.ps1 pause https://superuser.com/questions/80255/send-email-via-gmail-from-command-prompt https://www.howtogeek.com/120011/stupid-geek-tricks-how-to-send-email-from-the-command-line-in-windows-without-extra-software/ Edit: edited this post to give the script file name the extension "ps1" instead of "txt".
  14. I tried your settings with Macro Express version 3 and got the same error you did. I changed the port to 25 and got the "success" message from two send commands, and the ME email log showed success, but neither recipient got the mail, and my gmail account does not show the messages in its Sent folder. Sorry, no help from me. But please post again if you figure it out because it would be handy to have it working.
  15. Very clever. So when you have extracted an item from the list, on the next pass you can type the item then <ARROW DOWN> to get the subsequent item, and so on???
  16. If you have to do it on a regular basis, experiment with Page Down followed by Arrow Down -- loop within loop. It might work if Page Down consistently advances by a predictable number of rows. (What the heck, you have solved your problem, but aesthetics demands an elegant solution instead of brute force.)
  17. Make peace. I don't understand why this is a problem. If you want fewer passes through the Repeat loop -- lower processing overhead -- do something like Variable Modify Integer: %x% = %x% / 10 Repeat with Variable: Repeat %x% times Text Type: <ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN><ARROW DOWN> End Repeat Or put the loop in a separate macro that you call (run) from your main macro. It will at least LOOK a little cleaner.
  18. If the Launch command is freezing ME, you could try launching PaintShop Pro indirectly. Write a simple batch file "start_paintshop.bat" which consists of two lines: start c:\path\paintshoppro.exe exit Then in your macro, launch the batch file: ProgramLaunch c:\path\start_paintshop.bat You might need a brief pause after the launch for it to complete, or a short loop to mark time until PSP is running. Might work.
  19. Can I, using one "if variable" statement, check to see if my generic variable has any ONE of those numbers and to return the message as a result? The short answer is no, you can’t. The longer answer is, take a look at SWITCH / CASE in the Help section. Still a lot of lines to code, but it’s more readable than a bunch of IF / OR / IF / OR … commands. How about dividing your result integer by 12, then checking the remainder? You would still need an IF or CASE for each month, but not half a dozen or so for each month. As far as I know, Macro Express does not just give you the remainder when you divide integers, so you will have to divide by 12 then multiply the result by 12 and subtract from the original. Or code a loop to subtract 12 over and over until the result is less than 12. If the data from the user is text you will have to convert to integer (Variable Modify Text) before doing the math. Probably easiest of all: convert text string to decimal, divide by 12, and check the decimal portion of the quotient to determine the month -- 0.08 is January, 0.16 February, 0.25 March, and so on.
  20. I have never worked with macros on two monitors, but I will take a stab at your problem. Maybe someone else will step up and give a better answer. 1) You can use command "Variable Set Integer" to get location/coordinates of the current window. So if the relevant application's window has focus you can check which monitor it is on. You may be able to get coordinates also with the "Get Control" command even if the window doesn't currently have focus -- I'm not sure of that. 2) When you code a menu in Macro Express, you can tell it the coordinates at which to display the menu, so hopefully you can pick spots that are reasonable on each monitor even if people use different resolutions. (You can get their screen resolutions also by the "Variable Set Integer" command, if you need to.) I don't think you can change, on the fly, the location to display the menu. But you could code the same menu two times in the macro, at different display locations, and say something like IF WINDOW-TOP-LEFT-CORNER LESS THAN 1920 DISPLAY LEFT-MENU ELSE DISPLAY RIGHT-MENU END IF I know you said you would like to tether the menu to a program, but the best I can come up with is to check window name(s); and code some logic to position the menu because I don't think it can be automatically tethered. Good luck, feel free to ask more questions, and let us know how it works out.
  21. www.macros.com/download.htm You should be able to apply the same license code you used for your initial installation and for your last upgrade.
  22. Automated. The macro scans the clipboard text for identifiers, then finds a value after the third subsequent dollar sign for each identifier.
  23. I have a macro to do a similar thing, but on a smaller scale -- a dozen or so values rather than your 50. Rather than use a text file, I copy the whole screen to the clipboard, extract the fields I want into ME variables, switch once to Excel, Ctrl-Home to the first cell, and type arrow keys to get to the desired cells to type the variables. It is very fast and reliable, but it doesn't do Excel in the background like you would prefer. The logic to make sure there are no missing fields is in the extraction macro.
  24. Good thinking! Though I can't quite "logic" out why that works. I would have guessed Repeat Delay would make the difference, rather than Rate. Now that you have me thinking about it, I lengthened my Repeat Delay, because maybe the short delay accounts for some of the the double-character errors I have been making lately with my typing. I was blaming sluggish fingers or sticking keys, and it never occurred to me to blame the keyboard settings. (Sorry, this has nothing to do with ME macros, I'm just happy to get rid offff thoose exxtra chaaraactters I have beenn typping.)
  25. Just as an experiment, try "Keystroke Speed: 1000 Milliseconds". It will be excruciatingly slow, but if it works then you know timing is the issue and you can experiment with other speeds. Or maybe do the opposite of my second suggestion: use the Text Type option that pastes from clipboard. Though that option has always been troublesome for me.
×
×
  • Create New...