Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I generate a password with a user chosen length from a valuelist perhaps?

Featured Replies

After reading Comments' suggestion on generating random 10 character passwords, I realised that might be a bit constricting, say if you wanted to generate a password with a user chosen length perhaps?

Comments' original post for the script:

http://www.fmforums.com/forum/showtopic.php?tid/194847/

What I have is two fields in the table and one button.

fieldname: PasswordLength

is linked to a valuelist that gives numbers 6 to 26 in sequence [6,7,8,9,etc]

fieldname: SitePassword

is where I want the script to output to.

button: Generate

would run the mainstay of the script.

From what I presently have:

Middle("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Round(Random * 60; 0)+1; 1)

does the random generation for 1 character.

Could someone shed some light on how to do the script?

[i apologize for the following script in pidgin script inglish]

From what I know so far:

// set the storage areas for the script

Let a=number, b=textfield

// get the external variables

Get fieldname[PasswordLength] = a

// run the script while a is greater than zero

While a > 0

do Middle("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Round(Random * 60; 0)+1; 1)

// put the output into one of the stores

add result to b

// reduce the count of a by 1

a = a - 1

// does a equal 0? If yes, output to SitePassword

if a = 0 then

// output b to SitePassword

set fieldname[sitePassword] = b

//if not, loop back to top

else

loop

Now I know the above doesn't work as a script yet : - but that is roughly what I'm after.

The idea being that you can choose a password length of between 6 characters [er... kind of difficult to guess] and 26 characters [whoa! we're talking MI5 then! : ]

and then have that output to the second field - whereupon it gets wrapped up into the ftp linkname that I do through a formula/calculation.

Suggestions would be helpful. Or maybe someone can point me to an already covered topic that they have found on their travels?

Chris

To generate a random string of given length, you need either a looping script or a custom function. Either one is rather trivial; the script, for example, could be:

Loop

Exit Loop If [ Length ( $password ) ≥ Table::PasswordLength ]

Set Variable [ $password ; $password & Middle ( "0123...XYZ" ; Ceiling ( Random * 62 ) ; 1 )

End Loop

Set Field [ Table::Password ; $password ]

BTW, rounding the result of the Random function is not a good idea, because it skews the distribution away from uniform.

Edited by Guest
added the script

  • Author

blimey! :

works like a charm!

It must have taken you 4 mins to write and 6 mins to post! :

thanks very much!

Chris

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.