Jump to content
Macro Express Forums

Editing Text Variables


Brain Virus

Recommended Posts

I use my macro express to manipulate a program that generates random passwords and saves it to a variable. I would like to be able to edit that variable through macro express so it contains the requirements that our system uses.

 

For example say it pulls the password of F9/vL30=

 

I want to replace the /,L,0,and = with somthing else.

 

I dont want characters like (@#%$, or Ll,Ii,Oo and 0 in the password. Also The password needs to have one upper case letter and one lower case letter and one number at minimun

 

Or better yet, is it possible to write a password generator that will generate a password with those requirement with macro express?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

You can generate each random letter into a variable, for example into T1 with the Variable Set String option. Then have a series of IF commands to check whether T1 equals any of the forbidden characters. If it does, generate another character to replace it.

REPEAT START

VARIABLE SET STRING T1 WITH RANDOM CHARACTER

IF T1 NOT EQUAL "/"

AND

IF T1 NOT EQUAL "&"

AND etc. etc. etc.

REPEAT EXIT

END IF

REPEAT

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Once you've created your password, check for each illegal combination.

IF VARIABLE CONTAINS command can be used to check for strings within the variable, as well as for single characters within the variable.

 

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

Or, just throw out the whole password and start fresh when you find an illegal character or string within the password. It may take a few microseconds longer to generate passwords, but it's probably simpler to write the macro.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...