Jump to content
Macro Express Forums

Samrae

Members
  • Posts

    452
  • Joined

  • Last visited

  • Days Won

    22

Posts posted by Samrae

  1. Put Text Box Display commands before and after you Multiple Choice commands to display the value in your Choice variable. Put one outside the repeat loop to see when it gets out. This will help you figure out what is going wrong. If you expect to see "choice 1" and you are seeing "A" then you need to change to the Multiple Choice Menu's "Result Options" from "Save Item Value" to "Save Item Text".

     

    To have the macro perform different stuff when the user clicks Cancel, experiment with the options in the "On Error" tab of the Multiple Choice command. In my testing I found the "Variable Set String %Choice% to "" command before the Multiple Choice Menu necessary. YMMV

  2. What does your code look like? This sample macro works until the user leaves the choice blank or clicks the Cancel button.

    Repeat Until %Choice% Equals ""
      Variable Set String %Choice% to ""
      Multiple Choice Menu: Make Your Choice
      Text Box Display: Choice
      If Variable %Choice% Equals ""
        Continue
      End If
    End Repeat
    
    The "On Error" "The dialog was cancelled" setting for the Multiple Choice Menu is at the default value of Halt Macro.
  3. If macro A does a Save Variables and sometime later macro B does a Restore Variables the variables in Macro B will contain values from Macro A. Sometimes this is intentional and needed but from what I have seen, it is more often unnecessary.

     

    When a macro is activated it receives its own copy of variables. In other words, all its variables are empty. If variables are defined as 'Global' they are passed to other macros called from the top level macro via a Macro Run command. The Save Variables and Restore Variables commands are not needed for this to happen. When a variable is not defined as Global the value of that variable is not passed to a macro called by the Macro Run command.

     

    The Save/Restore Variables command pair is one way to pass variables from one macro to another but it is not necessarily the best way. The Restore Variables command can be used to retrieve variables passed to a macro via the command line.

  4. Simple fix? Switch to WIndows 7 or 8. ;)

     

    Are you using NTFS or FAT32 on your Windows XP system? It may be that you just need to upgrade to NTFS.

     

    Here's what happens: Macro Express requests the files in a certain folder. On Windows XP (or FAT32) information for the files is returned in the order they were written to the disk drive. On Windows Vista and later (or, possibly on an NTFS system) when Macro Express requests the files from Windows they are returned in alphabetical order.

     

    When you use Windows Explorer it sorts the list of files based on your sort criteria. They may be alphabetical, by file type or modified date.

     

    As a workaround you could store the list of files in an array and then have a macro sort the array.

  5. not sure what you mean by using named variables (I don't see anything in the help file or manual)?

     

    This would be clearer:

      Get Pixel Color at (30, 88) Relative to Current Window into %PageIconColor%
      Get Pixel Color at (48, 107) Relative to Current Window into %LinksIconColor%
      Get Pixel Color at (48, 394) Relative to Current Window into %MacrosIconColor%
    

    Note the descriptive variable names instead of N2, N4 and N5.

     

    From the help (emphasis mine):

    Types of Variables

    Macro Express supports several different types of variables. These are Text, Integer, Large Integer, Decimal, Control, Date/Time, Boolean and Handle variables. Variable names may be up to 31 characters in length.

  6. It is easier if you post the text version of your script so we don't have to copy and paste it into a macro to help. To copy the commands to the clipboard highlight your macro commands, right-click and choose "Copy Command Text". Your macro looks like this:

    Variable Set Integer %N1% to 0
    Repeat Until %N1% Equals "1"
      Delay: 2 seconds
      // 'Page' icon
      Get Pixel Color at (30, 88) Relative to Current Window into %N2%
      // 'Links' icon
      Get Pixel Color at (48, 107) Relative to Current Window into %N4%
      // 'Macros' icon
      Get Pixel Color at (48, 394) Relative to Current Window into %N5%
      If Variable %N2% Equals "14061138"
        AND
      If Variable %N4% Equals "16241482"
        AND
      If Variable %N5% Equals "16250871"
        Variable Set Integer %N1% to 1
      End If
      Delay: 500 milliseconds
    End Repeat
    Mouse Move: 60, 87 Relative to Screen
    Mouse Left Click
    
    

    So, if ...

     

    The value of all 3 variables (N2, N4 and N5) are correct and N1 is set to 1!

    Then the macro is working correctly. It says when it is discovered that N2, N4 and N5 are set to specific values then set N1 to 1. When N1 is set to 1 the repeat loop stops.

     

    It appears to me that %N2% = "14061138", %N4% = "16241482" and %N5% Equals "16250871" so it sets N1 to 1 and the repeat loop should stop.

  7. This says

    "What it does:

    This sample macro shows how to change a date from MM-DD-YY to DD-MMM-YYYY format using the 'Run Macro in Variable' command."

     

    Thats not what i'm asking for.

    I suggested that sample macro because I thought the technique described, setting a date format using the "Run Macro in Variable" command, could be adapted to what you need.

  8. Cory already showed how to pass a variable from Macro Express Pro to a VBScript. Maybe this more detailed explanation will help you understand how it works.

     

    VBScript does not know anything about Macro Express Pro. It has no way to directly read the content of a Macro Express variable. Macro Express has its way to store variables. VBS has another way to store variables.

     

    To pass the content of a Macro Express Pro variable into a VBScript you have to use the VBS command to set a value to a variable. The format to create variables and set them to specific values in VBS looks something like this:

    intTest=42
    strTest="gagangoomer's macro"

    To create variables in Macro Express Pro and set them to specific values do this:

    Variable Set Integer %intTemp% to 42
    Variable Set String %strTemp% to "gagangoomer's macro"
    

    Then, in the External Script command, include these lines:

    intTest=%intTemp%
    strTest="%strTemp%"
    

    When the macro runs the External Script command and passes the script information to VBScript the contents of the Macro Express variables ("42" and "gagangoomer's macro" respectively) will be substituted for the variable names ("%intTemp%" and "%strTemp%") so WScript (the program that runs the VBScript) will see it like this:

    intTest=42
    strTest="gagangoomer's macro"
    

    This is the way to pass a variable into VBScript via the External Script command.

     

    Another thing to consider would be to put the values you need into a resource that both Macro Express Pro and WScript / VBScript can access. If your VBScript can read from the registry you could have Macro Express Pro write values into the registry. Similiarly, Macro Express could write information into a file in a location where VBScript can read it. Paul suggested using the clipboard but you said that wouldn't work. I am not a VBScript expert but it would surprise me if a VBScript cannot read from the clipboard.

  9. The color 16777215 / 0xFFFFFF / 255 255 255 is white while 0 / 0x000000 / 000 000 000 is black. Each number can vary between 0 and 255 and represents how much Red, Green and Blue to display. If the computer displays all red, green and blue possible you get white and if it displays no red, green and blue you get black.

     

    Since colors are represented by numeric values it is possible create a "Wait for Pixel Color" function by creating a Repeat statement to wait until the value matches a certain color. In my macros I use OR statements to check for several colors. You need to be careful, though, because changing the Windows theme may require that you adjust your macro for the different colors.

  10. The portable version is written specifically for drives that can be removed from time to time. The standard version is meant to be installed on a drive that doesn't get removed.

     

    Your comment about licensing is a little confusing. If you have a 1-user license for the portable version then you should only be using it on one computer at a time. You can move it from computer to computer because it is portable. But if you install it on your HDD then I'm not sure the license allows you to use it on a flash drive for your other computer.

     

    The macros will run on either version of Windows. However, the parts of your macros that rely on things that change between Windows 7 and 8 may need to be written in a way that accomodates both. Just as one example, a macro written on Windows XP using the Calculater needed adjustments because the calculator program on Windows 7 was different. (I don't know if the Windows 8 calculator is different than the one on Windows 7 though.)

×
×
  • Create New...