Jump to content
Macro Express Forums

kevin

Admin
  • Posts

    1,950
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by kevin

  1. This morning, I downloaded and installed Macro Express Pro 4.2.0.1.

     

    Now, 4.1.7.1 appears to be the latest version.

     

    What happened?

    An hour after releasing v 4.2.0.1 we discovered a bug. Macro Express v 4.2.0.1 was withdrawn and will be replaced shortly by v 4.2.1.1. We apologize for the confusion.

  2. I can think of a few ways to do this. Here is a simple one:

    Text File Begin Process: c:\test.txt // Process each line, one at a time
     Split String "%ALine%" on "|" into %Fields%, starting at 1 // Split the line into elements of an array
    
     // Here the content of the fields are in %Fields[1]%, %Fields[2]%, %Fields[3]%, ... %Fields[6]%
    
    Text File End Process
    

    Copy and paste this into a macro to try it.

    <TEXT FILE BEGIN PROCESS Filename="c:\\test.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%ALine%" _COMMENT="Process each line, one at a time"/>
    <SPLIT STRING Source="%ALine%" SplitChar="|" Dest="%Fields%" Index="1" _COMMENT="Split the line into elements of an array"/>
    <COMMENT/>
    <COMMENT Value="Here the content of the fields are in %Fields[1]%, %Fields[2]%, %Fields[3]%, ... %Fields[6]%"/>
    <COMMENT/>
    <TEXT FILE END PROCESS/>
    

  3. This macro will open up a new window in Firefox, launch a web page and resize the window:

     

    Program Launch: "firefox.exe""
    Wait For Window Title: "Mozilla Firefox"
    Delay 0.2 Seconds
    Text Type: <ALTD>d<ALTU>
    Delay 0.3 Seconds
    Text Type: www.macros.com
    Text Type: <ENTER>
    Wait For Window Title: "Macro Express – Macros for your Windows Automation Needs - Mozilla Firefox"
    Delay 0.2 Seconds
    Window Resize: Macro Express – Macros for your Windows Automation Needs - Mozilla Firefox - (Width: 400, Height: 400)

    To write this macro I first thought about how I would do it manually and then replicated those steps using macro commands. I do not know how to open a web page without the header and address bars. Perhaps you can find some keyboard shortcuts to hide those items.

     

    To experiment with this macro copy the following and paste it into a macro:

     

    <LAUNCHDEL2:0:01"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"><WAITWIN2:000001:000000:Mozilla Firefox><DELAY:0.2><TEXTTYPE:<ALTD>d<ALTU>><DELAY:0.3><TEXTTYPE:www.macros.com><TEXTTYPE:<ENTER>><WAITWIN2:000001:000000:Macro Express – Macros for your Windows Automation Needs - Mozilla Firefox><DELAY:0.2><WSIZE:00400,00400Macro Express – Macros for your Windows Automation Needs - Mozilla Firefox

    You will need to change the path in the Program Launch command, the web page URI and you may need to adjust the delays depending on your computer and internet speed.

  4. I can think of several ways to do this. Here are three.

     

    If I remember correctly, the EOF character is 1A hex or 26 decimal. If the EOF character only exists at the end of the file then this technique will work. It deletes the EOF character by replacing it with nothing.

    // Method 1 - Replace EOF character with nothing.
    Variable Set to ASCII Char 26 to %EOF%
    Variable Set String set %FileContent% to the contents of c:\InFile.txt
    Variable Modify String: Replace "%EOF%" in %FileContent% with ""
    Variable Modify String: Save %FileContent% to "c:\OutFile.txt"
    

    If you are not sure of the EOF character or whether it exists more than once in the file you may want to try Method 2 or 3. Method 2 deletes the last character.

    // Method 2 - Copy all but last character using Delete
    Variable Set String set %FileContent% to the contents of c:\InFile.txt
    Variable Set Integer %Length% to the length of variable %FileContent%
    Variable Modify Integer %Length%: Decrement
    Variable Modify String %FileContent%: Delete a substring starting at %Length% and 1 characters long
    Variable Modify String: Save %FileContent% to "c:\OutFile.txt"
    

    Method 3 copies all but the last character.

    // Method 3 - Copy all but last character using Copy
    Variable Set String set %FileContent% to the contents of c:\InFile.txt
    Variable Set Integer %Length% to the length of variable %FileContent%
    Variable Modify Integer %Length%: Decrement
    Variable Modify String: Copy a substring in %FileContent%, starting at 1 and %Length% characters long to %FileContentOut%
    Variable Modify String: Save %FileContentOut% to "c:\OutFile.txt"
    

    To experiment with each of these copy the following code and paste it into a macro:

    <COMMENT/>
    <COMMENT/>
    <COMMENT Value="Method 1 - Replace EOF character with nothing."/>
    <VARIABLE SET TO ASCII CHAR Value="26" Destination="%EOF%"/>
    <VARIABLE SET STRING Option="\x03" Destination="%FileContent%" Filename="c:\\InFile.txt" Strip="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%FileContent%" ToReplace="%EOF%" All="FALSE" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x11" Destination="%FileContent%" Filename="c:\\OutFile.txt" CRLF="FALSE"/>
    <COMMENT/>
    <COMMENT/>
    <COMMENT Value="Method 2 - Copy all but last character using Delete"/>
    <VARIABLE SET STRING Option="\x03" Destination="%FileContent%" Filename="c:\\InFile.txt" Strip="FALSE"/>
    <VARIABLE SET INTEGER Option="\x0D" Destination="%Length%" Text_Variable="%FileContent%"/>
    <VARIABLE MODIFY INTEGER Option="\x08" Destination="%Length%"/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%FileContent%" Start="%Length%" Count="1"/>
    <VARIABLE MODIFY STRING Option="\x11" Destination="%FileContent%" Filename="c:\\OutFile.txt" CRLF="FALSE"/>
    <COMMENT/>
    <COMMENT/>
    <COMMENT Value="Method 3 - Copy all but last character using Copy"/>
    <VARIABLE SET STRING Option="\x03" Destination="%FileContent%" Filename="c:\\InFile.txt" Strip="FALSE"/>
    <VARIABLE SET INTEGER Option="\x0D" Destination="%Length%" Text_Variable="%FileContent%"/>
    <VARIABLE MODIFY INTEGER Option="\x08" Destination="%Length%"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%FileContentOut%" Variable="%FileContent%" Start="1" Count="%Length%"/>
    <VARIABLE MODIFY STRING Option="\x11" Destination="%FileContentOut%" Filename="c:\\OutFile.txt" CRLF="FALSE"/>
    

  5. You can use Macro Express to read the URL from the address field in the browser. Something like this should work:

    Text Type: <ALTD>d<ALTU>  // move to the address field in the browser
    Delay 0.1 Seconds  // wait a moment to let the browser catch up
    Text Type: <CTRLD>c<CTRLU>  // copy URL to the clipboard

  6. how do i use the File command: Files/Folders >Copy File or Files with a variable such as (%T1%) in the file(s) Path Name.

    Anywhere you can type something, like the Copy File or Files command dialog, you can include variables. This should get you started:

    // Get the Windows directory
    Variable Set String %T10% from Environment Variable
    
    Text File Begin Process: "input.txt"
     // Copy first 4 characters of filename
     Variable Modify String: Copy Part of %T1% to %T2%
     Copy File or Files: "%T1%"
    Text File End Process

    The macro is attached.

    Sample CopyFilesUsingVariable.mex

  7. If the range of the IP address differs between locations you could use the Get IP Address command to get the IP address and check its range. An IP address consists of 4 numbers separated by a period. Each number can range from 0 to 255. One location may, for example, assign 192.168.0.xxx while another could assign 192.168.154.xxx. You could ask the network administrator or you could write a macro to display your IP address and keep track of the ones you are assigned. After a while you may detect a pattern.

     

    Are there any unique resources such as servers available at one or the other location? You could have a macro attempt to map to a server and determine which network you are on that way.

  8. You can calculate both the number of files and the total size like this:

    Variable Set String %FolderPath% to "e:\Download Files"
    Variable Set Integer %SizeOfFiles% to 0 // SizeOfFiles is a Large Integer variable
    Variable Set Integer %FileCount% to 0
    
    Repeat with Folder %FolderPath%
     Variable Modify Integer %FileCount%: Increment
     Variable Set From File: Set to the Size of a File (%AFile%) // AFile is a Large Integer variable
     Variable Modify Integer: %SizeOfFiles% = %SizeOfFiles% + %FileSize%
    End Repeat
    
    Text Box Display: Results: Size of Folder and Number of Files
    

    A sample macro file is attached.

    Sample Size of Foler and Number of Files.mex

  9. The ASCII (numeric) value for a CR is 13. The ASCII value for a LF is 10. This snippet will allow you to search for the position of CRLF in a string:

    Variable Set %T13% to ASCII Char of 13
    Variable Set %T10% to ASCII Char of 10
    Variable Set Integer %N1% from Position of Text in Variable %T1%

    Put '%T13%%T10% in the 'Search Text:' field of the 'Variable Set Integer from position of Text' command

  10. If you use the Log Errors command, errors are logged and the macro continues. You may want to have the macro get information from the file containing the log to determine that it failed and what happened. The macro could then proceed accordingly.

     

    In Macro Express Pro you can set the action to perform when an error occurs for each macro command allowing the macro to handle different types of errors. If you own a Macro Express 3 license you may purchase Macro Express Pro at a discount. Read our Upgrade Policy for details.

  11. What version of Macro Express are you using? Macro Express v 3.7d was the first version certified to work on Windows 7. We recommend you download and install the latest version. As I write this the latest version is Macro Express v 3.8a.

     

    Next, make sure that the 'Use Text Type delay' found in Options, Preferences, Delays, is enabled and set to a minimum of 300 microseconds. If you continue to have trouble, try setting this to 1000 microseconds.

     

    Finally, under Windows 7 programs can be Run As Administrator. A program that is not running as administrator cannot send mouse clicks or keystrokes to a program that is. In general, most programs, including Macro Express, should not be set to Run As Administrator on Windows 7. But, if you are trying to use macros on a program that is, you will need to run Macro Express As Administrator. Note that Windows 7 complains when loading Macro Express when Windows starts if it is set to run as Administrator.

  12. Paul, on the Report a Bug web page it says:

     

    You will not receive a personal email response unless we need more information.

    On the Reporting Bugs and Requesting Features topic, pinned above, it indicates that issues entered into our tracking system via the Report a Bug and Request a Feature web pages are reviewed by developers, not customer support people. If you want a personal reply about an issue, you should contact Customer Support.

     

    Each bug report and feature request is analyzed to determine their priority. Changes are made according to priority. Just because you have not heard from us about a specific issue does not mean we are not working on it. If you need to know the status of an issue, just ask us.

     

    Are any of the issues you are interested in included in the many changes released last week?

×
×
  • Create New...