Hi,
I would like to generate a list of random codes (actually, I will replace 6 digits picture file name) with an Applescript app.
I’m looking at 6 digits with letters (first) and numbers (last) with a thousand results (1000 results)
Something like ABH561 or GHQ816 or KNE801
The result would be an open text file.
Any chance this could be easy to create ?
Many thanks !!
Hugo
AppleScript: 2,2
Browser: Safari 525.20
Operating System: Mac OS X (10.5)
I’m unclear -
Do you want it randomized or from a preset list of 1000?
and out of curiousity, and as a photographer myself, why would you want it to be random?
Hi hsaphoto,
How about this code?
set randomfilenames to {}
set alphabet to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
repeat
set charone to some item of alphabet
set chartwo to some item of alphabet
set charthree to some item of alphabet
set num to random number from 100 to 999
set randomfilename to (charone & chartwo & charthree & num) as Unicode text
if randomfilename is not in randomfilenames then
set randomfilenames to randomfilenames & randomfilename
end if
if length of randomfilenames is equal to 1000 then
exit repeat
end if
end repeat
return randomfilenames
Best regards from soccer-crazy Germany