March 16, 200916 yr 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
March 16, 200916 yr 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 March 16, 200916 yr by Guest added the script
March 16, 200916 yr 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