Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,203
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. How would you choose the option if you had only the keyboard to work with, and no mouse?  If the menu is a dropdown list, and if it is organized alphabetically, then usually you can position on the head of the list and just type as much of the entry text as you need, followed by the ENTER key to select it.  Your macro can do the typing.  If it's NOT that kind of list, then that won't work.  Need more information about your specific situation ....

  2. Thanks for the feedback.  Glad you have been successful.  I used to work for a hospital, too. We used the Eclipsys SCM system.  Sometimes I would have to apply identical maintenance to dozens or even hundreds of database entries.  We weren't permitted to do direct table maintenance via SQL, so we had to use the application maintenance screens, and macros saved me HUGE amounts of time clicking through screens and typing.  It takes some effort to set up the macros, but often much of the code is reusable for similar functions. 

  3. First off, get rid of the MACRO STOP which is the second-to-last line of the macro.  The macro will stop when the ASCII FILE processing loop is done, without your telling it to stop.  

     

    The loop that is repeated in your macro begins with ASCII FILE BEGIN PROCESS and ends with ASCII FILE END PROCESS.      Each time through the loop, only a SINGLE LINE from the file is made available in the %T% set of variables.  So you should do all the initial typing, including the ARROW UP and F10 to remove the system-inserted data.  

    THEN you can have the sequence
    ASCII FILE BEGIN
    TYPE T[3] (stuff)
    TYPE <ENTER>
    ASCII FILE END
    That loop will feed you all the T[3] entries one after another and type them.  
    Actually, since some of the third column entries are empty, this might work better:  
    ASCII FILE BEGIN
    IF T[3] NOT EQUAL “”
        TYPE T[3] (stuff)
        TYPE <ENTER>
    END IF
    ASCII FILE END

     

    Once all of the third column is typed, position on the screen and repeat the entire loop to type in the fourth column:
    ASCII FILE BEGIN
    IF T[4] NOT EQUAL “”
        TYPE T[4]
        TYPE <ENTER>
    END IF
    ASCII FILE END

     

    I don’t think anything prevents your repeating the ASCII FILE BEGIN through ASCII FILE END as often as you want in the macro.  Each time it will process the whole file from beginning to end, and you can pick off whatever column(s) you want during each pass.  For example, since columns 1 and 2 are only in the first line of the file, you could have a separate BEGIN through END just to pick up that line and type those two columns.  (I think there is an option with ASCII FILE BEGIN to process only a single line, so you wouldn’t have to read through and ignore all the other lines just to get line 1.)    

     

    So one ASCII BEGIN / END loop to handle the two columns of the first line.
    A second BEGIN/END loop to handle as many third column entries as there are.
    A third BEGIN/END loop to handle as many fourth column entries as there are.  

     

    Good luck!

     

     

  4. 16 hours ago, acantor said:

    Windows XP -- an OS that Microsoft stopped supporting more than five years ago, and that very few people use anymore

     

    Yes, I heard a news story about that.  Apparently a lot of computers worldwide DO still use XP, partly to avoid large upgrade costs.  Cost is way more than the software payments to Microsoft.  Look how many simple and straightforward things change, or stop working entirely, with new versions of Windows.  If a company has mission-critical systems tested and tweaked and working well on XP, it is daunting to consider the fallout from replacing hundreds or thousands or more PCs and servers.  Ditto an organization with super high security or reliability concerns, where every tiny change has to be certified eight ways from Sunday -- I wonder how many military weapons systems still rely on XP (if they are even THAT advanced😮). 

  5. Look at Options | Preferences | Playback | Miscellaneous Tab to see the built-in ways to stop a macro.  Also, in the Help screens, look at the "Abort Macro" topic.  If you need to get more complicated, such as triggering a macro that will then stop another macro, it can get a lot more complicated.   

     

    I don't think the trial version is crippled in any way -- it just stops working entirely after a certain time if the license code is not applied.  You're lucky the corporate office will allow you to install the product, innocuous as it is.  I have seen places where a few simple macros would be tremendous time savers for staff, but they couldn't get permission to use the product.  And it's so inexpensive compared to some software that companies pay vast amounts of money for.  I bought my first copy out of my own pocket and installed it back when there weren't several layers of management approval required. 🤗

  6. 5 hours ago, MCH said:

    My workaround is to use AutoHotKey to capture keystrokes and then run MacroExpress macros. For example, in AHK the script

    "F9::run, C:\Program Files (x86)\Macro Express Pro 6\MeProc.exe  /AMinimise" will react to a user pressing F9 by running my MacroExpress macro "Minimise" which minimises a window ... the fact that AHK is able to intercept keystrokes where MEP cannot has me scratching my head.

     

    Clever workaround.  I used to have a great programmable keyboard that could do something like that -- one key would send keystroke combinations or sequences, so I could start macros by a single keystroke rather than by using both hands and a whole bunch of fingers simultaneously.  It's good to know that AHK can do this, and I'm also at a loss as to why it can intercept but ME can't. 

  7. 55 minutes ago, GDZ said:

    would there be anything to gain by saving the text to a text variable and then have it posted from the variable instead of the clipboard?

     

    For small amounts of text, it is practical to use Text Type to type the text in from a variable.  Typing will be slower than using the clipboard, but perhaps more reliable and predictable.  Just don't set the keystroke speed so fast that the "typing" overruns how fast Windows and the application can accept keystrokes. 

     

    Keystroke Speed: 10 Milliseconds

     

    There is a Macro Express "Preference" that applies an automatic time delay after each ME clipboard action.  I haven't found it very useful, because to rely on it you must set it for the worst possible case (longest delay you will EVER need), and that will penalize the many macros that need very short delays.  Probably better to use a delay command following the clipboard command, as you did, because you can tailor each delay to the particular situation. 

  8. 1 hour ago, GDZ said:

    By inserting a delay of 750 milliseconds, it worked okay on the test I was running.

     

    Clipboard copy and paste are Windows functions, and Macro Express can't really tell when they will finish.  They can be problematical in macros.  After all, ME is simply entering the Ctlr-v to paste, like you would enter it from the keyboard.  Doing it manually, you watch the screen and naturally you don't go on to the next step until the pasting is complete.  But ME has no inherent way to watch for completion, unless you program it into your script. 

     

    Depending where the data is copied from, and where it is going, Windows does lots of work to format it for the target location.  For an example, go to this web page, do Ctlr-a to highlight the whole page including images, Ctrl-c to copy, then Ctrl-v to paste into Microsoft Word.  On my machine, the paste takes almost three seconds.   

    https://forecast.weather.gov/MapClick.php?lat=41.7638&lon=-72.6739

  9. I don't fully understand what you are doing, but I wonder if the macro is typing things faster than the application or web form can accept them.  You could try putting a one second delay between each TYPE command, and see if the problem goes away.  Then start removing the delays, one at a time, until you determine which one(s) are overrunning the application. 

  10. 1 hour ago, acantor said:

    Macro Express executes repeat loops astonishingly quickly.

    I think it's a good idea to embed a time delay within almost every loop.  If the macro is watching for a screen change, I usually use a 100ms delay -- 1/10 of a second -- on each pass through the loop.  That provides almost instant response in terms of human perception.  It also makes it easy to specify how long the repeat loop will run.  For example, if you want it to keep repeating for 10 minutes, then 600 repeats with 1-second delays will in theory accomplish that.  Or 6,000 repeats with 1/10-second delays.  When quick response is not an issue, I have macros that wait 10 or 15 seconds during each repeat.  A repeat loop with no embedded delays can eat up a lot of processor power for no particular benefit. 

  11. I think Wait For Time to Elapse is pretty accurate.  Before starting the repeat loop in the primary macro, set some flag, like maybe store zero in an environment variable.  Then start a second macro which does the Wait For Time, and changes the variable from zero to one at the end of the delay.  In the primary macro's repeat loop, check the variable and exit from the repeat loop when it becomes one rather than zero.  You can check the variable every time through the loop, or every tenth time or hundredth time or thousandth time depending on the precision you want and how rapidly the repeated code executes. 

     

    Make sure the two macros are allowed to run simultaneously. 

     

    You can check how accurate the Wait is with a simple two-line macro, comparing to a wall clock or stop watch or whatever:

    //  
    Wait Time Elapse: 0 Minutes 22 Seconds
    Text Box Display: time over
    // 

  12. 1 hour ago, jsampsonyyyyy said:

    <control down>c<control up>

    I have had enough weird troubles with "<control>character", and with "<alt>character", that for years now I haven't even bothered with trying them.  I ALWAYS use the separate <down> and <up> sequences, and they always work.  And yet other people insist the simpler sequence works fine for them.  Go figure. 

  13. Try some method other than "MacroRun" for Macro2 to start up Macro1 -- for example, by having Macro2 create a file and starting Macro1 based on the Directory Modification trigger.  Or (simpler) start Macro1 when Macro2 places some unique data into the Clipboard.  Either way, the triggering of Macro1 by Macro2 will be asynchronous (I like that word) to whether Macro2 keeps running or not, so you should be able to terminate Macro2 immediately after creating the trigger.  Clipboard trigger seems simpler, as long as it doesn't interfere with other stuff that is going on, either within or outside of Macro Express.   

     

    Draw a little flowchart, so when you come back to these macros six months from now, you will remember what the heck you did.  🧐

  14. 5 hours ago, acantor said:

    I would be curious to know how long my code takes to run on your computer with, say, a string of 5000 characters.

     

    My processor is Intel Core i3-2370M CPU @ 2.40GHz 2.40GHz.  I don't know what that means.  

     

    Here's the ME routine I tested with.  I built a Notepad document so I could easily modify the number of characters for tests.
    The first couple lines, copying to clipboard, took no more than a second or so, even with 500,000 characters.
    Setting string T1 from the clipboard took many seconds, maybe 15 or 20 seconds, with 500,000 characters.  Very fast with only 5,000 characters.   

     

    Displaying the "release" text box allows estimating the actual scan time (your code) -- that is, from the time I hit ENTER
    to close the "release" box, until either the "contains" or "contains none" box appears.  

     

    So, to finally answer your question, your code runs almost instantaneously whether I start with 5,000 characters or with 500,000.  I used Macro Return rather than Macro Stop like you did, but I doubt that matters much.  


    //  
    Text Type: <CTRLD>a<CTRLU>
    Macro Run: 0_Generic_Copy_To_Clipboard
    Variable Set String %T1% from Clipboard
    Text Type: <END>
    Text Box Display: release to start process
    Variable Set Integer %N1% to 0
    Repeat Until %N1% > 9
      If Variable %T1% contains "%N1%"
        Text Box Display: contains
        Macro Return
      Else
        Variable Modify Integer: Inc (%N1%)
      End If
    Repeat End
    Text Box Display: contains no digits
    Macro Return
    // 

    • Like 1
  15. 35 minutes ago, MakaPakaTobyHannah said:

    Too bad one cannot construct a loop like acantor’s digit loop for all the letters of the alphabet (there is no secret "increment" way of cycling through all letters, is there?).

     

    See my suggestion above.  Because the ASCII codes for all letters are grouped in a single range, you can code two IF statements instead of twenty-six.  I think that will work.   

     

        Variable Modify String (the one character you are examining) to upper case

        IF character greater than or equal to A
        AND
        IF character less than or equal to Z
        then it is alpha

        END IF

     

    http://www.columbia.edu/kermit/ascii.html 
     

  16. 2 hours ago, acantor said:

    I just tested my script with lengthy strings. It fails when the string is too long. But 500 characters seems to be OK.

     

    It's odd your script would fail with long strings.  I tested it with a string over 400,000 bytes long, with digits near the very end.  (Though I ddin't use a Repeat loop, just hard-coded multiple IF CONTAINS statements.)  It took awhile to run, but worked fine.  Timeout of some sort, maybe? 

  17. 4 hours ago, MakaPakaTobyHannah said:

    convert it to an integer and then compare the integer to the string. If they are identical, then I know that the string item consists of digits only

     

    For that to work, I think there is a limit to the size of the integer.  For example, the lines below always return "01234567899" in the Text Box Display, once the Set String exceeds 10 digits.  Comparing the string to the integer would not result in an equal condition. 

     

    Variable Set String %T1% "0123456789987654321001234567899876543210012345678998765432100123456789987654321001234567899876543210"
    Variable Modify String: Convert %T1% to integer %N1%
    Text Box Display: %N1%

     

    I think your best bet is the "annoying way" that Cory originally suggested.  if the ONLY special characters that can be there are "[" and "]", the job is simpler.  If ME had commands for inclusive OR, exclusive OR, and AND, for string variables of different lengths, it would also be simpler. 

     

    But it's an interesting question.  I will keep trying to think of an ingenious solution.  🙂

  18. I can't think of a way to do it without checking every character.  It shouldn't be necessary to
    compare every character to A, then to B, then to C, and so on -- you can reduce the number of IF
    statements involved by looking for ranges.  For example,

     

    Variable modify entire string to uppercase
    Repeat for each character
        If character >= A
        and
        If character <= Z
        ...
        ...
        If character >= 0
        and
        If character <= 9
        ...
        ...
    Repeat end

  19. What bugs me is applications that reserve keys to themselves, and block other uses.  For example, I use the keypad minus sign to trigger a macro that clicks the X at upper right to close a window/application.  It works for almost everything, but Adobe Accrobat Reader blocks it before ME can see it, so I have to remember to revert to Alt-F4, or manually control the mouse, to close it out. 

×
×
  • Create New...