Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. Keep your shirt on, Paul!

    Shirt on!

    You've now introduced a new term, 'stand-alone'. You appear to be saying that the condition 'Don't wait for m2 to terminate before proceeding [with m1]' really also means '...and don't allow m2 access to the variables previously defined with "Make this variable available to macros called by this macro" '.

     

    Is that the case? If so, all would become clear. IOW, does the absence of a checkmark against 'Wait for this macro to terminate before proceeding' mean it is what you are now calling a stand-alone macro, which has the very important property (not mentioned in the dialog) of not having access to variables defined in the calling macro? In direct contradiction to the variable settings?

    Bingo! The "don't wait" setting indeed appears to mean that the called macro has no access to existing variables. Insight could certainly have used better wording for this, but there you are.

  2. Using your example, Don't wait for m2 to terminate before proceeding [with m1] surely doesn't mean that m2 doesn't even start? And if it starts, then the variable should be available.

    "m2 doesn't even start". Why on earth not? If m1 calls m2, of course m2 will start. The purpose of my example is to demonstrate exactly when m2 runs "stand-alone" (i.e. no variable values from the calling macro are available) and when it runs "as part of" m1 (all m1 variable values are available in m2). I thought is was pretty clear.

    As I stated elsewhere, I suggested using F8 to run m1 simply to allow you to see m2's messages in the correct sequence. If you run m1 normally, the sequence of m2 messages may appear to be in the wrong order. I was merely trying to make it easier for you to understand. Apparently, I failed! :rolleyes:

  3. Anyway, why running the macro you attached gives different results while running it using F8 from running it the usual way?

    Using F8 does not produce different results! In this case you need to use F8, otherwise you cannot distinguish between the two calls to m2, since m1 isn't waiting for m2 to finish in one of its calls. I could have inserted logic to handle that but didn't think it was worth the candle!

  4. Hmm, on second thoughts, there's one more think I'd like to know. I am assuming that the variable T[1] is not accessible by the second macro, because macro 1 stops and it's variables cease to exist.

    Wrong!

    - By default, each macro defines 4 array variables of 99 elements called C, D, N and T which are available to called sub-macros. So both macro1 and macro2 "contain" these variables

    - Because macro2 is independent (although it's called by macro1, macro1 does not wait for macro2 to complete), its variables come into existence only when it starts (whether as a result of you running it, or being called by macro1)

    - If macro2 is called by, say macro3, where macro3 does wait for macro2 to complete, then in this instance macro2's variables first come into existence when macro3 starts and are therefore shared

     

    Take a look at this example:

    Macro m1

    Variable Set String %T[1]% to "qwerty"
    Text Box Display: m1 (displays the value of %T[1]%)
    Macro Run: m2 (do not wait for m2 to terminate)
    Macro Run: m2 (wait for m2 to terminate)

    Macro m2

    Text Box Display: m2 (displays the value of %T[1]%)

     

    Run m1 from the script editor using F8. You will see 3 text boxes containing the value of %T[1]%:

    The first box shows qwerty

    The second box shows blank

    The third box shows qwerty

     

    Do you follow?

  5. You just need to run MEP on that server. I do it all the time. Works fine. But if somehow you get MEP to work thru RD I'd be interested to know how.

    In my former job I was using MEP and Remote Desktop all the time, and discovered odd behaviours I could never properly explain.

     

    Here's an example:

    MEP is running on both local and remote machines.

    I have a macro that I want to run on the remote machine if that machine's window is active, otherwise run it on the local machine. It's activated on both machines by Ctrl-G. It determines whether the remote session is active (i.e. the foreground window); if no, then the macro processes locally in the normal way. If yes, then all the macro has to do is Type Ctrl-G, and, somehow, the remote machine's macro runs.

     

    This technique works in 95% of key combinations, like Ctrl-G, but the key combinations cannot ever include the Windows key (having a macro type such a combination never invokes the remote macro, irrespective of what RDP settings are selected).

  6. drive imaging is now a feature of the backup software so I don't need to pay Symantec more to update my copy of Ghost.

    If using Windows 7's Backup utility, make very sure that you are able to restore from it. Unknown to me, Windows 7 scheduled a backup job to run weekly. My backup media is external and therefore not always available. When Windows 7 tried to run the scheduled backup, the external media drive was unavailable, and my entire backup catalog was corrupted, to the extent that the backup I had made earlier was useless.

  7. I am having a problem splitting a string into two other strings. I found that if we have a short input string looking like this: "a.b" and we wanna split it at "." , "b" will not get saved. If we change the "b" to "bc" in the input string, it will work just fine, saving "a" to one string, and "bc" to another.

     

    Can anyone confirm before I report it?

    Agreed. It's exactly the sort of sloppy programming I'd have expected (not properly testing fringe conditions), so it's disappointing that I'm not disappointed!

  8. You can use the Windows Task Scheduler to get down to the second. Actually there are many excellent benefits for using the built in Windows Scheduler. For instance you have more trigger and condition options like being able to run only if a certain amount of idle time has elapsed. Great for CPU or GUI intensive tasks you would like to run 'whenever' but not when you're trying to meet a deadline. But the coolest I think is being able to wake up the PC to perform the task because I like to sleep my PC when not in use to save power.

    But you need to be aware that if you are logged out (i.e. you need to retype your password when the machine wakes), many/most macros will not run.

    In which case, there is a separate technique that can be used, where the computer is automatically rebooted to login without having the user type a password, then runs the scheduled macro, then reverts the computer to requiring a user login, and finally returns to computer to its sleep/standby/hibernate status.

  9. Yes, but in post # 9 I'm explaining that I thought that by the "Is it useful?" question he meant "Is the macro you have useful?". Now, what would give me the impression? The fact that the whole concept he provided above that question is the SAME concept my macro works at the moment. Plus he asked "Does this work as a concept [...]?. So I thought he was just describing my macro's concept to make sure he gets it right (because he didn't understand the way the macro works). So yes, his concept is right, I agree, but it's not different from the concept macro works on now. Nothing revelatory there.

    One final contribution from me: I think your English is letting you down badly here. The point of outlining the concept to you was not to show you that I understood your concept, but to try and persuade you to think about your puzzle from a new angle. Nowhere in my outline is there any suggestion that you have to determine "all combinations within a set of elements"; indeed, it is this very notion that is causing you all your problems. Your insistence on calculating all combinations is exactly what is leading you astray.

    I don't see the necessity or even possibility to rewrite the script

    In which case I think you're on your own because you do not appear at all receptive to other suggestions.

    You did not explain how to do it.

    This is why I prefixed my text with the words:

    don't let's worry about the implementation at this stage
  10. I was referring to the macro usefulness itself, I don't see how this would resolve the problem mentioned in the topic.

    My intention was to suggest an entirely different way of designing your macro(s) as I believe that the code you have written with the multiple nested Repeat loops has no chance of being visible (and therefore viable) in the way you want. In fact, display of this code has caused me several problems, some of which have caused ME to crash. So if my idea is useful (and you have indicated that it is), then I think you should abandon the approach you have adopted, and redesign and rewrite your macro using the logic I outlined.

  11. Ah, a mah-jong player perhaps? Are you any good?

     

    - Create an array of n rows by 200 integer columns (where n is the number of rows you will process).

    - Yes, however the array is stored as a string variable

    Suppose a 2-row array of these values:

    100 1000

    21 8810

     

    A numeric array will correctly sort these rows as

    21 8810

    100 1000

    while a string array will produce the opposite.

     

    Mind you, using Macro Express you can force all pixel values to be zero-filled to the left and 8-characters long, in which case strings will work fine.

     

    For an outstanding sort utility, take a look at this:

    RpSort

    (FYI I came across this utility in the early 1990s, and corresponded briefly with the author. A little while later the utility was published in a slightly different way - in fact, by his brother after the author's sudden and very untimely death.)

     

    Is this useful?

    - Hell yes.

    Does this mean you have sufficient information now to resolve your problem?

  12. Does this work as a concept (don't let's worry about the implementation at this stage)?

     

    - Create an array of n rows by 200 integer columns (where n is the number of rows you will process).

    - Populate the array with the pixel values

    - Sort the array

    - Eliminate duplicates (do you need to remember eliminated line numbers?)

    - Process the array to determine the smallest number of elements that render each line unique

    - Create output

     

    Is this useful?

  13. I attach "code" that you should use to create a macro that finishes only when Firefox's toolbar X reverts to its normal loaded state (or after 100 iterations in case the site never loads). You'll probably have to change the pixel values in lines 8 and 12, and perhaps the location too in line 7.

    You should be aware that in some circumstances Firefox is still not ready to continue even when the X has reverted. This explains the code from line 19 onwards: if the calling macro needs this macro to wait extra time, it specifies the number of seconds to wait in the allocated registry value. If you want to use this feature, you'll need to allocate a value at an appropriate location in the registry, and change the code in lines 19 and 23 to reflect that revised location.

    If Not Program "FIREFOX.EXE" is running
     Macro Stop
    End If
    Window Activate: Mozilla Firefox
    // Check X, wait until not red
    Repeat Start (Repeat 100 times)
     Get Pixel Color at (140, 66) Relative to Current Window into %N99%
     If Variable %N99% Equals "13128728"
       Delay: 250 milliseconds
       Continue
     Else
       If Variable %N99% Equals "10791339"
         Repeat Exit
       End If
     End If
     Macro Stop
    End Repeat
    Delay: 1 seconds
    Read Registry Value "HKEY_CURRENT_USER\Software\Professional Grade Macros\PhtData\FirefoxAfterLoadDelay" into %N99%
    If Variable %N99% Is Greater Than "0"
     Delay: %N99% seconds
     Variable Set Integer %N99% to 0
     Write Registry Value "%N99%" into HKEY_CURRENT_USER\Software\Professional Grade Macros\PhtData\FirefoxAfterLoadDelay
    End If

  14. If you think it is possible to make a macro that will provide all combination within certain set of numbers, without an enormous number of loops contained within each other, I'd love to know how. I want to make clear that at one cycle, the "whole repeat loop" provides one unique combination that wasn't already calculated before. If the numbers were calculated without the consideration of the other numbers, it would lead (and I can confirm IT DID) to a situation when certain combination are calculated more than once. Here's an example:

     

    1 2 3 4

    2 3 4 1

    3 4 5 2

    4 5 1 3

     

    Those four above combinations are all the SAME. One of them is enough, no need to check 2341 if 1234 was already checked. That's why all the repeat start/end commands are contained within each other, to eliminate unnecessary calculations and save time.

    Thanks for providing your detailed and very interesting description.

     

    I don't follow here.

    How are the 3rd (3 4 5 2) and 4th (4 5 1 3) lines the same as any of the others? I can see that lines 1 and 2 contain the same numbers, whereas lines 3 and 4 are both unique. What am I missing?

     

    And I don't understand the output. WHat are the 6 pixels in each line formed from?

  15. Is it possible to schedule a macro to run at a particular time of day? If so, what are the steps to scheduling a macro to run?

    Alternatively, you can create an operating system scheduled task to run the following command daily at a certain time, or once, or weekly on certain day(s), etc. This method offers more capabilities, e.g. wake the machine up to run your task (but you may need to create an automatic login procedure):

    QualifiedPath\Meproc.exe /AYourMacroName

    where QualifiedPath is the fully qualified path to Macro Express, e.g. "C:\Program Files\Macro Express"

×
×
  • Create New...