Jump to content

Crear diccionario con RUTs


Recommended Posts

Public Const cHideWindow = 0, cNormalWindow = 1
Set WSHShell = Wscript.CreateObject("WScript.Shell")       
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject") 
Set EnvVar = wshShell.Environment("Process")
tBestand= ".\RUTs.txt"
Set Bestand = fso.createtextfile(tBestand,1)
Dim iRUT, iTotal, iResto, iResta, s
For x=5000000 To 19000000 Step 1
	s = Trim(x)
	i=Len(s)
	ii = 2
	iTotal = 0
	Do Until i=0
		iTotal = iTotal + Mid(s, i, 1) * ii
		iResto = iTotal Mod 11
		iResta = 11 - iResto
		If iResta>=1 & iResta <=9 Then iVerificador = iResta
		If iResta= 11 Then iVerificador = "0"
		If iResta= 10 Then iVerificador = "k"
		i = i - 1
		ii = ii + 1
		If ii=8 Then ii=2
	Loop
	Bestand.WriteLine(Right(x & "-" & iVerificador,10))
Next
Bestand.close
WScript.quit

Rut_generator.vbs

Desde x=5000000 To 19000000

Saludos

Edited by Germini
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...