Jump to content
Macro Express Forums

Samrae

Members
  • Content Count

    407
  • Joined

  • Last visited

  • Days Won

    20

Posts posted by Samrae

  1. This is what I do:

    1. Open the macro to debug in the Scripting Editor.

    2. Click Debug, Debug Windows, Variable Values to display the Variables window.

    3. Highlight the line in the macro where you want to test.

    4. Press Ctrl+B to set a breakpoint

    5. Click the run button (green arrow)

    The macro will run up to the breakpoint. Note the values in the variables in the Variables window.

    6. Press the F8 button to step on macro line at a time. Watch the variables change in the Variables window.

    I hope this helps.

  2. You can tell the Text Type command to send an <ENTER> by either putting in the <ENTER> tag or by pressing the Enter key on your keyboard. In this example:

    Line #1<ENTER>
    
    Line #2
    
    Line #3<ENTER>Line #4<ENTER>

    Two Enters will be typed between Line #1 and Line #2. One because of the <ENTER> and the other because of the non-visible Enter.

    There will be one line between Line #2 and Line #3 and between Line #3 and Line #4.

  3. I need to press (down and up) <ALT>, that means <ALT>, and nothing else

    I find <ALT> often does not work, specifically with Office programs. I generally use <ALTD> and <ALTU> instead. Have you tried

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

    Outlook may even want a small delay in between:

    Text Type (Simulate Keystrokes): <ALTD>
    Delay: 0.05 seconds
    Text Type (Simulate Keystrokes): <ALTU>
    

    or this

    Keystroke Speed: 30 milliseconds
    Text Type (Simulate Keystrokes): <ALTD><ALTU>
    Keystroke Speed: 0 milliseconds
    
    
  4. You may have read that backwards.

     

    Some programs do not allow Macro Express Pro to see mouse events from it or send mouse events to it.

     

    Windows calls these events messages. So, program XX does not let Macro Express Pro see messages generated from inside program XX. And it ignores messages Macro Express Pro sends messages to program XX. This starts to occur when the mouse is over program XX or when program XX is active/focused.

  5. What you are seeing is normal. When Macro Express Pro is running with standard user permissions Windows does not allow mouse events (clicks and moves) from programs running with elevated permissions (admin). The Mouse Locator also stops working inside Task Manager. To resolve this close the Mouse Locator and Macro Express, run Macro Express Pro as Administrator and click to run Mouse Locator again.

     

    Further, programs can be written to prevent mouse events from other programs (such as Macro Express Pro) regardless of there permissions levels. The information I received said that to determine if a program prevents these mouse events launch the Mouse Locator and see if it updates over that program. My testing with such a program confirmed this.

     

    When I ran Macro Express as administrator and ran the Mouse Locator it updated the coordinates over the Disk Management, Computer Management and Task Manager programs. I did not, however, try it when Disk Management said "Connecting to Virtual Disk Service". Edit: I tried it and it worked.

  6. Here are some ideas I had:

    1. See if using <ALTD> and <ALTU> instead of <ALT> works better.

    2. Try slowing down the typing a bit. Maybe Acrobat or your computer are responding a little slowly.

    Keystroke Speed: 1000 milliseconds
    Text Type (Simulate Keystrokes): <ALTD>v<ALTU>ma
    Keystroke Speed: 1 milliseconds
    

    (If this helps then adjust the 1000 milliseconds to something more reasonable that still works.)

     

    3. To determine whether or not a macro is being activated you can, as rberg suggested, put a Text Box Display as the first line in the macro. Another idea is to put a Sound File command in the first line of the macro. Or, with v 4.7.0.1 and later you can use the "Play a sound when a macro runs" option found in the Preferences under Playback, Miscellaneous. This option will play a sound every time a macro is activated so you will want to turn it off after fixing your macro.

    4. Try running Macro Express Pro as Administrator. Some programs do not allow macros to run unless Macro Express is running with Admin privileges.

    5. Try turning Protected Mode off in Adobe Acrobat Reader:

    • Open Adobe Acrobat Reader
    • Click Edit, Preferences
    • For Adobe Acrobat Reader DC or XI click Security (Enhanced)
    • For Adobe Acrobat Reader X click General
    • Click to uncheck the "Enable Protected mode at startup" setting
    • Click the OK button to save
    • Restart Adobe Acrobat Reader

    Please let us know what, if anything, helped.

  7. By the way, you should upgrade from v 3.5c to the latest version. At the time of this writing the latest version is v 3.10b. There have been hundreds of bug fixes, enhancements and security patches since v 3.5c. Your Macro Express 3 license will work with the latest version. The Revision History contains a complete list of changes.

  8. There are several ways to save variable values for use in other macros. You can save to and restore from Environment variables, the Registry, an INI File and Text Files. You may also use the Variable Save and Variable Restore commands.

     

    There is an example of saving a value between macros in the samples.mex sample macro file. This file should have been installed on your computer when you installed Macro Express. It may be in the c:\Program Files (x86)\Macro Express3 folder or it may be in your documents folder. Or you can download a copy from http://www.macros.com/samplemacros3.htm. (Do not try to use or edit the file in the Program Files (x86) folder. You should copy it to another location before using it. Windows prevents programs making changes to files in the Program Files (x86) folders.)

     

    Once you find the samples.mex macro file look at the macro "Counter_From_Run_To_Run". This macro saves a value in the file TESTVAL.TXT located in your Windows Temp folder. It increments the value and saves it back out to TESTVAL.TXT. If you study this macro you can see how it is done.

     

    For more detailed information about variables read the article How do Local and Global variables work and what is Variable Scope?

     

    This article is written for Macro Express Pro and refers to variables like %Address% instead of something like %T1% but the concepts are the same for Macro Express 3. The section titled "Making information available to different macro threads" details the ways to save and load variables.

  9. Rather than adding a Keystroke Speed command at the top of each macro you may want to adjust the Text Type Delay found in the Preferences under Delays.

     

    If these don't work you could add a Delay command at the top of each macro.

     

    What malware/anti-virus do you use? A few months ago Windows Defender was causing delays activating macros. Your symptoms are do not exactly match what you are describing but it Windows Defender (or other Internet Security software) can affect how macros work.

  10. I'm only vaguely familiar with use of variables in Macro Express; cook-book stumbled through the process two times years ago.

    Use of variables is key to powerful macros.

     

    What variable goes in the T1 and how do I define it?

    The variables T1 through T99 are string variables. The Repeat with Folder command will put the name of a file in T1 each time it loops. It will loop once for each file in the specified folder. If you have questions, try it.

  11. I'm not exactly sure what your macro logic is doing but it looks like the topmost repeat does not exit when you find one of the two active windows. Could it be that the Activate Window command is working but your macro does not stop?

     

    I would write this a little differently. Here is your macro with some commands rearranged and the GoTo commands removed. (Lines with <-- are new):

    Variable Set String %StopNow% to "FALSE" // <--
    Repeat Start (Repeat %nb_de_comptes% times)
     
    // Clic.
      Mouse Move: %N[1]%, %N[2]% Relative to Screen
      Mouse Left Click
       
      // Si demande pour rejoindre combat.
      Get Pixel Color at (%pos_interrogation_invitation[1]%, %pos_interrogation_invitation[2]%) Relative to Screen into %N[3]%
      If Variable %N[3]% Equals "%bleu_invitation%"
        Delay: %delay_joint_combat% milliseconds
      End If
       
      // Reset :
      Variable Set String %active_window% to ""
      Variable Set Integer %N[3]% to 0
      Variable Set Integer %N[4]% to 1
       
       
      Variable Set String %active_window% to "" // Initialize this variable in case the If commands below fail <--
      Repeat Start (Repeat %nb_de_comptes% times)
        Variable Modify Integer: %N[3]% = %N[3]% + 1
        Variable Modify Integer: %N[4]% = %N[4]% + 1
         
        If Window "%persos[%nb_de_comptes%]%" is focused
          Repeat Until %active_window% Equals "%persos[1]%"
            Window Activate: %persos[1]%
            Wait for Window Title: %persos[1]%
            Delay: 20 milliseconds // CPU.
            Variable Set String %active_window% to topmost window title
            Variable Set String %StopNow% to "TRUE" // <--
            Repeat Exit // <--
          End Repeat
        Else
          If Window "%persos[%N[3]%]%" is focused
            Repeat Until %active_window% Equals "%persos[%N[4]%]%"
              Window Activate: %persos[%N[4]%]%
              Delay: 20 milliseconds // CPU.
              Variable Set String %active_window% to topmost window title
              Variable Set String %StopNow% to "TRUE" // <--
              Repeat Exit // <--
            End Repeat
          End If
        End If
        Delay: 20 milliseconds // CPU.
         
        If Variable %StopNow% Equals "TRUE" // <--
          Repeat Exit // <--
        End If // <--
      End Repeat
       
      :Ok.
      Delay: 180 milliseconds // délai supplémentaire de sécurité.
      If Variable %delay_chg_perso% Equals "1" // Si l'option est activée.
      Delay: %random_delai% milliseconds
      End If
       
      If Variable %StopNow% Equals "TRUE" // <--
        Repeat Exit // <--
      End If // <--
    End Repeat
    
    
  12. Okay, thanks.

     

    I guess everyone has different techniques to write macros. You and Cory are correct, there are some commands that do not prompt to create a variable. However, I have found that it is rare (never?) that I use a variable in a macro without having used at lease one of the macro commands that does prompt to create a variable.

     

    But, here is an idea that may help ikodan. It is a solution to only half of the problem but maybe the second part can be accomplished via a macro to define variables in a macro.

     

    When you export a macro as a Playable macro it is saved to a file with a file extension of .mxe. The content of this file, however, is in ASCII text format and can be edited with notepad or another text editor. All of the variables are listed at the top of the .mxe file. Here is an example:

    <<Macro Express 4 Playable Macro>>
    [string:%T% elements:99 global:true]
    [integer:%N% elements:99 global:true]
    [float:%D% elements:99 global:true]
    [control:%C% elements:99 global:true]
    [string:%IP_Address% elements:0 global:true]
    [string:%ConsoleID% elements:0 global:true]
    [string:%ProgramVersionNumber% elements:0 global:true]
    [string:%TAB2% elements:0 global:true]
    [string:%TAB3% elements:0 global:true]
    [string:%TAB% elements:0 global:true]
    [string:%TAB4% elements:0 global:true]
    [integer:%MaxCPUs% elements:0 global:true]
    [integer:%Idx% elements:0 global:true]
    [integer:%CPU Idx% elements:0 global:true]
    [string:%CPU Identifier% elements:50 global:true]
    [string:%CPU ProcessorNameString% elements:50 global:true]
    [string:%CPU VendorIdentifier% elements:50 global:true]
    [integer:%CPU Counter% elements:0 global:true]
    [string:%WindowsStr% elements:0 global:true]
    [string:%WindowsSP% elements:0 global:true]
    [string:%CR% elements:0 global:true]
    [string:%LF% elements:0 global:true]
    [string:%TAB5% elements:0 global:true]
    [string:%MacroName% elements:0 global:true]
    [string:%sTemp% elements:0 global:true]
    <<BEGIN SCRIPT>>
    
  13. My first thought would be to put the names of the macros in a string array variable and then create an integer array variable of the same size with random numbers in it. Loop from the beginning to the end of the integer array and grab the integer value and use it as an index into the string array.

     

    This doesn't do everything you specify but it may get you started and you could adjust as needed.

    Variable Set Integer %ArrayElements% to 40
    Variable Set String %MacroArray% to ""
     
    Variable Set String %MacroArray[1]% to "MacroName1"
    Variable Set String %MacroArray[2]% to "MacroName2"
    Variable Set String %MacroArray[3]% to "MacroName3"
    //               .
    //               .
    //               .
    Variable Set String %MacroArray[40]% to "MacroName40"
    
    Repeat Start (Repeat %ArrayElements% times)
      Variable Set Integer %IdxArray[1]% to 0
      Variable Set Integer %IdxArray[%Idx%]% to a random value between 1 and %ArrayElements%
    End Repeat
     
    Repeat Start (Repeat %ArrayElements% times)
      Macro Run: %MacroArray[%Idx%]%
    End Repeat
    

    You could also put the names of the macros in a file and use something like the Text File Begin/End Process commands to load them into the MacroArray variable.

  14. Others can better help you if you post your macro in a form that can be copied (as you did) and in a form that can be read, like this:

    // Accepte l'invitation.
    Variable Set Integer %N[1]% to %bleu_invitation%
    Repeat Until %N[1]% Does not Equal "%bleu_invitation%"
      Mouse Move: %pos_accepter_invitation[1]%, %pos_accepter_invitation[2]% Relative to Screen
      Mouse Left Click
       
      Text Box Display: débug :
       
      Delay: 500 seconds
      Mouse Move: 0, 0 Relative to Screen
      Delay: 500 milliseconds
      Get Pixel Color at (%pos_inte_invitation[1]%, %pos_inte_invitation[2]%) Relative to Screen into %N[1]%
       
      Text Box Display: débug :
       
      // Calibrage debug.
      Variable Set Decimal %bug_zone% to 1.7
      Macro Run: - CALIBRAGE # - auto-debug.
    End Repeat
    Variable Set Decimal %bug_counter% to 0
    
    

    You can copy your macro in a readable format by highlighting the macro commands, right-clicking your mouse and choosing "Copy Command Text".

     

    Looking at your macro in a format that we can read it shows that you have a delay of 500 seconds. That is more than 8 minutes.

    • Like 1
×
×
  • Create New...