Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. I tried that already. In that case the window is in the taskbar.

    Then you need to read http://www.howtogeek.com/howto/windows/hide-flashing-command-line-and-batch-file-windows-on-startup and download the utility hstart, then edit your shortcut to read:

    xxxxxx\hstart.exe /noconsole yyyyyy

    where:

    - xxxxxx is the fully qualified path of the HStart executable

    - yyyyyy is the fully qualified shortcut you created.

     

    If you're running a 64-bit windows, then use hstart64.exe, otherwise hstart.exe.

  2. Save the following lines into a file whose extension is .bat, e.g. C:\MyBatchFiles\RestartME.bat

     

    @echo off

    taskkill /f /im macexp.exe
    "xxxxxx\MacExp.exe"

     

    For convenience, you could create a shortcut to this batch file on your desktop, then simply double-click on that shortcut when you need it.

     

    I've simply copied the taskkill line from above, but haven't tested that it works.

    The xxxxxx should be replaced by the drive and path of the folder that contains macexp.exe, e.g.

    "C:\Program Files (x86)\Macro Express Pro\MacExp.exe"

  3. You'll need to use the External Script command to achieve your goal.

    Here's a solution using AutoIt. It displays 0 if no characters between 1 and 9 are found, otherwise it displays 1.

     

    Variable Set String %tString% to "1qwertyu4"
    External Script: AutoIt
    Text Box Display:

     

     

    <VARIABLE SET STRING Option="\x00" Destination="%tString%" Value="1qwertyu4" NoEmbeddedVars="FALSE"/>
    <EXTERNAL SCRIPT Language="AutoIt" Dest="%tOutput%" Script="ConsoleWrite(StringRegExp($CmdLine[1], \"[123456789]\"))" Parameters="%tString%" Encoding="0"/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %tString%\r\n\\par %tOutput%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  4. I have written clipboard copy and clipboard paste macros that had to be foolproof for end users.

    Here's pseudo-code for what I did in version 3 of Macro Express:

    clipboard copy
     set clipboard to an empty string (faster than the clipboard empty command)
    repeat 10 times
      either save (shared) specified variable to the clipboard, or clipboard copy
      read clipboard into variable
      if successful, exit, else delay 100ms
    
    clipboard paste
     repeat 10 times
    read clipboard into variable
    if successful, exit, else delay 100ms

  5. 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?

    Use the command Program Launch, with these parameters:

    Program/Path name: C:\WINDOWS\system32\cmd.exe

    Program Parameters: /c xxx\pslist.exe yyy >zzz\Data.txt

    where:

    xxx is the fully qualified pathname where PsList.exe is located

    yyy is the name of the process you want to monitor

    zzz is the fully qualified pathname where you want to store the output file

    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?

    I extract the entire contents of data.txt into a text variable, which looks like this:

    Process information for PHT:
    
    Name			    Pid Pri Thd  Hnd   Priv	    CPU Time    Elapsed Time
    Uedit32		    6816   8   9  258  20892	 0:00:23.665    49:29:22.392

    Then you could discard everything before the name of your process and extract the CPU time. Next time you run PsList, you'll compare the new value of CPUTime to the old. Aim to convert the CPU time to seconds,which will make the comparison easy.

  6. I sympathise! It is possible to compile an AutoIt macro into so-called executable code, meaning AutoIt is no longer required to be installed (except on your machine of course). Then you'd have your macro running this .exe to activate the desired window. But, knowing IT departments as I do, I daresay they'd object.

     

    How IT was ever allowed to take control of the PC to the extent they have is utterly beyond me (and I worked in IT for several years). I suppose PC should be renamed to IC! :(

  7. I think I'm having a similar problem. I open an Outlook folder whose window title is "PubContacts - Business in Public Folders - Microsoft Outlook" and then attempt to "Activate" the window using "Partial Match" and the string "PubContacts - Business". But it fails consistently, even if I have just a one-line macro containing the Activate command.

     

    In the past, this has been affected by the existence of hidden windows with conflicting titles. And sure enough, when I look at the hidden windows, I find two additinioal hidden with the same title.

     

    So far, I've never had a need to access hidden windows. They have always just been something I have to work around.

     

    Is there way to tell the Activate command to ignore hidden windows and just activate the visible window?

    OK, please try this AutoIt code and let me know if it's successful (it works for me with UltraEdit, but I don't have Outlook, and its behaviour may be quite different).

    Variable Set String %tWinTitle% to "PubContacts - Business"
    External Script: AutoIt

    <VARIABLE SET STRING Option="\x00" Destination="%tWinTitle%" Value="PubContacts - Business" NoEmbeddedVars="FALSE"/>
    <EXTERNAL SCRIPT Language="AutoIt" Dest="%tOutput%" Script="$winnames = WinList($CmdLine[1])\r\nfor $i = 1 To $winnames[0][0]\r\n  $state = WinGetState($winnames[$i][1])\r\n  If 2 = BitAND(2, $state) Then ExitLoop\r\nNext\r\nWinActivate($winnames[$i][1])" Parameters="%tWinTitle%" Encoding="0"/>

    How it works (if it does! :mellow: ):

    Set %tWinTitle% to the starting text of some visible window (note: it must already be visible, and there should only be one such visible window).

     

    The AutoIt code retrieves all windows (titles and handles) starting with the specified string. It then examines each window (using the handle) to determine whether that window is visible. If it is, then it makes that window active.

     

    I haven't included any error checking in this code - that can be done later.

  8. When W7 first came out, I quickly discovered that, just like WinXP before it, the feature to show only selected icons in the tray was unreliable at best. Since I've got 3 monitors, I decided to allow W7 to show all my icons all the time, a total of 20 icons. I also discovered that if the tray icons are displayed in 2 or more rows, MEP can't reliably locate a tray icon using the Move Mouse to Tray Icon command - repeated requests to Insight to fix the bug have produced no acknowledgement of the problem, and no solution to it.

  9. When I maintained the PGM library, I wrote a macro to edit other macros - each of our macros had a multi-line header which contained data for other functions, e.g. the Help stuff we provided; when we needed to add or change this header information, we had to do it in all our PGM macros, so the only way forward was to write a macro to do this. Your requirement here sounds similar and more straight-forward.

×
×
  • Create New...