OutlookExpress邮件客户端的自动化配置

来源:计算机等级考试    发布时间:2012-08-29    计算机等级考试视频    评论

  在部署一个政府OA系统中的邮件模块时,由于用户全都是五六十岁的老人,邮件客户端统一采用Outlook Express,甲方项目经理要求邮件客户端的配置实现全自动化,非常头疼,好不容易才解决,来此与大家分享。
  输入分析:
  要配置邮件客户端,以下几个输入是必须由用户来完成的:
  1.用户名,即PREFIX,@之前的内容
  2.域
  3.输入密码
  存储分析:
  用户输入数据的存储位置如下:
  1.用户名——存于注册表(明文)
  2.域——存于注册表(明文)
  3.输入密码——存于注册表(密文)
  技术选取:
  有了以上两步需求,接下来就开始技术选择。由于必须访问注册表,所以排除所有的web技术,ActiveX成本较高,也排除
  .NET Winform应用程序配置麻烦,排除
  VB/VC应用程序配置较简单,但不如VBScript轻量
  VBScript可以通过shell object来访问注册表
  VBScript可双击直接运行,无需特别定制界面
  综上分析,故选用VBScript来进行配置。
  代码:
  代码如下,参照了华盛顿市府的配置解决方案:
  setoShell=wscript.CreateObject("Wscript.Shell")
  Functionmain()
  dimusername,domain
  username=inputbox("EnteryourEmailPREFIXorUSERNAME(BEFOREthe@signbutNOTincludingthe@sign)","OutlookExpressProfileCreator","Username")
  Ifusername=""Then
  wscript.Quit(0)
  EndIf
  Ifusername="Username"Then
  whileusername="EnteryourEmailPREFIXorUSERNAME"
  username=inputbox("EnteryourEmailPREFIXorusername(beforethe@sign)","OutlookExpressProfileCreator","Username")
  Ifusername=""Then
  wscript.Quit(0)
  EndIf
  wend
  EndIf
  domain=inputbox("EnteryourDomain(AFTERthe@signbutNOTincludingthe@sign)","OutlookExpressProfileCreator","Domain")
  Ifdomain=""Then
  wscript.Quit(0)
  EndIf
  Ifdomain="Domain"Then
  whiledomain="EnterYourDomainnameHere"
  username=inputbox("EnteryourDomainname(AFTERthe@signbutNOTincludingthe@sign)","OutlookExpressProfileCreator","Domain")
  Ifdomain=""Then
  wscript.Quit(0)
  EndIf
  wend
  EndIf
  ’  username=Ltrim(fixme(username))
  ’  domain=fixme2(domain)
  ’EXAMPLESTRINGFORRTRIM
  ’  RTrim(string)
  callplaceMailSettings(username,domain)
  msgbox("OutlookExpressConfigurationComplete,pleasestartOutlookExpressandenteryourpasswordwhenprompted.")
  EndFunction
  FunctionregRead(regStr)
  regRead=oShell.RegRead(regStr)
  EndFunction
  FunctionregWrite(val1,val2,val3)
  oShell.RegWriteval1,val2,val3
  EndFunction
  FunctionregDelete(regStr)
  calloShell.RegDelete(regStr)
  EndFunction
  ’Functionfixme(strValue)
  ’  dimuserEntry
  ’  userEntry=split(strValue,"@")
  ’  fixme=userEntry(0)
  ’EndFunction
  ’Functionfixme2(strValue2)
  ’  dimuserEntryd
  ’  userEntryd=split(strValue2,"@")
  ’  fixme2=userEntryd(0)
  ’EndFunction
  ’EXAMPLESTRINGFORSPLIT
  ’  Split(expression[,delimiter])
  ’PlacenewsettingsforMail
  FunctionplaceMailSettings(theUsername,theDomain)
  OnErrorResumeNext
  dimnewAccountNum,numKeyStr
  dimusername,domain
  newAccountNum=regRead("HKCUSoftwareMicrosoftInternetAccountManagerAccountName")
  IfnewAccountNum=""Then
  newAccountNum="00000001"
  ElseIfnewAccountNum<9Then
  newAccountNum="0000000"&newAccountNum
  Else
  newAccountNum="000000"&newAccountNum
  EndIf

上一页1234下一页

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答