Jump to content
Macro Express Forums

Samrae

Members
  • Content Count

    407
  • Joined

  • Last visited

  • Days Won

    20

Posts posted by Samrae

  1. 1 hour ago, Cory said:

    I was wrong. MEP works fine in UWP apps. I've been doing my activations incorrectly. I apologize for the misinformation. 

    No, you were not wrong. UWP programs do not follow long established standards for Windows programming. Hooks work but many hotkeys are blocked. I cannot launch a UWP .exe using the Program Launch command so I have to launch it from the menus. They do not use Alt key shortcuts. The is no File menu. They are very slow and require long delays. They do not support Window Controls.

     

    Because you prefer to use Window Controls your statement that macros do not not work with UWP programs is not incorrect.

     

    Specifically, in this case, your macro activated with Ctrl+Keypad 9 did not activate. Changing the hotkey to Ctrl+Shift+b worked.

     

    Working with UWP programs is tedious and frustrating. But, with effort, I have been able to get macros to work with them. Your mileage may vary.

  2. Do you have a macro that uses the Keystroke Speed command? I discovered that if one macro sets the Keystroke Speed, to 500 say, and does not reset it back to 0 then all other macros that I run after that type text slowly. I try to remember to set Keystroke Speed back to 0 in any macro that changes it.

     

    You could check for this by putting a Keystroke Speed: 0 at the top of one of your macros that is typing slowly. If it starts to work more quickly you can search for the macro that slows down the keystroke speed.

     

    Another thing to check is whether the Delay after keystroke value found in Playback, Delays has been changed. The default value for this is 300.

  3. It has been stated several times on forum that Macro Express does not work with UWP programs. That is not my experience. UWP programs behave differently than Win32 programs but, with some effort, I have been able to get Macro Express to work with them.

     

    I took this as a challenge to get Macro Express to work with Windows 10 Settings. Here is a macro that opens Windows Settings, navigates to Apps & Features, and closes Settings.

     

    Note: This macro was written with Macro Express Pro 6, not ME 4.

    // -----------------------------------
    //   Initialization
    // -----------------------------------
    Variable Set Decimal %SDelay% to 0.1 // Short delay
    Variable Set Decimal %MDelay% to 1 // Medium delay
    
    Variable Set Decimal %LDelay% to 2 // Long delay
    Keystroke Speed: 200 milliseconds
    Text Box Display: Progress ...
     
    // -----------------------------------
    //   Open Windows Settings
    // -----------------------------------
    If Not Window "Settings" is running
      Text Type (Simulate Keystrokes): <WIND>
      Delay: %SDelay% seconds
      Text Type (Simulate Keystrokes): <WINU>
      Delay: %MDelay% seconds
      Text Type (Simulate Keystrokes): Settings
      Delay: %SDelay% seconds
      Text Type (Simulate Keystrokes): <ENTER>
      Text Box Update: Progress ...
      Wait for Window Title: Settings
    End If
     
     
    Delay: %LDelay% seconds
     
    // Set focus to Windows Settings
    If Window "Settings" is running
      Text Box Update: Progress ...
      If Not Window "Settings" is focused
        Text Box Update: Progress ...
        Window Activate: Settings
        Delay: %LDelay% seconds
      End If
       
      If Program "SYSTEMSETTINGS.EXE" is running
       
        Text Box Update: Progress ...
         
        // Type
        Delay: %MDelay% seconds
        Text Type (Simulate Keystrokes): Apps &
        Delay: %MDelay% seconds
        Text Type (Simulate Keystrokes): <ENTER>
        Delay: %MDelay% seconds
        Text Type (Simulate Keystrokes): <ENTER>
         
        Text Box Update: Progress ...
        If Message "Close Settings?"
          Delay: %sDelay% seconds
           
          // Restore focus to Settings
          If Not Window "Settings" is focused
            Text Box Update: Progress ...
            Window Activate: Settings
            Delay: %LDelay% seconds
          End If
           
          // Now close Settings
          Text Box Update: Progress ...
          Text Type (Simulate Keystrokes): <ALTD><SPACE><ALTU>
          Delay: %sDelay% seconds
          Text Type (Simulate Keystrokes): c
           
           
          Text Box Update: Progress ...
          Delay: 1.5 seconds
        End If
         
         
      End If
    End If
     
    // -----------------------------------
    //   Done
    // -----------------------------------
    Keystroke Speed: 0 milliseconds
    <COMMENT Value="-----------------------------------"/>
    <COMMENT Value="  Initialization"/>
    <COMMENT Value="-----------------------------------"/>
    <VARIABLE SET DECIMAL Option="\x00" Destination="%SDelay%" Value="0.1" _COMMENT="Short delay"/>
    <VARIABLE SET DECIMAL Option="\x00" Destination="%MDelay%" Value="1" _COMMENT="Medium delay\r\n"/>
    <VARIABLE SET DECIMAL Option="\x00" Destination="%LDelay%" Value="2" _COMMENT="Long delay"/>
    <KEYSTROKE SPEED Delay="200"/>
    <TEXT BOX DISPLAY Title="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Launcing SystemSettings\\f1 \r\n\\par }\r\n" Left="Center" Top="20" Width="564" Height="143" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x02" Delay="0"/>
    <COMMENT/>
    <COMMENT Value="-----------------------------------"/>
    <COMMENT Value="  Open Windows Settings"/>
    <COMMENT Value="-----------------------------------"/>
    <IF NOT WINDOW Option="\x01" Title="Settings" Partial="TRUE" Wildcards="FALSE"/>
    <TEXT TYPE Action="0" Text="<WIND>"/>
    <DELAY Flags="\x01" Time="%SDelay%"/>
    <TEXT TYPE Action="0" Text="<WINU>"/>
    <DELAY Flags="\x01" Time="%MDelay%"/>
    <TEXT TYPE Action="0" Text="Settings"/>
    <DELAY Flags="\x01" Time="%SDelay%"/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Wait for Window \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <WAIT FOR WINDOW TITLE Title="Settings" Partial="TRUE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="45"/>
    <END IF/>
    <COMMENT/>
    <COMMENT/>
    <DELAY Flags="\x01" Time="%LDelay%"/>
    <COMMENT/>
    <COMMENT Value="Set focus to Windows Settings"/>
    <IF WINDOW Option="\x01" Title="Settings" Partial="TRUE" Wildcards="FALSE"/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\cf1\\b\\f0\\fs20 Settings\\b0  is running\\cf0\\f1 \r\n\\par }\r\n"/>
    <IF NOT WINDOW Option="\x00" Title="Settings" Partial="TRUE" Wildcards="FALSE"/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Set Focus to \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <WINDOW ACTIVATE Title="Settings" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <DELAY Flags="\x01" Time="%LDelay%"/>
    <END IF/>
    <COMMENT/>
    <IF PROGRAM Option="\x01" Program="SYSTEMSETTINGS.EXE"/>
    <COMMENT/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Select Apps in \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <COMMENT/>
    <COMMENT Value="Type"/>
    <DELAY Flags="\x01" Time="%MDelay%"/>
    <TEXT TYPE Action="0" Text="Apps &"/>
    <DELAY Flags="\x01" Time="%MDelay%"/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <DELAY Flags="\x01" Time="%MDelay%"/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <COMMENT/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\cf1\\b\\f0\\fs20 Settings\\b0  is loaded\\cf0\\f1 \r\n\\par }\r\n"/>
    <IF MESSAGE Caption="Close Settings?" Message="Do you want to close Settings now?" BtnMode="\x00" Default="TRUE" Left="Center" Top="40" Monitor="0" Delay="0"/>
    <DELAY Flags="\x01" Time="%sDelay%"/>
    <COMMENT/>
    <COMMENT Value="Restore focus to Settings"/>
    <IF NOT WINDOW Option="\x00" Title="Settings" Partial="TRUE" Wildcards="FALSE"/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Set Focus to \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <WINDOW ACTIVATE Title="Settings" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <DELAY Flags="\x01" Time="%LDelay%"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="Now close Settings"/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Closing \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <TEXT TYPE Action="0" Text="<ALTD><SPACE><ALTU>"/>
    <DELAY Flags="\x01" Time="%sDelay%"/>
    <TEXT TYPE Action="0" Text="c"/>
    <COMMENT/>
    <COMMENT/>
    <TEXT BOX UPDATE Header="Progress ..." Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red0\\green0\\blue128;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Closed \\cf1\\b Settings\\cf0\\b0\\f1 \r\n\\par }\r\n"/>
    <DELAY Flags="\x01" Time="1.5"/>
    <END IF/>
    <COMMENT/>
    <COMMENT/>
    <END IF/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="-----------------------------------"/>
    <COMMENT Value="  Done"/>
    <COMMENT Value="-----------------------------------"/>
    <KEYSTROKE SPEED Delay="0"/>

     

  4. To copy what you see in the Macro Script Editor, highlight the macro lines lines you want, right-click, and click "Copy Command Text". Then, in this forum, click the <> icon and type ctrl+v to paste. The result looks like this:

    Text Type (Simulate Keystrokes): <ALT>e
    Text Type (Simulate Keystrokes): <ALTD>e<ALTU>

    To copy macro commands that someone can copy from this forum and paste into Macro Express, highlight the macro lines you want, right-click, and click "Copy". Then, again, in this forum, click the <> icon and type ctrl+v to paste. The result looks like this:

    <TEXT TYPE Action="0" Text="<ALT>e"/>
    <TEXT TYPE Action="0" Text="<ALTD>e<ALTU>"/>

    Often when asking for help it is a good idea to post both. If you make it easy for forum members to understand and help you will get better answers. 🙂

  5. As recommended elsewhere, please put macro samples in a codebox (see <> above) instead of posting an image.

     

    When you have the macro do a Text Type <ALT>E what gets sent to the application is <ALT Down> <Shift Down> e <Shift Up> <ALT up>. What you need is:

    Text Type (Simulate Keystrokes): <ALT>e

    Sometimes that does not work reliably. This often works better:

    Text Type (Simulate Keystrokes): <ALTD>e<ALTU>

     

  6. I recommend you begin by clicking Options, Preferences, Activations and then the ShortKeys tab. Enter something like ".." in the Prefix keys box. Once you do that your shortkey macro will not automatically type out.

     

    If the macro is one you recently changed you can click on the "Modified" header. This will bring the most recently modified macro to the top (or bottom) of the list. If I recall correctly, I usually have to click in the Modified header twice to move the most recently modified macro to the top.

     

    If the issue is with your shortkey activation settings then you may want to try the "Use suffix keys" option. There is extensive documentation on how the shortkey macro activation works here: https://www.macros.com/skplayback.htm

     

     

  7. A copy of the samples.mex file can be found in the folder where the Macro Express program files are installed (C:\Program Files (x86)\Macro Express Pro 6). Use Windows File Explorer to copy this file to another folder then, within Macro Express, click File, Open File to open it.

     

    You should not open the samples.mex file directly in the C:\Program Files (x86)\Macro Express Pro 6 folder.

     

    Or, as acantor said, you can download samples.mex from here: Sample Macros.

     

     

  8. Yes, if you are using the portable version the settings would be in an .INI file and not in the registry.

     

    If the .INI file contains Check Syntax = 1 I would expect the syntax checking to work. To be sure, you could delete the line in the .INI file that contains Check Syntax to tell Macro Express to turn syntax checking back on.

     

    Be sure that Macro Express is not running when you change the .INI file.

     

  9. I duplicated this issue using Macro Express Pro 6. When the Syntax Error box is displayed and you click "Don't show this again", syntax checking is turned off and cannot be easily turned back on.

     

    Syntax checking can be restored if you edit the registry and change

      HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 4\Editor\Check Syntax

     

    to a value of 1.

     

    I have reported this to Insight Software Solutions. There should be a better way to re-enable syntax checking.

  10. 11 hours ago, iconoglasses said:

    Hi! Thanks, but to the first- there needs to be a TAB between the User Name and Password, that one doesn't have it. A few tests have resulted in part of my password being entered on the User Name line. Spaces are also read as an incorrect password. There must be a TAB use or equivalent.

     

    So, add a tab:

    Text Type (Simulate Keystrokes): your User Name
    Delay: 4 seconds
    Text Type (Simulate Keystrokes):  <KEYD:VK_TAB>
    Delay: 1 seconds
    Text Type (Simulate Keystrokes):  <KEYU:VK_TAB>
    Delay: 4 seconds
    Text Type (Simulate Keystrokes): your Password
    Delay: 4 seconds
     
    Text Type (Simulate Keystrokes):  <KEYD:VK_TAB>
    Delay: .5 seconds
    Text Type (Simulate Keystrokes):  <KEYU:VK_TAB>

     

    Quote

    To the second suggestion, I did the simulate keystrokes and used the key down and up and it did not work. It then proceeded to enter the first 2 characters of my password on the User Name field, before the rest spilled over into the Password area.

     

    Maybe a clue. It is interesting that your password was entered partially into two different fields. Here is another thing to try. Macro Express can "type" much faster than you can. 😃 What I have been trying to suggest is to slow things down. Maybe you also need to slow down the keystrokes between the characters of your name and password.

     

    If I recall correctly, when using a 3270 emulator, each keystroke is accepted by the emulator, sent to the host (IBM mainframe computer) and then sent back to the emulator to be displayed (or something like that).

     

    Try something like this. This will be very slow! It is only a test to see if slowing things down helps the emulator and host recognize the keystrokes. Try it and tell us exactly what you see.

    Keystroke Speed: 500 milliseconds
    Text Type (Simulate Keystrokes): UserName
    Delay: 2 seconds
    Text Type (Simulate Keystrokes): <KEYD:VK_TAB>
    Delay: 1 seconds
    Text Type (Simulate Keystrokes): <KEYU:VK_TAB>
    Delay: 2 seconds
    Text Type (Simulate Keystrokes): Password
    Delay: 2 seconds
    Text Type (Simulate Keystrokes): <KEYD:VK_TAB>
    Delay: 1 seconds
    Text Type (Simulate Keystrokes): <KEYU:VK_TAB>
    Delay: 2 seconds
    Text Type (Simulate Keystrokes): <KEYD:VK_TAB>
    Delay: 1 seconds
    Text Type (Simulate Keystrokes): <KEYU:VK_TAB>

     

     

  11. It has been a while since I used 3270 emulator software. I remember some things being a little tricky to automate because the emulator software handled keystrokes directly instead of via the usual Windows messages and hooks.

     

    What happens if you send keystrokes via "Simulate Keystrokes" instead of via a Window Control? Something like this:

    // Do whatever commands are necessary to launch the Mocha 3270
    // emulator and wait for it to be completely loaded and stable
     
    Text Type (Simulate Keystrokes): your User Name
    Delay: 1 seconds
    Text Type (Simulate Keystrokes): your Password
    Delay: 5 seconds
    Text Type (Simulate Keystrokes): <TAB>
    Delay: 5 seconds
    Text Type (Simulate Keystrokes): <TAB>

    The Delays are extra long just to see if the commands work. If they do you can reduce the delay time.

     

    If that does not work you could try something like this:

    // Do whatever commands are necessary to launch the Mocha 3270
    // emulator and wait for it to be completely loaded and stable
     
    Text Type (Simulate Keystrokes): your User Name
    Delay: 1 seconds
    Text Type (Simulate Keystrokes): your Password
    Delay: 4 seconds
     
    Text Type (Simulate Keystrokes):  <KEYD:VK_TAB>
    Delay: .5 seconds
    Text Type (Simulate Keystrokes):  <KEYU:VK_TAB>

     

    Copy this and paste it into your macro:

    <COMMENT Value="Do whatever commands are necessary to launch the Mocha 3270"/>
    <COMMENT Value="emulator and wait for it to be completely loaded and stable"/>
    <COMMENT/>
    <TEXT TYPE Action="0" Text="your User Name"/>
    <DELAY Flags="\x01" Time="1"/>
    <TEXT TYPE Action="0" Text="your Password"/>
    <DELAY Flags="\x01" Time="4"/>
    <COMMENT/>
    <TEXT TYPE Action="0" Text=" <KEYD:VK_TAB>"/>
    <DELAY Flags="\x01" Time=".5"/>
    <TEXT TYPE Action="0" Text=" <KEYU:VK_TAB>"/>

     

  12. In the Text Type command dialog there is a dropdown with options that determine how the Text Type work. The Action= corresponds to this choice:

     

      Simulate Keystrokes:                  Action="0"

      Use Clipboard and Paste Text:  Action="1"

      Send Text Directly to Control:    Action="2"

      Paste Rich Text:                           Action="3"

     

  13. 2 hours ago, biplab54 said:

    Message should update after completion of every repeat.

    You may find that displaying the message that often slows down your processing. Some of my macros update the counter every 25 iterations while other macros update every 100.

     

    Here is a snippet of one of my macros. It works just as Cory suggested. This sample uses the ASCII File Begin/End Process loop but a Repeat loop will work just as well

    Text Box Display: Progress
    // Process the file
    ASCII File Begin Process: "D:\ZZZZ\csv\zd.csv" (Comma Delimited Text (.csv))
     
    // Display progress counter
      Variable Modify Integer: %N[2]% = %N[1]% / 100
      If Variable %N[2]% Does not Equal "%N[3]%"
        Text Box Update: Progress
        Variable Modify Integer set %N[3]% to the contents of %N[2]%
      End If
    
    ASCII File End Process
    <TEXT BOX DISPLAY Title="Progress" Content="{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs16 \r\n\\par     Processing line number: %N[1]%\r\n\\par }\r\n" Left="Right" Top="Top" Width="327" Height="114" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x02" Delay="1"/>
    <COMMENT Value="Process the file"/>
    <ASCII FILE BEGIN PROCESS Filename="D:\\ZipCodeDownload\\csv\\zd.csv" Format="CSV" Start_Record="1" Process_All="TRUE" Records="1" Variable="%T%" Start_Index="10"/>
    <COMMENT Value="Display progress counter"/>
    <VARIABLE MODIFY INTEGER Option="\x03" Destination="%N[2]%" Value1="%N[1]%" Value2="100"/>
    <IF VARIABLE Variable="%N[2]%" Condition="\x01" Value="%N[3]%" IgnoreCase="FALSE"/>
    <TEXT BOX UPDATE Header="Progress" Content="{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs16 \r\n\\par     Processing line number: %N[1]%\r\n\\par }\r\n"/>
    <VARIABLE MODIFY INTEGER Option="\x06" Destination="%N[3]%" Variable="%N[2]%"/>
    <END IF/>
    <COMMENT/>
    <ASCII FILE END PROCESS/>

     

  14. I do not know Python but here are some suggestions.

     

    1. To make information available to a separate program you would need to have Macro Express save it somewhere the other program has access to. I can think of two options: You could write to a file or you could write to the registry. There are macro commands to write and read to either place. I would think there are Python commands to read and write to a file or the registry.

     

    2. There are two ways to launch a macro via an external program such as a Python script.

     

    a) Have Python call Macro Express this way:

    C:\Program Files (x86)\Macro Express Pro 6\MeProc.exe /A::Filename?Macroname

    Substitute "Filename" with the name of your macro file and "Macroname" with the name of your macro. See Launching macros from a command line parameter for more information.

     

    b) Call via an API call. There are some examples written in Delphi, C/C++/Visual C Example, and VBA here: API Examples . You would need to use these examples to do the equivalent using Python.

×
×
  • Create New...