Jump to content
Macro Express Forums

Samrae

Members
  • Posts

    452
  • Joined

  • Last visited

  • Days Won

    22

Posts posted by Samrae

  1. When Macro Express runs it can type keystrokes and move or click the mouse much faster than a human can do it manually. Each computer and application responds differently. I would expect that connecting to your neighbor's computer via RDP is much, much slower than running ACT on your laptop.

     

    It is possible that the problem is as Cory describes where keystrokes and mouse movements are not occurring because of the RDP connection and the application having focus. However, it could also be that the macro is just running too fast.

     

    Here are some suggestions.

     

    1. Try having the macro type ridiculously slowly. This lets you watch each step as it occurs. I suggest Keystroke Speed: 500 milliseconds. My previous recommendation of Keystroke Speed: 1000 milliseconds is too slow.

     

    Watch the macro run. Make a note about what works and what does not. If even one keystroke works then you should be able to get the macro to work.

     

    2. Try launching Notepad (notepad.exe) and typing something into it. That will help us determine if the issue is with RDP, keystrokes, or ACT. Here is a sample you can just copy (from the second box) and paste into a new macro.

      Program Launch: "Notepad.exe" (Normal)
    Parameters: 
       
      Delay: 0.3 seconds // Wait for Notepad to come up and get focus
      Text Type (Simulate Keystrokes): This is a test: %Count%
       
      Keystroke Speed: 500 milliseconds
      Text Type (Simulate Keystrokes): <ENTER><ENTER>The macro should be typing very slowly now.
    1
    2
    3
    
    DONE
    
      Keystroke Speed: 0 milliseconds
    <PROGRAM LAUNCH Path="Notepad.exe" Mode="\x00" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/>
    <COMMENT/>
    <DELAY Flags="\x01" Time="0.3" _COMMENT="Wait for Notepad to come up and get focus"/>
    <TEXT TYPE Action="0" Text="This is a test: %Count%"/>
    <COMMENT/>
    <KEYSTROKE SPEED Delay="500"/>
    <TEXT TYPE Action="0" Text="<ENTER><ENTER>The macro should be typing very slowly now.\r\n1\r\n2\r\n3\r\n\r\nDONE\r\n"/>
    <KEYSTROKE SPEED Delay="0"/>

    3. It is possible that Macro Express needs to run as Administrator in order to interact with ACT.

     

  2. 19 hours ago, IndigoJon said:

    for some reason on the remote machine, only some of the commands are being acted on...for example "Alt-i" should ...

     

    Sometimes <ALT>i does not work. Try using <ALTD>i<ALTU>. While I sometime run across a program where things like <ALT>i do not work I have never had an instance where <ALTD>i<ALTU> failed for me.

    Text Type (Simulate Keystrokes): <ALTD>i<ALTU>
    Delay: 500 milliseconds
     Text Type (Simulate Keystrokes): t
    Delay: 500 milliseconds

     

  3. Here are some observations:

     

    Activities Emailer.mex

     

    1. I would recommend a delay after the Activate or Launch command. It may take some time for the computer to load the program and be ready to accept keystrokes. This might be why it does not work on the remote computer.

     

    2. Since you are not doing any mouse movements or clicks you could remove the Window Resize command.

     

    3. Line 16 is

    Text Type (Simulate Keystrokes): <CTRL> <SPACE>

    Did you intent to have <ctrl><space><space> ? There is an extra space between > and <

     

    4. Is there a reason why you cannot combine some of the lines? You could replace several lines beginning on line 71 with

    Text Type (Simulate Keystrokes): Neah Activities Message

    5. You could simplify the macro by including a Keystroke Speed command and eliminating many of the delays.

     

    Friends & Family Emailer.mex has similar issues.

     

    Something like this may work (I did not test run this modified macro):

    Activate or Launch: Window "Act! Premium", Program "Act! Premium.lnk", Parameters ""
    Delay: 4 seconds
     
    Keystroke Speed: 1000 milliseconds
    Text Type (Simulate Keystrokes): <ALT>it<F4><F6>
    Delay: 3000 milliseconds
    Text Type (Simulate Keystrokes): <F6>
    Delay: 1700 milliseconds
    Text Type (Simulate Keystrokes): <F6>
    Delay: 1700 milliseconds
    Text Type (Simulate Keystrokes): <CTRL><SPACE>
    Text Type (Simulate Keystrokes): <CONTROL>c
    Delay: 250 milliseconds
    Text Type (Simulate Keystrokes): <CONTROL>v
    Delay: 1250 milliseconds
     
    Text Type (Simulate Keystrokes): <ALT>o
    Pause: Complex
    Delay: 500 milliseconds
    Keystroke Speed: 1000 milliseconds
    Text Type (Simulate Keystrokes): <ALT><F4><ALT>y<ALT>imn
    Delay: 2000 milliseconds
    Text Type (Simulate Keystrokes): e<ENTER><TAB><ENTER><F4><F6><F6><F6>
     
    Text Type (Simulate Keystrokes): <CTRL><SPACE><ENTER><TAB><TAB><ENTER>
    Delay: 2000 milliseconds
    Text Type (Simulate Keystrokes): g<TAB><TAB><TAB><ENTER>
     
    Text Type (Simulate Keystrokes): Neah Activities Message
    Text Type (Simulate Keystrokes): <ENTER><ENTER><ENTER>
    
    Keystroke Speed: 0 milliseconds
    <ACTIVATE OR LAUNCH Title="Act! Premium" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Act! Premium\\Act! Premium.lnk" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>
    <DELAY Flags="\x01" Time="4"/>
    <COMMENT/>
    <KEYSTROKE SPEED Delay="1000"/>
    <TEXT TYPE Action="0" Text="<ALT>it<F4><F6>"/>
    <DELAY Flags="\x02" Time="3000"/>
    <TEXT TYPE Action="0" Text="<F6>"/>
    <DELAY Flags="\x02" Time="1700"/>
    <TEXT TYPE Action="0" Text="<F6>"/>
    <DELAY Flags="\x02" Time="1700"/>
    <TEXT TYPE Action="0" Text="<CTRL><SPACE>"/>
    <TEXT TYPE Action="0" Text="<CONTROL>c"/>
    <DELAY Flags="\x02" Time="250"/>
    <TEXT TYPE Action="0" Text="<CONTROL>v"/>
    <DELAY Flags="\x02" Time="1250"/>
    <COMMENT/>
    <TEXT TYPE Action="0" Text="<ALT>o"/>
    <PAUSE Flags="\x11" Message="Susan, type in whatever you need to here, or cut and paste text from another document, then click on <Resume>" Left="Center" Top="Center" Monitor="0"/>
    <DELAY Flags="\x02" Time="500"/>
    <KEYSTROKE SPEED Delay="1000"/>
    <TEXT TYPE Action="0" Text="<ALT><F4><ALT>y<ALT>imn"/>
    <DELAY Flags="\x02" Time="2000"/>
    <TEXT TYPE Action="0" Text="e<ENTER><TAB><ENTER><F4><F6><F6><F6>"/>
    <COMMENT/>
    <TEXT TYPE Action="0" Text="<CTRL><SPACE><ENTER><TAB><TAB><ENTER>"/>
    <DELAY Flags="\x02" Time="2000"/>
    <TEXT TYPE Action="0" Text="g<TAB><TAB><TAB><ENTER>"/>
    <COMMENT/>
    <TEXT TYPE Action="0" Text="Neah Activities Message"/>
    <TEXT TYPE Action="0" Text="<ENTER><ENTER><ENTER>"/>
    <COMMENT/>
    <KEYSTROKE SPEED Delay="0"/>

     

  4. There is another example of using the ASCII Text File Process command in the samples.mex macro file. This file should be located somewhere in your My Documents folder. You can also copy it from the folder where the Macro Express Program files is installed (do not try to use it from the Program Files folder).

        C:\Program Files (x86)\Macro Express Pro 6\samples.mex

     

    Or, you can download it from this page: Sample Macros

     

    Look for the macro "Process a CSV Delimited File".

  5. You could also try adding a "Wait for File to be Ready" command in front of the Delete File/Files command:

    Lock Player
    Text Type (Simulate Keystrokes): <ALT>fl
    Delay: 1000 milliseconds
    Wait for File to be Ready: C:\Web\n1\generated\files-are-okay.txt
    Delete File/Files: "C:\Web\n1\generated\files-are-okay.txt"
    Delay: 250 milliseconds
    Window Activate: Mozilla Firefox
    Wait for Window Title: Mozilla Firefox
    Text Type (Simulate Keystrokes): <CONTROL>4
    Delay: 500 milliseconds
    Text Type (Simulate Keystrokes): <CONTROL><F5> // Use <CONTROL><F5> to refresh browser fully.
    Delay: 500 milliseconds
    Unlock Player
    Text Type (Simulate Keystrokes):  
    <LOCK PLAYER Wait="FALSE"/>
    <TEXT TYPE Action="0" Text="<ALT>fl"/>
    <DELAY Flags="\x12" Time="1000"/>
    <WAIT FOR FILE TO BE READY Filename="C:\\Web\\n1\\generated\\files-are-okay.txt" Time="1" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="15"/>
    <DELETE FILE/FILES Path="C:\\Web\\n1\\generated\\files-are-okay.txt" Progress="FALSE" Recurse="FALSE" Permanent="TRUE"/>
    <DELAY Flags="\x12" Time="250"/>
    <WINDOW ACTIVATE Title="Mozilla Firefox" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <WAIT FOR WINDOW TITLE Title="Mozilla Firefox" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="10"/>
    <TEXT TYPE Action="0" Text="<CONTROL>4"/>
    <DELAY Flags="\x12" Time="500"/>
    <TEXT TYPE Action="0" Text="<CONTROL><F5>" _COMMENT="Use <CONTROL><F5> to refresh browser fully."/>
    <DELAY Flags="\x12" Time="500"/>
    <TEXT TYPE Action="0" Text="<HOME>" _ENABLED="FALSE"/>
    <UNLOCK PLAYER/>
    <TEXT TYPE Action="0" Text=" "/>

     

  6. When you copy and paste a macro the variables are, in fact, not created. Macro Express (and Macro Express Pro) looks through the script for variables and prompts you to create them. There are at least 2 prompts per variable. Normally it works just fine to press the ENTER key a bunch of times until it stops asking for new variables.

     

    But, there are some rare cases where a command support different variable types. For example, it might allow either a string or an integer. In these cases Macro Express tries to make a good guess about which type of variable to define but once in a while it guesses wrong. For macros that you are writing this is normally not a problem. But for a macro from someone else you may need to figure out what type of macro is needed.

     

    This may not affect you at all but if the macro misbehaves you know what to look for. If there is a problem usually you will see a message that says the variable is the wrong type.

  7. On 2/27/2020 at 7:32 AM, rberq said:

    If the Meta-Correction button is always at the same spot on the screen, could you do something as simple as this?  (Use the macro editor's Mouse Locator tool to find the screen coordinates of the button.)

     

    Mouse Move: 1279, 221 Relative to Screen
    Mouse Left Click

     

     

    22 hours ago, rberq said:

    The only problem I have had with the mouse locator is when I have accidentally used window-relative instead of screen-relative, or vice versa.

     

    It might work best to use Mouse Move: Relative to Current Window. I find it better to work with positions relative to the active window because I rarely have my applications at full screen. When they come up they are usually in slightly different positions.

     

    Another thing to consider is if the button moves when the active window is resized. If this is the case then your macro would be more reliable if you set the window to a specific size. Here is an actual example from one of my macros:

    Window Move and Size: Move "CMS: *Defect" to (635,320) and size to 990 x 750
    Mouse Move: 90, 456 Relative to Current Window

     

  8. For Windows the value for 'RETURN' is actually a CR followed by LF. You can define variables to represent CR and LF:

    Variable Set to ASCII Char 13 to %CR%
    Variable Set to ASCII Char 10 to %LF%

    Then you could use something like this:

    If Variable %x% Contains "Hello%CR%%LF%There"

    to search for

    Hello
    there

    There are a couple of ways to search for parts of the message.

    If Variable %x% Contains "Hello"
    AND
    If Variable %x% Contains "there"
      MessageBox: Result True
    Else
      MessageBox: Result False
    End If

    Another way would be to parse the message using the Variable Modify String command options. (This is more involved so I do not provide an example here.)

  9. There is nothing inherently risky about saving data in the registry as long as you know and remember which registry area (key) you use. Using the registry may be somewhat faster than reading from a file. However, depending on what your macro is doing, you may not notice the difference.

     

    There is a potential side effect of using values in the area of the registry (registry key) that Macro Express uses such as this:

        HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 6\My Values

     

    When you export the Macro Express settings (Tools, Export Program Configuration) and then import them either later (Tools, Import Program Configuration) Macro Express will display a warning about the registry keys and values that it does not recognize.

     

    It is pretty safe to use other areas of the registry such as 

      HKEY_CURRENT_USER\Terry Work Area

     

    You could also use something like this:

      HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express Data

    • Like 1
  10. A comment without text is a blank line.

    // ----------------------------------------------------------
    //   Initialization
    // ----------------------------------------------------------
    Variable Set From Misc:  "Name of Current Macro" into %MacroName%
    Variable Set String %T[1]% to ""
    Variable Set String %T[2]% to "You indicated that you are running Windows "
    Get OS Version String: %T[5]%
     
    // --------------------------------------------------------
    //   Display Introduction and Instructions
    // --------------------------------------------------------
    Variable Set Integer %Left% to 0 // Unused

     

  11. If you intended to have your macro wait 15 seconds after the Bookmarks window closes you should not use Macro Stop. No macro commands, including the Delay command at the end, will run after the Macro Stop command.  Instead use Break. That skips to the macro command after the End Repeat. However, in this case, neither Break nor Macro Stop is needed because setting T77 to Done will stop the repeat loop. Try something like this:

    // Run the macro until the window is closed.
    Variable Set String %T[77]% to "Not"
    Repeat Until %T[77]% Equals "Done"
      If Not Window "Bookmarks - Google Chrome" is running
        Variable Set String %T[77]% to "Done"
      End If
      Delay: 100 milliseconds
    End Repeat
    Delay: 15 Seconds

    You still need some delay inside the repeat loop for the reason stated above.

  12. The delay after End Repeat will never be used. It should look like this:

        Macro Stop
      End If
      Delay: 15 Seconds
    End Repeat

    Without the delay inside the repeat loop Macro Express will run these macro commands as quickly as possible without slowing or stopping. It will use 100% of one of your CPU cores. This puts your macro into what your computer considers an infinite loop. I wouldn't be surprised if more than Chrome freezes. And Terry is right, your delay command contains 15 milliseconds instead of 15 seconds.

  13. Another way to accomplish this is to not let the macro halt until the window has been closed. If a specific macro is running it cannot be activated again. This demonstrates using Notepad.

    Text Box Display: Note_pad  is running
     
    Repeat Until %Done% Equals "Done"
      If Not Window "Notepad" is running
        Variable Set String %Done% to "Done"
        Macro Stop
      End If
      Delay: 1000 milliseconds
    End Repeat
    <TEXT BOX DISPLAY Title="Note_pad  is running" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue255;}\r\n\\viewkind4\\uc1\\pard\\qc\\cf1\\f0\\fs28 Notepad is running\\cf0\\fs20 \r\n\\par \\pard \r\n\\par }\r\n" Left="Center" Top="Top" Width="455" Height="76" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
    <COMMENT/>
    <REPEAT UNTIL Variable="%Done%" Condition="\x00" Value="Done"/>
    <IF NOT WINDOW Option="\x01" Title="Notepad" Partial="TRUE" Wildcards="FALSE"/>
    <VARIABLE SET STRING Option="\x00" Destination="%Done%" Value="Done" NoEmbeddedVars="FALSE"/>
    <MACRO STOP/>
    <END IF/>
    <DELAY Flags="\x02" Time="1000"/>
    <END REPEAT/>

    In this example the text box display has a window title of "note_pad" because if that window title is "notepad" the macro never ends.

  14. 16 hours ago, jon said:

    I must say that it's very strange that v4.7.1.1 did not work with Windows 10, considering that support for this version didn't end until well after Win 10's release. 

    That issue was fixed in a later version of Macro Express Pro 4. The latest version of Macro Express Pro 4 is v 4.9.0.1 available here. However, in the long run, I think you''ll be happy having upgraded to Macro Express Pro 6.

  15. Here are some suggestions that may help:

     

    1. There is a command to extract the filename from a full path. Take a look at the "Variable Set From File path" macro command.

    2. Add a "Wait for File to be Ready" macro command before the "If File Exists"" macro command. Macro Express may get to the If File Exist command before Windows has finished copying the file.

    3. Since you already have the filenames and file paths consider using the "Copy File/Files" macro command to copy the files. It is generally easier to copy the files using Macro Express instead of manipulating Windows File Explorer to copy files.

    4. If you were to use descriptive variable names it would make your macro easier to understand. For example maybe %SourceFile%, %DestFolder%, or %Filename% instead of %T3% and %T4% in addition to %nPos%. %Input%, and %Output%.

     

×
×
  • Create New...