Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. ME v3 doesn't support this at all. Neither does MEP, except that it can provide the structure to allow such a facility to be developed (I have constructed exactly what you're after in MEP - it runs to 39 macros (1 macro for each keypress I potentially want to be able to monitor - all of which are identical except for the keystroke they detect - and 3 control macros).

  2. I don't think I've ever even noticed Process Event before! But I'm having trouble identifying the process in this case. Later today I'll dust off SysInternals Process Monitor and see if that helps spot it.

    Wait until the app's window opens, start Task Manager, use the Applications tab, right-click on your app's window name and select Go To Process.

    BTW, have either of you ever used a System Event activation? I'll have to study it as I don't grasp it at first reading of Help.

    No, but, under Windows 7 Professional, I do have this scheduled event, which runs when I awake the machine from standby:

    - Trigger: On an event

    - Log: System

    - Source: Power-Troubleshooter

    - Event ID: 1

    Using this scheduled task, I can, of course, run a macro if I want.

  3. Why is your loop so slow? Within each iteration of the loop:

    - you are doing a text box display and close

    - you are doing a Window Activate and Wait For Window

    - you are doing a Wait for Mouse Cursor

    - you are extending a selection of cells instead of selecting the start and shift-selecting the end cell just once

     

    And it doesn't run reliably on my machine, probably because you are typing stuff too quickly for the macro to react properly. You could rewrite this macro to remove the loop and do your operation just once, as in:

    - solicit the number of cells you want to select

    - click on the 1st cell

    - move to the last cell

    - do a shift-click

     

    There are even better ways to do this using Excel objects and methods, but it shouldn't be necessary to use that approach here.

  4. I don't think that will work Paul because he's using the message box in the Email Send command.

     

    You might use a substitute character like ampersand and instruct them to replace the ampersand with a percent sign.

    I must have missed something! He said earlier he was using the text type command

    ... and then I am using the Text Type command to output the variable to an open email message.

    and since my code is also using the Text Type command, it looked straight-forward to me.

  5. I wish MEP to be more flexible with its time-scheduling features and the easiest way I can see is to allow multiple time-schedules (those that currently provided by MEP) whose condition are joined with a Boolean "AND" or "OR".

    Easiest for you perhaps? Certainly not easiest for Insight, and entirely unnecessary. Simply create 2 scheduled macros according to your criteria above, then have the body of logic in a 3rd macro that is run by either of the other 2 macros. I wish you'd stop making facile requests for features that are unnecessary, and which appear to be of interest only to yourself.

     

    In any case, this isn't the place for requests for new features - Insight provides an alternative method for this, if you could only take the time to discover.

  6. My point is why can't Window scheduler just switch off the chkdsk /r task after it fails to complete in its very first try? Window scheduler is not that POWERFUL, right?

    I don't think you understand how a scheduler works.

     

    A scheduler is designed to initiate a specified task at its first appointed time, then reschedule the task so that it will be able to run at its next appointed time, if relevant. Once the task has been started [and rescheduled], the scheduler has completed its job. It does not hang around, waiting for the task to complete and report back its success or failure.

     

    Once you understand that, then you can see that a task is therefore either to run once only, or to run repeatedly at various intervals. If the task is to run once, then that task's next run time is Never. In the case of Windows startup tasks, they are presumably scheduled to run each time Windows boots, and it is the task's responsibility to "delete" itself when it has run successfully. In your particular case, the job failed and so remained to be run again next time Windows was restarted.

     

    And if you think about that strategy for a moment, then you will see that the key requirement for the chkdsk task was to complete successfully, because until that happened, there was no guarantee that your disks were in good order. In the circumstances you describe, you really have no idea what state your disks are in because of that recurring BSOD. For the continued health of your system I really think you need to get to the bottom of that issue and resolve it properly.

  7. That can be true if you are comparing it to just MEP's activation Schedule feature. If you consider the codes in a macro of MEP, then I don't see anything else (besides your turn on sleeping computer) that can be done by Window Scheduler but a MEP macro.

    Really? Have you looked at the Windows (7) Scheduler? You can schedule tasks to run even when the user isn't logged on (try that with MEP and see what happens :rolleyes: ), there's a plethora of events you can use, etc., etc. As I said, it's far more powerful than MEP's, but, for the most part, I think MEP's scheduler is adequate for its purpose.

  8. But Windows' bult-in scheduler can't set any condition which is not time/date related, right?

     

    Since I am running MEP all the time, I don't find it a good idea to run more than one scheduler programs...

    I disagree with you about what I expect of a scheduler. IMHO, a scheduler should be able to schedule programs according to various date/time criteria. Once you start examining specific files for their dates and times, you should be processing that logic in a user-written program.

     

    The Windows scheduler is much more sophiticated and powerful than MEP's, and includes the ability to turn on a sleeping computer.

  9. I somehow feel that there is still very big room for improvement in Macro Express's schedule feature. Use your guideline as example, the first two 'If'' are suppose to be in the 'Activation' portion of a macro, there should be a single 'if' (i.e. condition) checking - against the file date in codes.

     

    If MEP provides pick Sunday ... Saturday of a week, why not add also, pick 1-24 hours of a day and pick Jan - Dec of a year?

     

    If MEP can provide Run a macro from time X to time Y in a day, why not include also, from day X to day Y of a week and from month X to month Y of a year.

     

    All these shall save a lot of coding if one has quite a number of scheduled macro that required any of them.

    You can always use Windows' bult-in scheduler (which is far more sophisticated than MEP's) to fire off macros. I'll leave you to take a look at all the things you can do with the Windows scheduler - the command line you require is:

    "x:\Macro Express Pro\meproc.exe" /AMyMacro

    where:

    - x: is the fully qualified name of your Programs folder, e.g. C:\Program Files, C:\Program Files (x86)

    - MyMacro is the macro name of the macro you wish to run

     

    Of course, you won't need to include in your macro any of the date stuff, though you will still have to compare the file year and month with today's year and month.

  10. Below is the outline of a macro that should solve your problem. I have assumed you know MEP sufficiently well to turn it into real code.

     

    This macro is activated via ME's scheduler:

    - Schedule it to run each day at 9pm

    - Tick the box "If the activation was missed, run at the next available time" (if the computer is off at the appointed time, when you next turn on the computer, the macro should run)

     

    Macro Outline

    - Get today's date in a text variable using format mm (tMonth)

    - If tMonth is neither 03 nor 09, exit the macro (note the leading zero as we are dealing with a text variable)

    - Get today's date in a text variable using format dd (tDay)

    - If tDay is more than 07, exit the macro (note the leading zero as we are dealing with a text variable)

    - Get today's date in a text variable using format yyyy (tYear)

    - Convert tYear to integer (nYear)

    - Get today's date in a text variable using format mm (tMonth)

    - Convert tMonth to integer (nMonth)

    - Get the file's Modified Date/Time Month and Year only (nFMonth and nFYear)

    - If nYear equals nFYear AND tMonth equals nFMonth, exit the macro

    - Display your reminder message

     

    Notes

    - I have kept this macro simple so that it does only one thing at a time (for example, we could have retrieved Today's Date only once and then extracted the various substrings needed).

    - Names in parentheses simply identify specific variables used in the following line, where the first letter of the name identifies its type, e.g. t for text, n for integer.

    - This macro will run each and every day, and takes an imperceptible amount of time to run, even when it displays its reminder message (only on 14 days each year).

    - If the computer is not switched on at 9pm, this macro will not run: instead, it will run when you next start Macro Express. We could make this more sophisticated and have it turn on your machine at 9pm each day, but that would involve using the Windows scheduler; however, if your computer is off at 9pm on the 7th of March or the 7th of September and you don't turn your computer back on until the next day, this macro will not display any reminder for another 6 months.

    - You can make your message as bright and loud as you like by using colours, fonts, etc.

  11. I'm slightly confused by your points 2 and 3:

    2) I want the reminder to appear every day but only in the month of May and September at 9.00 PM for their first 7 days (i.e. day 1 to day 7 of these 2 months)

     

    3) The reminder stops for the month being, as soon as I change a file 'HDD BACKUP.RMD' on my C: drive such that the year and month of its date match the date as in 2) and it then waits to remind me again 6 months later.

    Does this macro run only for the first 7 days of May and September at 9pm, or does it run until the specified file has a current date?

     

    Also, May and September are not 6 months apart!

     

    And the macro will not be able to determine when you die, either in advance or after the event :( !

  12. Questions:

    1) What operaing system do you run?

    2) Do you cause your computer to reboot each day? By this I mean you don't hibernate or standby your machine, or have it on all the time. What I want to find out is whether you start Macro Express each day, or whether it's already running when you start up each day (e.g. because the machine wakes from hibernation).

     

    Depending on your answers, a good solution might be to have a startup macro that runs each day which handles all the logic needed to achieve your aim.

  13. Umm, the ability to edit the HTA script with syntax highlighting?

    Well, quite honestly Kevin, anyone who uses MEP actually to develop their scripts is not going to be doing anything very sophisticated or complex! How on earth would one seriously set about debugging such scripts? The very idea beggars belief!

    IMHO, the syntax hightlighting feature of MEP is almost irrelevant, and certainly not worth going to the trouble of incorporating a scripting language for.

  14. But the proof of the pudding is in the tasting (I hate it when people truncate that saying). I have some macros that take on the order of 20 minutes to hours to run and all they are doing is crunching data. But when I created similar routines in VB.NET and executed them in the debug environment (not even compiled yet) they executed instantly. So fast in fact I initially doubted if it was even working. Ergo for applications like this a ‘compiled’ program is what I should be using.

    Still not sure about your conclusion. Admittedly I'm not running loops 100000 times or more, but IMHO AutoIt, for example, is very fast and not compiled. I suspect all you're really saying is that, for the most part, MEP is really very slow (much slower that ME3).

    In my shed I have a chainsaw and I’m pretty handy with it. But I still have an axe as well and actually end up using it more.

    Well, which are you? An axe murderer, or a chainsaw specialist? Surely you're not both?

  15. You know I love to argue with you...

    I never noticed!

    Then again at a certain point we should just write proper compiled programs.

    That's the 2nd time you've mentioned the word "compiled". I'm not sure about this one - you do realize that .Net technology doesn't really compile anything, it just converts user code into an intermediate stage, ready for the JIT (just in time) "compiler" to take over at runtime? I don't notice any difference between running AutoIt .exes and AutoIt scripts, but then I'm not running heavy number-crunching stuff.

  16. So I don’t think the console feature applies to HTAs so one must rely on any of a number of relatively painless methods to get your variables back into MEP.

    You may very well be right. If so, that surely begs this question: what on earth is the point of includng the capability to run HTA scripts in MEP's External Script command? What advantages are provided over simply running the HTA via the Launch Program command?

    If none, then it ought never to have been included, don't you think?

  17. Though Macronewbie specifically asked how to use the console variable feature I think Kevin and I saw past that to what we believe is his ultimate goal and that is to get the values back into MEP without having to resort to creating files or other methods. From what I can recall about how the HTA works it does that.

    As we all know (by now, at any rate :)) MEP has a command "External Script" which allows scripts written in one of JScript, VBScript, HTA/HTML, AutoIt to run and return console output which MEP captures in the "Save console output to:" variable. I don't think it's unreasonable to expect ISS to know how to fully use each of these scripting languages without having to resort to workarounds in order to get this feature to work properly. Yet it appears that I expect too much, as no-one seems to have any idea whether HTA scripts support this, and, if so, how to accomplish it.

     

    I'd hope that ISS could provide workarounds in those cases where there is a bug in MEP. But in this case, we don't know whether there is a bug or not, because we haven't yet got to the point where we have anything to test. And what would be the point of including HTA in the list of supported scripting languages if we can't after all integrate it into MEP. All that has been suggested so far is different in no useful way to running an HTA script just like we did with ME3, i.e.

    Launch Program and Activate Window: Program "xxx.hta", Parameters "", Window "windowname"

  18. Floyd and Joe's code is relevant. See my earlier post. The Multiple Input Field sample macro runs correctly in either Macro Express 3 or Macro Express Pro as long as you stick with the %Txx% variables used in the sample.

     

    Macro Express Pro converts the Macro Express 3 macro commands to Macro Express Pro syntax.

     

    When you load the Multiple Input Field sample code into Macro Express Pro it is converted. Once converted the macro file will no longer work in Macro Express 3. Make a copy if you want to try it in both Macro Express 3 and Macro Express Pro.

    Nobody denies that Joe's code works in MEP - I don't believe that's the issue.

     

    In what way does Joe/Floyd's code help to resolve the issue of how to get HTAs to write to the console? I thought I'd explained above how that code works, by creating ME3 macro code that then can be run using the Load Macro Text File command? Have I missed something? I believe the original author wants to have the HTA write/echo text to the console which is then returned to MEP via the "Save console output to:" facility in the External script command. How does Joe's code assist in that exercise? Please clarify.

  19. Click here for Floyd's sample. I can't remember but he had a way to write back to the macro variables. But if that didn't suffice I'd probably use the registry to write back the values.

    No, what he did was quite different (and written for ME3). His HTA code created ME3 code, so he could write a command as if he'd used the Direct Editor to populate a ME3 variable with a vbs variable, as in:

    strOutput = "<TVAR2:11:01:" & strFirstName & Chr(01) & ">"

    then he wrote the variable strOutput to a text file which he then ran in ME3 by using the load macro command. As you can see, this is entirely different to what is needed in MEP. Joe's code is not at all relevant.

×
×
  • Create New...