fhios
asked on
AutoIT & Lotusscript
Hi All
I am trying to register a Lotus Notes user from an AutoIt script using the COM object, so far I have achived little success. The AutoIT script enclosed will go through the registration process and create the users ID file but will not add any entry to the Address book as you would expect.
I have tested the same script using VBScript and this works perfectly well from the command line but I would prefer to only use lotus script and not to shell out from AutoIT.
Please see the code enclosed, any help would be greatly appreciated as I am pulling my hair out at this stage
<AutoIT>
$Session = ObjCreate("Lotus.NotesSess ion")
if not IsObj($Session) then
Msgbox(0,"Status","Couldn' t attach to Lotus.")
else
Msgbox(0,"Status","Attache d to Lotus.")
endif
$Session.Initialize()
$Reg = $Session.CreateRegistratio n()
$Reg.RegistrationServer = "serverA"
$Reg.CertifierIDFile = "c:\cert.id"
$Reg.Mailinternetaddress = "Roger.Whooly@company.com"
$Reg.IDType =172
;$Reg.OrgUnit = "Unit"
$Reg.Expiration = 01/01/2099
$Reg.MinPasswordLength = 6
$Reg.RegistrationLog = "log.nsf"
$Reg.CreateMailDb = True
$Reg.IsNorthAmerican = True
$Reg.UpdateAddressBook = True
$Reg.StoreIDInAddressBook = True
$Reg.CreateMailDB = True
$User=$Reg.RegisterNewUser ("Whooly", "c:\user2.id", "CN=serverA/O=Unit","Roger ","","cert _password" ,"","","ma il\rwhooly .nsf","", "user_password",175)
Exit
<VBScript>
Dim FirstName, FamilyName, Email, Expiry, MailDB
If Wscript.Arguments.Count = 2 Then
FirstName = Wscript.Arguments(0)
FamilyName = Wscript.Arguments(1)
Email = Firstname & "." & FamilyName & "@company.com"
Expiry = DateAdd("yyyy",1,Date)
MailDB = LCase("mail\" & Left(FirstName,1) & Familyname & ".nsf")
Else
MsgBox("Users full name missing.....Exiting!")
Wscript.Quit
End If
Set objLN = CreateObject( "Lotus.NotesSession" )
objLN.Initialize()
Set reg = objLN.CreateRegistration
reg.RegistrationServer = "serverA"
reg.CertifierIDFile = "c:\cert.id"
reg.MailInternetAddress = Email
reg.IDType = 172
reg.CreateMailDb = True
reg.UpdateAddressBook = True
reg.Expiration = Expiry
reg.MinPasswordLength = 6
reg.IsNorthAmerican = True
reg.StoreIDInAddressbook = False
reg.RegisterNewUser FamilyName,"c:\user.id","C N=serverA/ O=Unit",Fi rstName, "", "cert_password", "", "", MailDB, "", "user_password",175
Many thanks for you time.
TomC
I am trying to register a Lotus Notes user from an AutoIt script using the COM object, so far I have achived little success. The AutoIT script enclosed will go through the registration process and create the users ID file but will not add any entry to the Address book as you would expect.
I have tested the same script using VBScript and this works perfectly well from the command line but I would prefer to only use lotus script and not to shell out from AutoIT.
Please see the code enclosed, any help would be greatly appreciated as I am pulling my hair out at this stage
<AutoIT>
$Session = ObjCreate("Lotus.NotesSess
if not IsObj($Session) then
Msgbox(0,"Status","Couldn'
else
Msgbox(0,"Status","Attache
endif
$Session.Initialize()
$Reg = $Session.CreateRegistratio
$Reg.RegistrationServer = "serverA"
$Reg.CertifierIDFile = "c:\cert.id"
$Reg.Mailinternetaddress = "Roger.Whooly@company.com"
$Reg.IDType =172
;$Reg.OrgUnit = "Unit"
$Reg.Expiration = 01/01/2099
$Reg.MinPasswordLength = 6
$Reg.RegistrationLog = "log.nsf"
$Reg.CreateMailDb = True
$Reg.IsNorthAmerican = True
$Reg.UpdateAddressBook = True
$Reg.StoreIDInAddressBook = True
$Reg.CreateMailDB = True
$User=$Reg.RegisterNewUser
Exit
<VBScript>
Dim FirstName, FamilyName, Email, Expiry, MailDB
If Wscript.Arguments.Count = 2 Then
FirstName = Wscript.Arguments(0)
FamilyName = Wscript.Arguments(1)
Email = Firstname & "." & FamilyName & "@company.com"
Expiry = DateAdd("yyyy",1,Date)
MailDB = LCase("mail\" & Left(FirstName,1) & Familyname & ".nsf")
Else
MsgBox("Users full name missing.....Exiting!")
Wscript.Quit
End If
Set objLN = CreateObject( "Lotus.NotesSession" )
objLN.Initialize()
Set reg = objLN.CreateRegistration
reg.RegistrationServer = "serverA"
reg.CertifierIDFile = "c:\cert.id"
reg.MailInternetAddress = Email
reg.IDType = 172
reg.CreateMailDb = True
reg.UpdateAddressBook = True
reg.Expiration = Expiry
reg.MinPasswordLength = 6
reg.IsNorthAmerican = True
reg.StoreIDInAddressbook = False
reg.RegisterNewUser FamilyName,"c:\user.id","C
Many thanks for you time.
TomC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks Steve, couldnt see the wood for the trees.
Regards
Regards
So was that it then that worked, the difference between -1 and 1 representations of "true"?
I did start to have a look earlier but hadn't had a chance to try from autoit.
Steve
I did start to have a look earlier but hadn't had a chance to try from autoit.
Steve
ASKER
Yup that was it changed true to 1 and bingo all the values took. I hadnt thought of changing this value as syntactically it was accepted by Autoit and VBS also used it, again thanks.
Regards
Regards
No problem, would you mind then if I asked the mods to amend the grade... don't like "b" grades!
Steve, I'd never have guessed it could be True... ;-))
You can check this by adding something like
Print $Session.EffectiveUserName
or
Print ObjLN.EffectiveUserName
You then need to check in the Notes/Domino environment if the name printed has appropiate access. The Administrator Help topic Customizing user registration lists the required permissions:
Please make sure the ID associated with the printed name has these rights.