Jump to content
Macro Express Forums

Eg6Xpm18cs

Members
  • Posts

    23
  • Joined

  • Last visited

Posts posted by Eg6Xpm18cs

  1. Taking a screenshot should be a quick and trivial thing, but it's a pain when you have to launch a graphics program just to crop and save an image. This is an on-the-fly way to take and save screenshots, in particular a mouse-defined rectangular zone (screen and window capture are also available), with minimal keyboard or mouse interaction and no lingering background processes.

     

    This is a simple macro that calls Lightscreen, a dinky (550K .exe) program, which prompts for a mouse-defined rectangle. After mousing the capture zone, the screenshot is taken and put to the clipboard, a Save As dialog pops up prefilled with default filename prefix, then Lightscreen is killed.

     

    Change the Lightscreen settings if you want to do something else, then adjust the macro. You may need to add some delay or key/mouse speed limits if the macro glitches.

     

    Screenshooter.mex

  2. This macro facilitates editing, comparing, and cut/paste work between windows.

     

    It switches the active window between always-on-top and not AoT with nothing more than a hotkey (default is

    Ctrl+Alt+T, change if desired). Multiple windows can be toggled always on top simultaneously, and no background processes are left running.

     

    The macro uses Topmost Toggle (scroll to bottom of page) which launches instantly, then does a Ctrl+rightclick on the active window's title bar to toggle it, flashes a confirmation, kills Topmost Toggle, and returns the mouse to its original position.

     

    Functionality for Windows Explorer was removed at the latest (1.8) revision of TT, so here's the 1.7 version that works with Explorer.

    TopmostToggle.zip

     

    The macro has no delays, waits, or speed adjustments, and I've had no problems; keep this in mind as you may need to add a delay or two if it glitches.

    AlwaysOnTop.mex

  3. This macro can be used to detect when a running program or task is finished, as an alternative to monitoring controls, pixel colors, log files, mouse cursors, etc. A typical application would be a long-running or unattended task where you want something to happen when the task is finished, e.g. sound an alarm, launch another program, shutdown PC, etc. I suppose it could also be used as an alarm when a task hangs.

     

    The macro calls the PsList.exe part of the PsTools Suite

    Credit to poster paul for referring me to PsList and providing guidance on how to use it.

     

    The macro calls PsList to interrogate CPU activity, extracts CPU run time from PsList and converts it to seconds, then compares it to the CPU time obtained from the previous repeat loop to determine if the process has stopped, i.e. if current and previous CPU times are equal.

     

    In the parameters section of the macro, specify the process name to be monitored, and the paths to your PsList.exe and data file. Default delay between CPU interrogations is 30 seconds. Reliability may suffer if short delays are used -- I've noticed that the CPU Time in Windows Task Manager occasionally pauses up to several seconds.... so if the delay is too short, the macro will prematurely signal the end of processing if a long pause occurs.

     

    CPU time can be verified by enabling Text Box Display near the end of the macro. A pop-up showing CPU time will appear right after launching the macro, and at every repeat interval thereafter. Compare the CPU time to Task Manager (add CPU Time column in the Processes tab: View / Select Columns).

     

    A drawback is that the command window flashes at each CPU interrogation. I don't know how to prevent this, so maybe someone can chime in with a solution.

     

  4. Thanks for the pslist / PSTools, but the usage is a bit over me.

     

    Did you pass data from pslist to a text file or call up the cmd window first? I can send data to a text file from the cmd window using, for example: pslist -m iexplore -e >pslist.txt but not from Macro Express. Or is there a way to go from pslist straight to ME variables?

     

    And then how to parse the data?.... by processing as a text file with ME then using Varible Modify String to extract the characters corresponding to the data columns of interest?

     

    TIA for any guidance.

  5. Hi all,

     

    Is there an ME-based way to determine if a program is actively running compared to just being open?

     

    Seems to me that obtaining the program's memory / CPU usage would be most straightforward.

     

    Normally I get button / cursor status, or color pick a progress bar, etc., but in this case there's a big difference between active and resting memory usage so it'll be a reliable indicator.

     

    Any comments appreciated.

  6. ME3 isn't loading at startup (no MacExp.exe in Task Mgr).

     

    In Preferences it's set to run at startup, and I tried a long wait period to avoid any conflicts with other programs.

    Also ran virus/malware scans, and finally reinstalled ME, still no joy.

     

    In msconfig Startups, ME is listed as a "Common Startup" but not a Registry key. What is a Common Startup?

     

    I found no key at either HKLM or HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.

    Seems there should be a key in there. Wouldn't reinstalling have recreated them if they were missing?

     

    The ME3 shortcut was in my Startup folder for All Users, but I also copied it to the <Owner> Startup folder, but that didn't help.

     

    Any suggestions appreciated. I sure would like to avoid reinstalling Windows.

  7. Yes, it can be done, but it requires clever/flaky coding. The technique I use is to search every pixel along a line, or within an area, for the colour of the selected text.

    I also do same, just looking for a more solid approach. My application involves selected text at the same general region on the page, so a line scan works for me.

  8. Is there anything in common between the names of the controls? For example, do they always contain "ABC 123"?

     

    If yes, I think it is possible to extract the text of the control into a text variable, and then test it to see whether that variable contains the string that is common to all of your target controls.

    Now I do have a situation where a control has varying Window Text with a common term in all situations, but I'm not seeing how to extract the text. At first I thought Get Control might allow a partial-text target (the common text), but that's not the case.

     

    Appreciate any suggestions.

  9. I suggest that you start again from scratch.

    I can't bring myself to do that because the macro is long and works reliably in all other respects.

     

    I did find a straightforward way to activate the document: Assign control to the doc then Set Focus to it. I got hung up thinking I needed to click on the control, so missed the obvious.

  10. Hi all,

     

    I use a macro to automatically check email, and would like the macro to do additional things right after messages are downloaded.

     

    Occasionally I get large attachments which take a long time (minutes) to download. I'm currently using a very long delay in the macro before it continues to other tasks, in order to avoid prematurely stopping the email downloads. Of course, the long delay is inconvenient when I don't get any large messages.

     

    Is there a way to tell when downloading is in process or once it stops?

     

    I'm using Outlook Express and the only indicator that I see during download is the "Checking Mail" in the lower right of the window, which I guess I could try to capture as a control but I'd prefer something cleaner, like something in the system that explicitly indicates downloading in progress.

     

    Thanks in advance for any help!

  11. Hi all,

     

    I can't get a document (Word) to come out of its minimized state by using various combinations of the activate, window maximize, and wait for window commands, plus delays, double commands, and assigning control to the window followed by a click on the control. It's as if the window is stuck minimized.

     

    The program item on the Start bar shows it to be activated (button depressed) and data gets successfully pasted to the Word doc, but the document doesn't "wake up". I want to see what's being pasted without having to manually click the program item to bring up the window.

     

    Thanks for any suggestions or workarounds.

  12. ...Schedule a macro to run every x seconds, and if the window is running...

     

    ...But in the x-second intervals between scheduled runs, all kinds of other macros can run.

     

    Yes, that might do it for me in the absence of a direct solution. I forgot about timed repeating checks as a way to monitor a state w/o having background stuff continuously running. I don't need immediate activation so the interval could be an hour or so, and since the app isn't important I'm not concerned if it gets blocked by another macro running.

     

    Thank you!

  13. Specifically, I want to stop a macro upon closure of a window while the macro is waiting for user input (Enter key). Closing the window leaves the macro hanging waiting for input.

     

    This issue seems so simple that I suspect I'm missing something basic. Is there a way to monitor a condition (window state) while waiting for an action (user input) using only one macro?

     

    I was thinking of an endless IF loop to constantly test both conditions, using a short waiting period (would Control be used for the Enter key?), but that doesn't seem like the cleanest approach.

     

    Suggestions?

×
×
  • Create New...