Jump to content
Macro Express Forums

kevin

Admin
  • Posts

    1,950
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by kevin

  1. Once you have the information in the clipboard you can get it into a variable in a macro. Once in a variable, you can manipulate it using the various macro commands. Then you can type either it into Excel or save it in a file to be imported into Excel later. This would save a significant amount of time.

     

    Pasting the information into Ultra Edit and then copying it again takes more time.

  2. The Scope setting of a macro affects the activation of that macro, not what happens once it is running. If a program comes up and a window specific macro starts, that macro will run to the end.

     

    You may have to deal with timing issues when the second window comes up. For example, use the Wait for Window command to make sure the other window is all the way loaded.

     

    Also, sometimes Windows loads another program window but does not give it focus. When this occurs you need to add special commands to your macro. I use the Window Activate command in those situations.

  3. I would try the Load Macro Text File command. Have your vbscript write to a text file. Create a macro that does not change and contains the Load Macro Text File command. Set it to run the macro in the text file created by your vbscript. The macro can be activated either via a hotkey or by calling meproc.exe with a /aTextMacro parameter.

     

    This would be much faster and more reliable than using the Direct Editor user interface.

  4. It may be that your macro has a syntax error that Macro Express misses but Macro Express Pro catches. The syntax checking has been improved in Macro Express Pro.

     

    I suggest that you copy the macro and then start deleting sections of the macro until the syntax error goes away. As you delete lines make a mental note of what is being removed.

     

    If you are not able to resolve the issue that way then send your macro to the Insight Software Solutions support people. If there is an error in the program, we would be very interested in correcting it.

  5. Use the macro command Read Registry Value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version" into %IE_Version% to read the version from the registry. Microsoft documentation here: Information about Internet Explorer versions.

     

    This sample macro displays the version number of Internet Explorer:

    Read Registry Value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version" into %IE_VersionStr%
    Split String "%IE_VersionStr%" on "." into %IE_Version%, starting at 1
    Text Box Display: IE Version

     

    To run this sample macro copy the following and paste it into a macro:

    <READ REGISTRY VALUE Key="HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Internet Explorer\\Version" Destination="%IE_VersionStr%"/>
    <SPLIT STRING Source="%IE_VersionStr%" SplitChar="." Dest="%IE_Version%" Index="1"/>
    <TEXT BOX DISPLAY Title="IE Version" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Full version string: \\f1 %IE_Version\\f0 Str\\f1 %\r\n\\par \r\n\\par \\f0 Major:      %IE_Version[1]%\r\n\\par Minor:       %IE_Version[2]%\r\n\\par Build:        %IE_Version[3]%\r\n\\par Sub-build: %IE_Version[4]%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="313" Height="181" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    

  6. Some ideas:

     

    Would it work to delete the existing files? Try the Delete File or Files command.

     

    How are you emptying the file? From your description it sounds like you may be writing a CR/LF when writing the empty string to the file. Look for an 'Add Trailing CR/LF' option and uncheck it.

     

    Sometimes I need to start with a file that is almost empty. For example, I may want a line containing a header but no data lines. In these cases I create an 'HeaderOnly' file and copy it over the files that need to be emptied.

  7. Microsoft offers a Windows 7 add-on that emulates Windows XP. This is a bit different than Virtual PC. The virtual software can be installed on Windows XP and later. It does not have to be a server. (VMWare also has a version that will run Windows on your Mac.)

     

    Yes, as long as the virtual machine is running, the macros continue to run. They stop if you log off of Windows but they continue to run if you disconnect.

  8. Just to be clear, when the RDC session is disconnected Macro Express continues to run but Windows, on the remote computer, decides that since there no keyboard and monitor connected it can ignore all keyboard and mouse input. The result is that the macro accomplishes nothing. (If your macro contains no keyboard or mouse activity and does not rely on things like window titles, it may continue to work.)

     

    Virtual machines work great. Another choice besides VMWare Player and Virtual PC would be is VirtualBox. I use VMWare extensively, have tried Virtual PC but I have not personally tried VirtualBox. All have free versions.

  9. The FTP commands built into Macro Express are FTP, not SFTP. You could use Macro Express to automate an external SFTP program.

     

    The message "Cannot establish FTP connection. Only one connection is allowed at a time." is coming from the host you are trying to connect to. Macro Express simply reports the message it receives from the remote host. Check the security settings on your host.

     

    Your host computer may be set to allow only one connection. When I had a similar message I discovered that a mapped drive counted as one connection and prevented a second connection via FTP. To resolve it the security settings on the host computer had to be changed to allow more than one connection.

  10. 1) Divide your number by 5, save this result (res1)

    2) Multiply res1 by 5, save this result (res2)

    3) If your number equals res2, your number is divisible by 5

     

    Same with odd/even numbers, using 2 as the divisor.

    This works if you are using Integer variables.

     

    Something like this might work if you want to use Decimal variables:

    Variable Modify Decimal: %D2% = %D1% / 5
    Variable Modify Decimal: Copy fraction part of %D2% to %D3%
    Variable Modify Decimal: %D4% = %D3% * 5
    Round Decimal Variable %D4% to 0 decimal places
    If Variable %D4% = 0
     // Divisible by 5
    Else
     // Not divisible by 5
    End If

  11. A child window may have a title even if it is not displayed. If you can determine the title of the child you can use the Window Resize command to resize it.

     

    There are two ways to determine the child window's title. The first, and easiest, is to open a Window Resize command, choose 'Specific Window' and click the 'Select Window' button. I would do this when the child window is not displayed and again when it is displayed and note the differences in the list of windows.

     

    In some rare cases a child window does not appear in that list but can be discovered using the Repeat with Window command. Try something like this:

    Activate or Launch: "Notepad" OR "notepad.exe"
    Repeat with Windows: Place title in %T1%
     If Not Window Title "Notepad" on top
       Activate Window: "Notepad"
     End If
     Text Type: %T1%<ENTER>
     Delay 0.05 Seconds
    Repeat End

     

    Macro Express does not have a way to resize a child window without a window title.

  12. What is defined as a Windows Control is dependent on the application itself. In addition to an entire window or dialog an individual edit box or button may be a control. Applications do not generally allow certain types of controls to be resized.

     

    You can automatically resize a window using the Window Resize command. I would recommend that you try to find a way to get the title of the dialog or window that is pointed to by your control variable.

  13. The 'fault' is most likely due to timing. When Macro Express interacts with the Windows clipboard and with other applications they, not Macro Express, determine how fast things happen. Macro Express could be changed to always wait long enough for all clipboard functions to be successful but then every clipboard command would take a full second.

     

    Check the 'Wait [ ] milliseconds between clipboard commands' setting found in Options, Preferences, Playback on the Delays tab. This allows you to adjust the amount of time that Macro Express waits between clipboard commands for your specific computer. In our testing we determined that a good compromise value for this was 250 milliseconds. This allowed macros to work 98% or more of the time.

     

    Try adjusting the value to a larger value.

     

    Another possible issue could be that the application is not able to accept the information as quickly as Macro Express is sending it. If, for example, the pasting of data causes the application to scroll, you will need an additional delay. You could try adding a delay after the Clipboard Paste command.

  14. <dataset
       fielda="xxxxxxxxxxxx"
       fieldb="xxxxxx"
       fieldc="xxxxxx"
       <value>example1</value>
     </dataset>
    

    Read the content of the file into a variable. Set one integer variable to the location of '<dataset'. Set another integer variable to the location of '</dataset>'. Then copy the data between. This untested sample should get you started:

     

    // Read content of file into a variable
    Variable Set String set %Content% to the contents of c:\TheFile.xml
    Variable Set Integer %Start% to the position of "<dataset" in %Content% // Find position of <dataset
    Variable Modify Integer: %Start% = %Start% + 8 // Adjust to skip over <dataset
    Variable Set Integer %End% to the position of "</dataset>" in %Content% // find position of </dataset>
    
    // Copy the data between the tags
    Variable Modify String: Copy a substring in %Content%, starting at %Start% and %End% characters long to %OneTag%
    

    After processing one tag you could delete it from the %Content% variable to get ready to process the next variable.

  15. Macro Express is constantly watching for windows and controls to come and go. If you have scheduled macros, it is checking every 10 seconds (by default but if I recall from another thread, you have set it to 1 second) to see if it is time to run another macro. It is watching for messages indicating that a file or folder has changed. Macro Express is never completely idle.

  16. There is not a single command to close all programs but you might have some options.

     

    You could try the Shutdown or Logoff commands and rely on Windows to close the programs.

     

    You might also use a Repeat with Windows and/or Repeat with Processes loop to close programs. If you use a Repeat command you would need to program in exceptions to only close programs or Windows that not part of Windows itself.

     

    Or you might create a macro that uses the If Window and/or If Program Name Running commands to determine if individual programs are running and close them.

     

    Since running programs may contain unsaved data, I expect the last option would be safest.

×
×
  • Create New...