Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,232
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by terrypin

  1. I ran that Regex in my text editor, TextPad, on many files varying in size, number of lines, words and successive spaces. Most were almost immediate in response. Number of lines seemed dominant factor. But note also that I added spaces to only a single line in each file, although some of them also already had longish sequences of spaces. Here are four example results:

    #1 7 KB,  15 lines,  6.7K chars,  most spaces 6.4K = Under 1 s
    #2 289 KB, 60 lines, 289K chars,  most spaces 6.4K = Under 1 s
    #3 111 KB, 282 lines, 15K chars,  most spaces 101K  = Under 1 s
    #4 471 KB, 11K lines, 443K chars,  most spaces 101K  = 5 s

    Those timings would obviously increase if I used a macro to apply the Replace command.

     

    Haven't quite given up on my 'MXPro only' method, but close to doing so!

     

    EDIT: Someone I contacted with real regex skill pointed out a much simpler setting:

    Find: _+
    Replace with:_

    (where '_' is a space.)

     

     

  2. "5. If there is an elegant RegEx solution, the contributors of this forum who know how to implement it have been silent (so far!)"

     

    I'd assumed it had to be done entirely in MXPro? I'm off to bed shortly in the hope that I'll dream up the bit of my approach that's evading me. But if a paste into my text editor is not breaking the rules I'll see if Regex can solve it.

     

    EDIT:

    OK, it came to me a few minutes later. This Regex should do it
    Find
    ([^ ])([ ]+)
    and replace with
    \1

     

    (That's \1 plus a space.)

     

    In english: Find string #1 that is 'not a space', followed by string #2 that is 'one or more spaces', and replace it with string #1 followed by one space.

     

    But the purist in me still wants it done in-house. 😉

     

    Tomorrow...

     

     

  3. Thanks for checking Cory.

     

    With that option disabled it seemed to slow down macro text typing significantly, so I re-enabled it. Have not yet re-tried the problematic macros, but I suspect the issue might be related to the application to which they are scoped, Paint Shop Pro, not MXPro.

     

    If so, it's OT, but in case anyone is curious...

    Today I went to my Win 10 taskbar to open PSP8  and found two thumbnails available instead of just the usual one. Task Mgr confirmed two instances of Paint Shop Pro.exe. I opened one from the taskbar then clicked away and  went back  to try the second - but its thumbnail had vanished. Yet both still existed in TM. I then closed PSP 8 in the normal way - but both instances are still present in TM!

     

  4. I've always had the option shown enabled. But today various normally reliable macros failed and after hours of trouble-shooting (which naturally included increasing delays), I found that disabling this resolved the problem. First time I believe I've ever had to do that.

     

    Anyone else with similar issue or ideas on possible explanation?

     

    This is Win 10, Version 1909 (OS Build 18363.836) and MXPro 6.1.3.1, and CPU usage during running attempts was never significant.

    HardwareTimer.jpg

  5. Quote

    "Is the program definitely active when the macro ends?" at this point I have only 'test run' the macro, so I am not sure that it ends.

    But in that test, a Casper window gets launched and is susceptible to manual mouse clicks.

     

    I was referring to the three line macro you displayed in your opening post. At the end of that.

     

    Quote

    "Try adding a Window Activate before the Enter. " I had done that, but the window stays 'unmoved'. There is an option to specify VARIABLES, but I can not begin to understand what is required there.

     

    Please provide details, including the macro code and a screenshot clarifying what you mean by that mention about variables.

     

    Quote

    "Are you sure another operation is not needed before the Enter?" I am NOT sure. After Casper launches, a selection must be made. I tried to do that with (the right) number of TABs, but that failed to achieve the desired result.

     

    We're looking for  some distinction between the result of your opening 3-line macro (perhaps with the respective additions I've suggested) versus the status after opening Casper manually. You seem to be confirming that an extra step is taken by the latter but not the former.

     

    Quote

    "replace Casper.exe with another program that you know always responds to Enter directly after launch" That is a challenge that will take time to work out.

     

    It's straightforward enough. A simple example would be to use Notepad. (At C:\Windows\System32\notepad.exe or C:\Windows\notepad.exe). After the Enter command, has the macro launched Notepad and then started a new line? That should at least confirm that your macro has no obvious error.

     

    Quote

    "I just run it, so there is no reason to think it needs administrative privileges." is my answer to Samrae’s question.

     

    It's not normally visibly evident that a program is running in elevated mode. Use Task Manager, select the Details tab, ensure the Elevated column is enabled, and check. Or, to repeat, just run in it elevated mode; you can't break anything!

  6. Is the program definitely active when the macro ends?

     

    Try adding a Window Activate before the Enter.

     

    What is the longest delay you tried instead of 1s?

     

    Try a 0.1s after the Enter.


    Are you sure another operation is not needed before the Enter? Possibly a selection that Casper normally performs by default?

     

    Leaving the macro (or its experimental variations) unchanged,  replace Casper.exe with another program that you know always responds to Enter directly after launch. Confirm that it works.


    Try a second Enter.

     

    You didn’t answer Samrae’s question, so we and you are still unsure whether Casper runs elevated. Try his suggestion anyway, just to eliminate that as a cause.
    ————

     

    See the recent thread about email notifications. Bottom line: check back frequently.

     

     

  7. As for my intended approach, getting the 7-character groups into an array proved easy enough. But my assumption that the subsequent manipulation of these would be easy was over optimistic!

     

    Your solution, Alan, incorporating @rberg’s substitution logic looks great to me, well done, and thanks for an interesting thread.

    (Trivial point: it seems you switched to using A instead of L for alphabetic characters,  so your introductory comment needs editing.)

     

    But wish I had learnt VBS 😉

  8. Hi Alan,

     

    I'm sorely tempted, but that would mean raising the task several places up my To Do list!

     

    Another excuse is that because MXPro sadly lacks Regular Expression features I would always tackle this sort of requirement with assistance from another application, usually my text editor, TextPad. Your challenge is akin to asking me to attach a screw without using a screwdriver.

     

    And yet another reason is that I expect you already have a brilliant solution 😉

     

    But if curiosity does get the better of me, then I think I might start as follows:

     

    // @acantor's challenge to extract a single post code from a line of text.
    // No external applications are allowed.
    // Assumption: a reasonable max length of a single address line like the examples provided is 100 characters.
    Variable Set String %tResult% to "" // Just in case.
    Variable Set String %tInput%: Prompt // (Disabled for testing)
    Variable Set String %tInput% to "1234 Chaplin Dr. Twr. 1- 6th floor , Mississauga, ON L4Q 5Z3 Canada"
    Variable Set Integer %nLength% to the length of variable %tInput%
    // A line of that length contains (nLength-6) groups of 7 characters.
    // So my first approach will be to test every group until I find one with the post code format LDL DLD.
    // The parsing of that should then be straightforward.

     

     

    Terry

  9. 6 hours ago, joe said:

    So, we know that MXPro6 has the "Wait for the web page" feature in the Website command (and other commands?).  But you think it needs to be used for browsers other than Internet Explorer, yes?

    If so, then I agree.  I don't think Microsoft even supports IE anymore, but I could be wrong.


    Yes, I’ve always had to write my own ‘wait until ready’ code for Firefox and later Waterfox. That failed occasionally and I no longer bother, usually inserting long delays before I attempt manipulation. A command that will work for those and Chrome, Opera, Edge (Microsoft’s replacement for IE) would be handy. 
     

    Quote

    Do you think that web page automation would be a good feature for MXPro6 or, as Cory mentioned, a new Insight application?


    I would prefer to see extra web-work functionality within MXPro. But I’m not into web stuff much these days so probably not a typical prospect.

  10. Hi Joe, pleased to hear from you after such a long time.

     

    I’m no programmer, but yes I would indeed like to see MXPro offer improved power and flexibility for web stuff, if that’s what you’re asking. A start would be to get a reliable command that would detect when a site is in a ready state to accept further commands. For any browser.

     

    Still occasionally dipping into your excellent book - but how about an update for MXPro under Win 10? 🙂
     

    Terry, UK

     

  11. Invest a little time learning some basics, both about ME Pro and using this forum.

     

    In particular, learn how to quote messages. With text, using the Quote tool, not screenshots. I’ve no idea what your latest post is meant to show us.

     

    Perhaps others with more patience will step in, but as they say on ‘Dragons Den’, I’m out!

  12. I recommend you use ME Pro’s excellent Help to understand this sort of very basic stuff.
    Here’s an extract:

    Copy Command Text - (Script Editor Only) 
    Highlight one or more lines of the macro script. Then click on Edit | Copy Command Text. This option copies the lines of script to the Windows clipboard. Paste the script into another application and the contents are displayed shown in the Script Editor. 
     
    Typically the contents display in a macro format similar to the Direct Editor script when copying the script to the clipboard and pasting. Use the Copy Command Text function to display the contents exactly as they are shown in the Script Editor


    Did you also try to import and run the macro?
     

×
×
  • Create New...