Jump to content
Macro Express Forums

kevin

Admin
  • Posts

    1,950
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by kevin

  1. Daviejr:

     

    An .INI or initialization file (pronounced either 'eye-en-eye' or 'inny') is generally used to store configuration information for Windows or a program that runs on Windows. Once widely used, many programs now use the Windows Registry instead of an .INI file. It is likely that you will find many .INI files in the Windows folder on your computer.

     

    An .INI file can be used to read information from an existing .INI file but it is also a convenient way to save and retrieve macro variables. The "Variable Modify String: Save %T1% to INI File" command saves a macro variable to an .INI file and the "Variable Set String %T2% from INI File" reads information from an .INI file and places it into a variable. To understand how to use these commands, you need to understand the structure of an .INI file.

     

    An .INI file contains one or more 'Sections'. Each section is given a name and is stored within square brackets, '[' and ']'. Under each section are 'keys' and 'values' separated by an equals sign, ('='). An .INI file may contain many sections but each section name must be unique. Likewise, a section in an .INI file can contain many keys but each key name within a section must be unique. However, keys with the same name can be placed in different sections in an .INI file.

     

    The .INI file syntax looks like this:

    [sectionName1]
    param1=string
    param2=string
    [sectionName2]
    param1=string
    param2=string

    Here is an example from an actual SYSTEM.INI file found in the Windows folder of a computer:

    [drivers]
    wave=mmdrv.dll
    timer=timer.drv
    [386enh]
    woafont=dosapp.FON
    EGA80WOA.FON=EGA80WOA.FON
    EGA40WOA.FON=EGA40WOA.FON
    CGA80WOA.FON=CGA80WOA.FON
    CGA40WOA.FON=CGA40WOA.FON

    This example contains two Sections, "drivers" and "386enh". The "drivers" section contains two Keys, "wave" and "timer". The Key "wave" has a Value of "mmdrv.dll".

     

    The "Variable Modify String: Save %T1% to INI File" and "Variable Set String T2% from INI File" commands require that you specify a filename, a Section Name, a Key Name and a string variable (T1 through T99). When you use the "Variable Modify String: Save %T1% to INI File" macro command, the content of the variable is written as the value of the specified Key. When you use the "Variable Set String %T2% from INI File" macro command, the value of the specified Key is read and placed into the specified variable.

  2. In testing this, I noticed that the Control variable contains the title of the window. If I click on the 'Display Control Info' button in the Get Control dialog, it says:

     

    Insight Software Solutions - All Products - Microsoft Internet Explorer - [iEFrame]

    msctls_statusbar32 - [index: 22]

     

    The "Insight Software Solutions - All Products - Microsoft Internet Explorer" part is from the Window Title. This means that you need a different control for each page.

     

    There are three techniques to accomplish this.

     

    1. Use a separate 'Get Control' command for each web page.

     

    2. Use a single Window Control but alter it as the macro runs using the 'Variable Set Control Text' command. Something like this might work:

    Variable Set String %T3% from Window Title
    Variable Set Control Text %C1% to "%T3% - [IEFrame]"

    Some experimentation may be necessary.

     

    3. If you know the position of a Window Control you can use the 'Capture Control' command. This command is designed to set a control variable as a macro runs instead of when you are writing the macro.

     

    You can calculate the position of the status bar on a window using the 'Variable Set Integer from Top of Window', 'Variable Set Integer from Left of Window', 'Variable Set Integer from Width of Window', and 'Variable Set Integer from Height of Window' commands.

     

     

    If I were writing this macro, I would lean toward technique #3.

  3. Gerry,

     

    Use the "Net Use" command at a Command Prompt (or MSDOS prompt):

     

    Syntax:

    Net Use [devicename | *] [\\computername\sharename[\volume] [password | *]

    [[/DELETE] | [/PERSISTENT:{YES | NO}]]

     

    To map a drive letter with a non-persistent connection:

    Net use v: \\Insight-server\c

     

    To map a drive letter with a persistent connection:

    Net use v: \\Insight-server\c /persistent:yes

     

    To disconnect a drive

    Net use v: /Delete

     

    Command Help:

    To view help for the Net Use command type "Net Use ?" at a Command Prompt.

     

     

    Enter a Net Use command in either a command prompt or the Run dialog.

  4. Gerry,

     

    After a Google search I learned that the correct name of this option is "Use Simple File Sharing". For XP Home, this is the only option. For XP Pro, it is enabled by default. For a brief description of what 'Simple File Sharing' is and how to change it, visit this web page: http://compnetworking.about.com/cs/winxpne...ht/winxpsfs.htm

     

    Microsoft has this option off by default and where you change the option it is described like this: "Use Simple File Sharing (Recommended)"

     

    In spite of Microsoft's recommendation, I have read several articles that say Simple File Sharing should be disabled. You say

    I just share drives and printing and since it's only me, I have no logins or passwords...
    The authors of the above mentioned articles would probably point out that, since you connect to the Internet, you share your computer with every other person on the Internet and thus should turn off Simple File Sharing.

     

    At this time I do not know why you cannot just select the 'Use Default Name and Password' option to make a connection on a network with Simple File Sharing enabled. We will research the issue.

  5. Icebox,

     

    There are some dialogs that 'freeze' macros. Our research indicates that when certain dialogs are active, Windows is not letting Macro Express run. I also suggest trying the "If File Ready", "If File Not Ready" or the "Wait File Ready" commands.

  6. I am using Windows XP Pro with simple networking disabled. Some of the Network Connect commands in the example macro have 'Make Connection Permanent' checked while others do not. One thing that I had to do was to enter my login name and password. When I left 'Use Default Name and Password' checked, the connections failed.

     

    Once I tested the macro and made sure it was working I unchecked 'Display Connection Status' in all the Network Disconnect and Network Connect commands.

     

    You probably don't care if the Network Disconnect fails because the most likely cause of failure is that the drive wasn't mapped in the first place. So, if it fails it doesn't matter, and if it doesn't fail, then the drive is removed. Either way, the drive mapping is gone.

  7. Gerry,

     

    If I am not sure whether or not a drive letter is already mapped, I do a Network Disconnect and then a Network Connect. By the way, I also use this technique when using batch files to make network connections.

     

    It seems the checkbox that says "list currently mapped drives" doesn't do anything, just gives you a display while filling in the box.
    Yes, this is information only. It just shows which drive letters have already been mapped.

     

    Should I check "make connection permanent" and go to Wndows Explorer and disconnect all mapped drives and let macro express connect them at startup
    Macro Express tells Windows to map the drives on startup. Whether you use Windows Explorer or Macro Express to map a permanent drive, the result is the same.

     

    should I use the network Connection command to first disconnect all mapped network drives and then issue a command to connect them?
    That is what I would do. You can disconnect any drive, even those that have previously been mapped with "make connection permanent".

     

    The macro would look something like this:

    Network Disconnect: M:
    Network Connect: M: to \\server-xyz\htdocs
    Network Disconnect: N:
    Network Connect: N: to \\server-xyz\In
    Network Disconnect: O:
    Network Connect: O: to \\server-xyz\inout
    Network Disconnect: P:
    Network Connect: P: to \\server-xyz\private

  8. Macro Express does not support Unicode. However, some people have used Macro Express with Asian languages by copying the text and pasting into the Text Type command. We do not know under what circumstances this works or does not work.

  9. Yes, it is common to use the registry instead of a file to hold information. Many of the macros I write do this and, I understand that the PGM Functions Library from Professional Grade Macros uses the registry extensively.

     

    Several of my macros look for a value in the registry. If it isn't there we know the macro has not been used previously and the macro asks for specific information like the user name and preferences.

  10. That does not work because the Macro Express Player also has a window named 'Macro Express'. The statement:

    If Window Title "Macro Express" is running

    will always be true.

     

    You have two choices. Change the window title to "Macro Express -":

    If Window Title "Macro Express -" is running
     Activate Window: "Macro Express -"
    Else
     Macro Run:  Run Macro Express Editor
    End If

    Note that you need to activate the window "Macro Express -". Otherwise you may be activating the player's window which will seem to do nothing.

     

    Or, replace everything with this:

    Macro Run: Run Macro Express Editor

    On my system the 'Activate Window' is unnecessary.

  11. Yes, I should have said 'Variable Set from Misc'.

     

    Macro Express does not have a direct way to determine if the logged on user has administrative rights. However, knowing which user logon names have administrativer rights you can do something like this:

    Set Variable %T1% to "Username"
    If Variable %T1% = "Aministrator"
     OR
    If Variable %T1% = "Greg"
     //  <Do your Admin stuff here>
    Else
     //  <Do your non-admin stuff here>
    End If

    You have your macro determine if the currently logged on user has administrative rights by attempting to write to a 'protected' area of the registry. If the write is successful, then the user does have admin rights. For example, you may try to write to:

     

    HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express\TestValue

  12. Normally Windows does not accept keystrokes and mouse clicks in anything but the active window. But, you can write a macro using Window Controls that send keystrokes and mouse clicks to a specific Control. This may even work on a application that is minimized or hidden.

     

    There are limitations, however. A control can be a button, an input field or a form. The application you are automating, not Macro Express, determines what is and what is not a control. How the application is written also determines whether or not a control will accept mouse clicks or keystrokes. It is also up to the application whether or not it responds when the application is minimized or hidden.

     

    There is a tutorial in the Macro Express help that discusses Window Controls.

  13. You have to select the Alt key release it and than select the V key in order to make it work.

    Some programs respond to alt sequences in unusual ways. But, because of the flexibility of Macro Express, I can think of several approaches that should work.

     

    Hold the ALT key down, delay for a moment, and then let the ALT key up.

    Activate Window: "ProCD PhoneBooks - Great Lakes+North Central"
    Text Type: <ALTD>
    Delay 20 Milliseconds
    Text Type: <ALTU>
    Delay 20 Milliseconds
    Text Type: v

    This macro does the ALT key down and up using specific commands.

    Activate Window: "ProCD PhoneBooks - Great Lakes+North Central"
    Alt Key Down
     Delay 20 Milliseconds
    Alt Key Up
    Delay 20 Milliseconds
    Text Type: v

    But this last example is the simplest. It uses the 'double alt' technique discussed in the routine that captures macros.

    Activate Window: "ProCD PhoneBooks - Great Lakes+North Central"
    Text Type: <ALT><ALT>v

  14. You said:

    You have to select the Alt key release it and than select the V key in order to make it work.

    This macro would do that for you.

    Activate Window: "ProCD PhoneBooks - Great Lakes+North Central"
    Text Type: <ALTD>
    Delay 20 Milliseconds
    Text Type: <ALTU>
    Delay 20 Milliseconds
    Text Type: v

  15. On some systems Windows is not ready to allow macros to run as soon as Macro Express is loaded. Try the option to delay loading Macro Express found in Options | preferences | Startup. Make sure the checkbox on the line under "Run on Windows' Startup" that says:

    [ ] Wait for [ ] seconds

     

    is checked and enter some number of seconds. I would try a high value at first like 45 seconds. If it works, reduce the number of seconds down until you reach a more acceptable value.

  16. Dave,

     

    You cannot remove or disable the close button on the floating menu. However, have you thought about creating a macro that runs when Macro Express loads and have that macro enable the floating menu?

     

    To do this:

    1. Create a Scheduled Macro

    2. For the schedule, choose either 'At Startup' or 'Load File'

    3. In the macro put a 'Macro Enable: floating menu' command (substitute 'floating menu' with the name of your floating menu macro)

     

    The 'At Startup' option will run the macro when Macro Express first runs. If Macro Express is automatically loaded when Windows is loaded (see Options, Preferences, Startup, Run on Windows Startup), then the macro will run when Windows is loaded.

     

    The 'Load File' option will run the macro whenever the macro file containing the macro is loaded into Macro Express. If you only use one macro file then the schedule option 'Load File' will work the same way as the 'At Startup' option. However, if you use multiple macro files, then this option will cause the 'enable floating menu' macro to run each time the macro file is loaded.

  17. Hi Greg,

     

    One thing you can do is customize macros for each login. Use the 'Variable Get from Misc' command and choose 'User Name'. I have a macro that does an online lookup of school grades. Each person who logs in can quickly see their own grades and Mom or Dad get a menu to choose which one to view. Another similar macro uses our library's online system to find out what books are checked out, when they are due, and any fines owing.

     

    These are simple but useful things.

  18. Markter,

     

    You can use either the Switch/Case set of commands or the If Variable/Else set of commands. Using Switch/Case took 37 lines of macro commands (excluding comments). Using If Variable/Else took 46 lines of macro commands.

     

    These examples depend on the variable for months 1 through 9 containing a leading '0' (eg: 01 - 09). If the value does not contain a leading 0 then you will need to adjust the macro commands.

     

    The Switch/Case technique looks like this:

    Switch (T1)
     Case: 01
       Variable Set String %T2% "Jan"
     End Case
     Case: 02
       Variable Set String %T2% "Feb"
     End Case
     Case: 03
       Variable Set String %T2% "Mar"
     End Case
     Case: 04
       Variable Set String %T2% "Apr"
     End Case
     Case: 05
       Variable Set String %T2% "May"
     End Case
     Case: 06
       Variable Set String %T2% "Jun"
     End Case
     Case: 07
       Variable Set String %T2% "Jul"
     End Case
     Case: 08
       Variable Set String %T2% "Aug"
     End Case
     Case: 09
       Variable Set String %T2% "Sep"
     End Case
     Case: 10
       Variable Set String %T2% "Oct"
     End Case
     Case: 11
       Variable Set String %T2% "Nov"
     End Case
     Case: 12
       Variable Set String %T2% "Dec"
     End Case
    End Switch

    The If Variable/Else technique looks like this:

    // Same macro using If statements
    
    If Variable %T1% = "01"
     Variable Set String %T2% "Jan"
    Else
     If Variable %T1% = "02"
       Variable Set String %T2% "Feb"
     Else
       If Variable %T1% = "03"
         Variable Set String %T2% "Mar"
       Else
         If Variable %T1% = "04"
           Variable Set String %T2% "Apr"
         Else
           If Variable %T1% = "05"
             Variable Set String %T2% "May"
           Else
             If Variable %T1% = "06"
               Variable Set String %T2% "Jun"
             Else
               If Variable %T1% = "07"
                 Variable Set String %T2% "Jul"
               Else
                 If Variable %T1% = "08"
                   Variable Set String %T2% "Aug"
                 Else
                   If Variable %T1% = "09"
                     Variable Set String %T2% "Sep"
                   Else
                     If Variable %T1% = "10"
                       Variable Set String %T2% "Oct"
                     Else
                       If Variable %T1% = "11"
                         Variable Set String %T2% "Nov"
                       Else
                         If Variable %T1% = "12"
                           Variable Set String %T2% "Dec"
                         End If
                       End If
                     End If
                   End If
                 End If
               End If
             End If
           End If
         End If
       End If
     End If
    End If

  19. Another technique that I have used is to store personalized information in the registry. I have a macro that reads values from the registry. If the values do not exist, a macro is launched to collect the information. This way, the first time, and only the first time, they run the macro, it asks them for personalized information (name, login name, password, etc.).

     

    You could also add an option to run the macro that collects the personalized information at any time. This would allow the user to change their information as needed.

     

    The one weakness to this technique is that the password stored in the registry is not encrypted.

     

    You could, however, combine this technique with the one described by Icebox. The password could be set using the 'Encrypted Text' command at the top of the macro. The macro could determine if the password has been changed and prompt the user to change it. Other non-sensitive information could be stored in the registry.

     

    Another thing you might want to try is to use the Windows log-in name. This can be read using the Variable Set from Miscellaneous command.

  20. Macro Express v 3.5c has been released. Changes include:

    • Added the ability in the Sound Wave macro command to play sounds assigned to system events.
    • Added the keypad decimal key as a hotkey.
    • The macro is now aborted when an FTP command times out.
    • A macro can now be aborted during an FTP file transfer.
    • Improved the Get File Version command so that it handles different code pages better.
    • Added 'No Path FTP Get' advanced option to prevent the path from being prepended during an FTP Get command.
    • Now includes an updated and improved library of sample macros (samples.mex) that demonstrate macro techniques.

    Download it here http://www.macros.com/download.htm. View a complete list of changes here http://www.macros.com/rev3_5c.htm.

×
×
  • Create New...