Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. Can you provide more detail on what you're trying to do, and what your environment looks like? From what I've read so far, your desktop appears to be populated with various icons representing text files. How do these icons and text files get created and deleted? What is the purpose of these icons? Assuming we can find a way for you to select one of these icons, what would you do next?

     

    What I want to do is find the file with "repeat with folder" and move the mouse there and focus by single click, but it looks like it ain't gonna happen unless I am missing something.

    Well, consider that all of your desktop icons are in one way or another represented in folders called

    C:\Documents and Settings\Username\Desktop

    where Username can be (at the very least) your username, or "All Users". And you could therefore certainly use the "repeat with folder" command on these subfolders.

  2. the great Gawd of our IT Department has decided employees should not have access to the registry. We've tried for over two years to get this changed with no luck.

    IMHO, most IT departments should be consigned to the rubbish tip (I know what I'm talking about since I currently work for one!).

     

    Perhaps you could use a file instead, populated with value pairs, e.g.

    T1 = abc

    T2 =

    N1 = 456

     

    Even better, if you can segment your code so that each discrete module has a separate callable macro, then each of these macros can use their own set of variables. Each time you call the macro that loads your variables, you increase the level which could be reflected in the filename you use. And once you've finished with a particular level, you call the unload macro to decrease the level, similar to the way a stack works.

     

    Clear as mud? <g>

  3. Now I can go forever...or at least as much as my system will let me

    You need to be careful. My understanding is that the space reserved for EVs is limited.

     

    Another, possibly better, solution is to reserve an area in the registry and use that. This is the solution we use in our PGM Library which allows a 16-deep stack, each containing independent sets of t1-t99, N1-N99, etc. And, of course, the registry value names can be anything you like, not limited to ME variable names.

  4. i´m quite sure that the following ist not (yet) possible. So it´s more a piece of suggestment. If there is a better place to put new ideas for features i would be glad to hear. Thank you.

     

    I often have to edit various macros the same way. Especially to give them all the same program specific scope takes more time than it should. MEX already allows to select macros independently with the control key in the Macro Explorer. So it would be great to have the possiblity to get in the Properties menu and make some settings for all the selected ones. At the moment only Export and En-Disabling is supported.

    Well, it's certainly possible - I've done this very thing myself. You need to write one or more macros that can themselves edit other macros, e.g. ones you Ctrl-Select from the list of macros presented. It can be quite tricky at the beginning to get it all to work properly, but, once done, it does, as you say, save an enormous amount of time. Using this approach, you can do pretty well everything you can do manually.

  5. I also use Remote Administrator, and have no problem with a macro I use which:

    - runs a specific Radmin macro passing in a variable to determine which machine to open

    - waits for the user and password screen, then fills in the required values and clicks Enter

    - moves the mouse to a different monitor so that my mouse does not interfere with the remote user's mouse

    - waits for the Radmin window to open, then resizes it to remove scroll bars

  6. When I need to run something at night, I have three macros that work in concert together:

    Macro1 (started by the OS scheduler as a normal scheduled task) allows the machine to log in without requiring a password to be typed in (it does this by saving the password temporarily to the appropriate place in the registry, setting a specific value and then rebooting the machine).

    Macro2 is scheduled to run when ME3 starts. It checks these registry settings; if we're in Unattended Login mode, it immediately removes the password from the registry, unsets the specific value, runs the macro you want to run (call it Macro3) and, finally, reboots once Macro3 has ended. So your machine is vulnerable for a very short time as soon as it has rebooted the first time, and also while macro3 is running.

  7. I suppose you could try 10; the thing is you don't want your macro to be hogging all the resources, otherwise the clipboard will never work because the machine is too busy checking on the clipboard! But I daresay 10 is OK. Of course, in a perfect world you'd only have to wait, at most, one loop time increment.

     

    I've never had much joy with controls. I'm for ever finding that some value captured as part of a control's identity can change from one run to the next, which renders the concept fairly useless! But thanks for the info.

  8. Of all the problems I have, getting stuff copied reliably to the clipboard is by far the most frequent. This morning I've already spent an hour on what should be a pretty trivial macro. Whatever delays I introduce, whatever keystroke speeds I use (10ms, 20ms, 50ms), I still can't seem to get the selected text into the clipboard. Instead it usually seems to hold the previous (or even older) copy.

     

    Does this ring a bell with anyone please? Are there any other things I can try?

    I always clear the clipboard first before copying to it, so that when I paste back I can check for zero-length strings. If you do this, don't use the Clipboard Empty command - it's very slow. Instead, set a string variable to "" and copy that to the clipboard.

     

    For important clipboard stuff I have written 2 macros, one for copying and one for pasting. Both contain Repeat loops; the copy macro repeats (once every 100 milliseconds for a maximimum of 1 second) until there's a non-zero length string in the clipboard, while the paste macro repeats (with the same time constraints) until something has been retrieved from the clipboard.

  9. Ahhh.. i just had an epiphany. After you have moved the file to your secret "Trash" folder, you could have macro express create an empty notepad file, and then rename it to "TRASH", and then move it to your secret "Trash" folder (which will override the file containing potentially sensitive information with a blank file with no data).

     

    I think I will update our macro to do this!

    You should be aware that the method you describe here does not prevent someone recovering all your files named Trash with the right software, e.g. Winternals FileRestore. Once a file exists on your disk, the only way to ensure it's really deleted is to use a secure erase utility (there are plenty of these utilities available). This is because deleting a file simply removes it from the FAT or NTFS directory; the space occupied by your deleted file becomes available for reuse, but it's impossible to know when that reusable space is actually used again - it could be immediately, it could be in 12 months from now.

     

    You can easily prevent any file going to the recycle bin by right-clicking on the recycle bin, selecting Properties and checking "Do not move files to the &Recycle Bin. Remove files immediately when deleted" (and note the &R in this text - you could have your macro check this box before deleting the file by typing R into this dialogue box, then unchecking the box after the deletion). But, again, the file could still be recovered with Winternals FileRestore.

  10. I have a generic macro which I call, supplying a pixel colour, a timeout in seconds, and any number of pairs of coordinates specifying a left-hand top and a right-hand bottom. Upon return, if the supplied number of seconds = 0, then we failed to find the pixel; otherwise we succeeded.

     

    I can probably let you have a copy if you think it would be useful to you.

  11. Patgenn123 posted a long and complex question to which he received no response.

     

    Growing increasingly frantic, he then wrote "I don't get it. This should be a simple answer.", to which he received a link recommending a different way of asking his question. He went on to misconstrue this response as mere rude shouting, and posted what I consider to be a very rude and patronizing text. It was pointed out that he had in fact received some advice in an URL, and that no-one was shouting at anyone.

     

    And did Patgenn123 ever apologize for misunderstanding this post, or for demanding a response from forum participants even when, AFAIK, no-one gets paid for forum participation? Did he hell! I'm surprised he hasn't been more formally warned about his behaviour by the moderator!

     

    I'd be very cautious before I ever posted responses to future pleas for help by Patgenn123!

  12. The problem arises when dealing with the next scheduled starting time of your macro.

     

    Suppose the macro runs at 3pm on Monday, 4pm on Tuesday, then the machine crashes. The "run macro every 25 hours" bit is fine, but the new starting time is going to be related to when the machine was restarted, not to when the macro was last run.

  13. <br />This topic has come up for me recently too.... I have a Macro that runs for 6+ hours every day. It begins at a specified time, then it repeats itself every 25 Hours. The problem I run into is that if the PC is rebooted, then the 25 hour clock is reset to 0 and it won't run until the 25 hours are expired again.<br /><br />I have been toying with an idea to have the start time logged to an INI File and change my macro to instead check this time slot every hour and when it is greater then 25 hours since the last run, it runs again. But I've been having trouble putting this together logically. It sounds good, but I'm just not exactly sure of the logic to put it all together.<br /><br />Any Ideas to get me started???<br /><br />Thanks!<br />
    <br /><br /><br />

    You're going to need 2 macros, M1 and M2.

     

    M1 is the macro you've described above, scheduled to run hourly starting at hh:mm nn minutes after the start of every 25 hours.

    The first thing macro M1 will do is to load variables N1 thru N5 with, respectively, the current year, month, day, hour and minute, then write these variables either to a specific key reserved for your use in the registry, or to an .ini file if you prefer.

     

    M2 is a macro scheduled to run only at startup, whose purpose is to run M1 once if needed, then modify M1's starting time (code to do this is below).

    M2 contains this logic.

    - load variables N1-N5 with, respectively, the current year, month, day, hour and minute

    - load variables N6-N10 with the values last stored in the registry or .ini file

    - compare n1-n5 with n6-n10 and decide when M1 must next be run

    * convert n1-n3 to Julian, multiply by 1440 to convert to minutes, add n4*60 plus n5 to get the time in minutes that M1 was last run

    * convert n6-n8 to Julian, multiply by 1440 to convert to minutes, add n9*60 plus n10 to get the current date and time in minutes

    * if M1 should already have run one or more times, run M1 now (or use a different rule to suit your needs)

    * determine hours and minutes of when M1 should next run into N11-N12

    * determine the difference between N11-N12 and N4-N5 into N13-N14

    * add N13-N14 to N4-N5 into N15-N16

    * if N15-N16 are now, then run M1 and delay 1 minute

    * schedule M1 to run every 25 hours starting at N15-N16 (code to do this is below)

     

    The conversion to Julian is something you need to work out, or you can purchase a copy of PGM Library, which contains this functionality (NOTE: this is sound advice, but you should be aware that I am one of the developers of this product!).

     

    <SPKEY:0030><MOVETOTRAY:Macro ExpressF:F:0:0><LCLK><WAITWIN2:000000:000010:Macro Express - Macro Explorer><TEXTTYPE:<ALT><ALT>mhM1<ALT>f<ESC>><DELAY:1><TEXTTYPE:<ALT><ALT>mp><DELAY:1><TEXTTYPE:<ALT>v><DELAY:1><TEXTTYPE:<ALT>s<ALT>s<TAB><ENTER>><DELAY:1><TEXTTYPE:<TAB><TAB><TAB><TAB>>

    This locates the cursor on the hours part of the start time. I'll leave the rest of this for you to work out (i.e. changing minute, then saving the new start time).

  14. If Car = Corvette

    OR

    If Car = Porsche

    And

    If Car does not contain Blonde

    Wave

    Else

    Don't wave

    Endif

    Without brackets or pre-agreed priorities on AND and OR, the above is ambiguous!

     

    It could mean

    If Car = Corvette, then wave

    If Car = Porsche with no blonde, then wave

    Else don't wave

    So we wave ONLY at all corvettes, OR all porsches with blondes

     

    It could also mean

    If Car = Corvette or Car = Porsche, and the car does not contain a blonde, then wave

    Else don't wave

    So we wave ONLY if there's a blonde in a corvette OR a porsche

     

    So I suggest

    If Car = Corvette

    OR

    If Car = Porsche

    If car does not contain blonde

    then wave

    else

    don't wave

    endif

    else

    don't wave

    endif

  15. For multiple IF NOT conditions, you need to connect them with AND, not OR.

     

    Consider a single-character variable containing the value A. Your condition

    If Variable %T93% does not contain "A"

    OR

    If Variable %T93% does not contain "B"

    is always true! In this case, the condition "does not contain B" is true.

    If you'd written

    If Variable %T93% does not contain "A"

    AND

    If Variable %T93% does not contain "B"

    then you'd get the result you're seeking.
×
×
  • Create New...