Jump to content
Macro Express Forums

paul

Members
  • Posts

    1,049
  • Joined

  • Last visited

Posts posted by paul

  1. Each variable is cleared when a macro runs. The only exception to this is if one macro calls another via the Macro Run command. In that case all variable values are passed to the called macro.

     

    AND "Wait for this macro to terminate before proceeding" is ticked.

  2. Here's some sample code that does what you want. After the split has been done, it loops backwards through the text array, e.g. T, to find the first %T[n]% variable with a length > 0. Why backwards? If your string were

    "This is"

    ""

    "an awesome"

    "sample text"

    then looping forward would stop after the first line.

    Variable Set to ASCII Char 13 to %tCr%
    Variable Set to ASCII Char 10 to %tLf%
    Variable Set String %tCrLf% to "%tCr%%tLf%"
    Variable Set String %tString% to "This is
    an awesome
    sample text"
    Split String "%tString%" on "%tCrLf%" into %T%, starting at 1
    Repeat Start (Repeat 99 times)
     Variable Set Integer %iLen% to the length of variable %t[%iCounter%]%
     If Variable %iLen% Is Greater Than "0"
    Repeat Exit
     End If
    End Repeat
    Text Box Display:

    <VARIABLE SET TO ASCII CHAR Value="13" Destination="%tCr%"/>
    <VARIABLE SET TO ASCII CHAR Value="10" Destination="%tLf%"/>
    <VARIABLE SET STRING Option="\x00" Destination="%tCrLf%" Value="%tCr%%tLf%"/>
    <VARIABLE SET STRING Option="\x00" Destination="%tString%" Value="This is\r\n\r\nan awesome\r\nsample text"/>
    <SPLIT STRING Source="%tString%" SplitChar="%tCrLf%" Dest="%T%" Index="1"/>
    <REPEAT START Start="99" Step="-1" Count="99" Save="TRUE" Variable="%iCounter%"/>
    <VARIABLE SET INTEGER Option="\x0D" Destination="%iLen%" Text_Variable="%t[%iCounter%]%"/>
    <IF VARIABLE Variable="%iLen%" Condition="\x03" Value="0" IgnoreCase="FALSE"/>
    <REPEAT EXIT/>
    <END IF/>
    <END REPEAT/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang3081\\f0\\fs16 Number of variables used is %iCounter%\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

  3. In this case however why don't you simply not use the command line pass and just store the values in the reg and have the first couple of lines in the macro read those values in?

    If my macro uses the Variable Restore command or the alternative approach I described earlier, then the macro doesn't need to "know" anything specific. In other words, it performs a process (Variable Restore or the read of that generic C:\MacrosPro\MacroParameters.txt file); and the logic of the process remains static across all macros. Whether the process causes variables to become initialized with specific values is determined by the calling process, i.e. whether any values have been passed in with the /VT parameters, or if the C:\MacrosPro\MacroParameters.txt file exists - nothing more.

     

    Forcing a macro to know how many parameters to read and where from introduces dependencies where none existed before. I prefer my macros to be as robustly independent as possible.

  4. I found where the problem lies.

     

    My original code was:

     

    Variable Restore: Restore Text Variables

    Variable Set String: Prompt for value

     

    When I move Variable Set String above the Variable Restore, the problem disappears. Evidently the Variable Restore has some long delay.

     

    Unfortunately I need the Variable Restore before the Variable Set String for the macro to perform correctly.

    Yes,the Variable Restore command is indeed a disaster in the current version of MEP. I described this in a message last week and put forward an alternative method of saving and restoring variables.

  5. When running a macro with MeProc.exe, parameters must be passed using the /A and /V arguments, as in:

    "C:\Program Files\Macro Express Pro\MeProc.exe", /AMyMacro /VT99:abc /VT98:def

    The macro MyMacro must, in this case, do a Restore Text Variables in order to set %t[98]% to "def" and %t[99]% to "abc".

     

    Unfortunately the Restore Text Variables command in the latest release of MEP is very slow, at least on my machine. It has always operated more or less instantaneously, but now takes 4 seconds!

     

    I have therefore decided to adopt a new approach (I have never much liked the Restore Variable commands anyway because of how they affect other unrelated macros - unless you go to the trouble of clearing all text variables and then saving them).

     

    For those macros that require parameters I shall store one text file for each macro (using the macro name as part of the text file name):

    nn,tt

    where nn is the index number of the %t% array into which I store the value tt.

     

    First I copy the relevant macro text file to "C:\MacrosPro\MacroParameters.txt", then:

    If File Exists: "C:\MacrosPro\MacroParameters.txt"
      ASCII File Begin Process: "C:\MacrosPro\MacroParameters.txt" (Comma Delimited Text (.csv))  -- into array %tContents%
     Variable Set String %t[%tContents[1]%]% to "%tContents[2]%"
      ASCII File End Process
      Delete File/Files: "C:\MacrosPro\MacroParameters.txt"
    End If

     

    This works very well, requires no Restore or Save commands , and leaves no side-effects.

  6. I scanned the changes in the latest release, hoping to find that my mouse would now work in ME's Explorer window. I found no mention of a fix, but when I tried it my mouse now scrolls properly. Wonderful! Until you have experienced a non-scrolling mouse, you can have no idea how awkward the ME interface is to navigate. Thank you.

     

    And I really like the new debug floating window (which you can activate with F5).

  7. i still need to make sure it doesnt contain Ii,Ll or 0Oo

    can you help with that?

    Once you've created your password, check for each illegal combination. When you find one then:

    - generate a random number between 1 and the length of the illegal string into N1

    - generate a new random character into T1 (make sure it's different to the character in position N1 of the illegal string)

    - replace the N1th character of the illegal string with your new character - the string will then no longer be illegal

     

    Keep checking for illegal combinations (and replacing as per the above method) until there are none left.

  8. It wouldn't be difficult to write such a password generator in ME.

     

    You'd need to specify how long, or between what lengths, you want the password to be.

     

    Using the function to generate a random integer number between 2 values, I would:

    - generate a random number N1

    - generate a random number N2

    - generate a random number N3

    - generate a random number N4

    - generate N1 random upper case letters into T1

    - generate N2 random lower case letters into T2

    - generate N3 random single-digit numbers into T3

    - merge T1, T2 and T3 in some random way into T4

    - create and display (or copy to the clipboard) a password of N4 characters by creating a string from T4 using a new random number in each pass until I'd got enough characters

  9. Thank you Cory for your help. However, I do not know what I am supposed to do with that text you gave me =) I am completely new at this and that looks REALLY confusing... lol. Could you tell me exactly what I am supposed to do. Again, thank you so much for your help. The makers of Macro Express Pro should be paying you =)

    No, actually, you should!

  10. I want to create a script or macro that will

    1. open a particular document/application.

    2. Capture a series of keystrokes or captured mouse movement.

    3. Kill/stop the process/service that is running the document in step 1.

    My problem is that this has to run whilst the machine is unattended. Preferably logged off.

    I don't understand your point 2 above when taken in conjunction with your last sentence! How do you get a sequence of keystrokes or mouse movements if the machine is unattended or logged off. Are we writing a macro for ghosts here?

  11. Shutdown

     

    Schdule this macro:

    Write Registry Value "%T[1]%" into 
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
    -- T1 contains 1
    
    Write Registry Value "%T[99]%" into 
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword
    -- T99 contains your login password
    
    Program Launch: "shutdown.exe" (Normal)
    Parameters: -s reboot -f -l 1

     

    Once rebooted, schedule this macro to run on startup:

    Write Registry Value "%T[1]%" into 
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
    -- T1 contains 0
    
    Delete Registry Value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword

  12. The error message you're seeing implies to me some sort of network lock rather than a password problem. Do you have the network sharing settings disabled?

     

    It's possible that Insight have changed this capability, but when I used ME3 I regularly deleted macros using code, even when the macro was password-protected, and I never knew any passwords because I generated the passwords via code from randomly-generated strings.

  13. But what you can do is this:

    - Schedule a macro to allow Windows to boot without requiring a password

    this requires that you download a small free utility, and have your macro change 2 registry settings, run this utility and reboot

     

    - Schedule a startup macro to change the 2 registry settings above back to what they were

    this means that your computer is unprotected for only as long as it takes your computer to reboot

     

    - Run the macro you refer to in your message as the final step in your startup macro

    This macro is triggered only when the 2 registry settings were in the unprotected state

     

    - Lock your desktop when your macro is finished

     

    I have used this scenario for several years with great success.

×
×
  • Create New...