#106602 - 2003-11-06 02:11 PM
Re: Outlook 2002
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Richard,
Couple of things -
We should be able to trim down those long lines.
Your code is a bit of a challenge to read.
Maybe it is time to go back a look at the FAQ again? I had worked with a guy on this and I think some of the settings that we are "hacking" in can be addressed with the PRF file.
Outlook/Exchange Configuration - KiX 3.63+ required
The version 4.x breaks this up pretty good into functions as well.
Notice it was updated in July. I did quite a bit of work with Anthony Harper then.
Taking your code, I did some clean up and added some comments to it (You may want to look at the FAQ again: Code Re-Write as it has some cleaned up code and uses more functions too):
code:
:outlook $company='CSIRO' ; Do you want users to delete all deleted items on Exit from Outlook? $deleteitems = 'Yes' ; Is it Winnt or 2K? IF @inwin=1 ; Windows NT Registry Locations $profilelocation='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\' ELSE ; Windows 9x Registry Locations $profilelocation='HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles\' ENDIF
$outlookexe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Outlook.EXE','') ; Get version of executable for MS-Outlook $outlookversion=GetFileVersion($outlookexe) $vers=SubStr($outlookversion,1,InStr($outlookversion,'.')+1)
$defaultprofile=ReadValue($profilelocation,'DefaultProfile')
; If no default profile exists, the outlook profile is not the default or the default profile is incorrectly configured, ; setup a new profile for the user IF $defaultprofile='' OR NOT KeyExist($profilelocation+$defaultprofile) OR NOT InStr(ReadValue($profilelocation+$defaultprofile+'\13dbb0c8aa05101a9bb000aa002fc45a','001e3001'),$lastname)
; Copy the default profile to the temporary directory COPY $exepath+'\Outlook\Custom.PRF' $temp $customprofile = $temp+'\Custom.PRF' IF $homedrive='' $homedrive='U:' ENDIF ; Profile name $=WriteProfileString($customprofile,'General','ProfileName',@userid) ; Auto archive file $=WriteProfileString($customprofile,'General','AutoArchiveFile',$homedrive+'\'+@userid+'.pst') ; Auto archive file $=WriteProfileString($customprofile,'Service1','AutoArchiveFile',$homedrive+'\'+@userid+'.pst') ; Mail box name $=WriteProfileString($customprofile,'Service1','MailBoxName',@userid) IF $deleteitems='YES' IF 'TRUE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket') $rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','TRUE') ENDIF ELSE IF 'FALSE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket') $rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','FALSE') ENDIF ENDIF ; Mail box name $=WriteProfileString($customprofile,'Service2','MailBoxName',@userid) ; Exchange server $=WriteProfileString($customprofile,'Service2','HomeServer',$exchangeserver) ; Personal folder location IF $mappref='Yes' $=WriteProfileString($customprofile,'Service3','PathToPersonalFolders',$homedrive+'\'+@userid+'.PST') ELSE $=WriteProfileString($customprofile,'Service3','PathToPersonalFolders',$temp+'\'+@userid+'.PST') ENDIF
$officelm = 'HKLM\Software\Microsoft\Office' $officecu = 'HKCU\Software\Microsoft\Office'
; Process Company Name $=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','Company',Str2Hex($company),'REG_BINARY') ; Process FullName $=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','UserName',Str2Hex(@fullname),'REG_BINARY') ; Process Initials $=WriteValue($officecu+'\'+$vers+'\Common\UserInfo','UserInitials',Str2Hex(SubStr($firstname,1,1)),'REG_BINARY')
SELECT ; If it is Outlook 98 or Outlook 2000, configure the following keys and values (e.g. 9.0.0.2416) CASE $vers='8.0' OR $vers = '9.0' ; Generate the Inbox ; If you use RUN instead of SHELL, the script will pause and not complete properly SHELL $exepath+'\Outlook\Profgen.exe '+$exepath+'\Outlook\NEWPROF.EXE -P '+$customprofile+' -X -R' ; Create default profile $=WriteValue($profilelocation,'DefaultProfile', @userid, 'REG_SZ') ; Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated IF $deleteitems = 'Yes' $=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','000b0115','0100','REG_BINARY') ENDIF ; Set the Machine Name $=WriteValue($officecu+'\'+$vers+'\Outlook','Machine Name',@wksta,'REG_SZ') ; Check Internet E-Mail Accounts $=WriteValue($officecu+'\'+$vers+'\Outlook','CheckInternetAccounts',1,'REG_DWORD') ; Has Outlook been Setup? $=WriteValue($officecu+'\'+$vers+'\Outlook','FirstRunDialog','False','REG_SZ') ; Primary Client? $=WriteValue($officecu+'\'+$vers+'\Outlook\Setup','PrimaryClient',1,'REG_DWORD') ;>>> Is this necessary? We are setting up using Profgen anyway ; Corporate or POP3? - Needs to be a machine setting ;$=WriteValue($officelm+'\'+$vers+'\Outlook\Setup','MailSupport',0,'REG_DWORD') ;>>> ; First Run $=WriteValue($officelm+'\'+$vers+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY') ; Set the default mail preference as Rich Text format 196609 is Word, 199610 Rich Text Format $=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','EditorPreference','131072','REG_DWORD') $=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ') ; Changes the view to get rid of the Outlook Bar and show the 'Explorer View' ;>>> Trimmed long line $expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff' $expview=$expview+'62000000270000003c030000ac02000001000000000000000100000000000000' $expview=$expview+'c00000006400000003000000' $=WriteValue($officecu+'\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY') ;>>> ; Set the default Font to be Verdana 10 pt
;>>> Trimmed long line $pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e610002' $pltextfont=$pltextfont+'00000000000000000000000000201a493a38e9070001000000' $=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','PlainTextFont',$pltextfont,'REG_BINARY') ;>>>
CASE ; If it is Outlook 2002 (XP) or 2003, configure the following keys and values $vers = '10.0' OR $vers='11.0' ; No extra EXEs or files other than the PRF needed for Outlook 2002 or 2003 ; This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm $=WriteProfileString($customprofile,'General','BackupProfile','NO')
; This is discussed at the bottom of - http://www.microsoft.com/office/ork/xp/four/outc03.htm $=WriteValue($officecu+'\'+$vers+'\Outlook\Setup','ImportPRF',$customprofile,'REG_SZ') $=WriteValue($officecu+'\'+$vers+'\Outlook','Machine Name',@wksta,'REG_SZ') $=DelValue($officecu+'\'+$vers+'\Outlook\Setup','First-run')
;>>>
; Import the profile for outlook ;RUN $outlookexe+' /importprf '+$customprofile >> You should not need to run outlook ;SLEEP 1
;>>>
; Set the default mail preference as Rich Text format 196609 is Word, 199610 Rich Text Format $=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','EditorPreference','131072','REG_DWORD') ; Set the default mail editor to word $=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Mail','UseWordMail','0','REG_DWORD') ; Set the default Font to be Verdana 10 pt ;>>> Trimmed long line $pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e610002' $pltextfont=$pltextfont+'00000000000000000000000000201a493a38e9070001000000' $=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY') ;>>>
;>>>
;This is talked about here ;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=10&t=000019#000002
;>>>
; Changes the view to get rid of the Outlook Bar and show the 'Explorer View' IF $explorview='Yes' AND $vers='10.0' ;Don't change version 11 $expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084020000dc' $expview=$expview+'01000001000000000000000100000000000000c0000000640000001800000003000000' $=WriteValue($officecu+'\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY') ENDIF ; Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated
;>>>
;This is talked about here ;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=10&t=000019#000002 ;>>>
;IF $deleteitems = 'Yes' $=WriteValue($officecu+'\'+$vers+'\Outlook\Preferences','EmptyTrash','1','REG_DWORD') ;ENDIF ; Enable spell check before sending - thanks Richard! $=WriteValue($officecu+'\'+$vers+'\Outlook\Options\Spelling','Check',1,'REG_DWORD') ; Disable Instant Messaging - thanks Richard! $=WriteValue($officecu+'\'+$vers+'\Outlook\IM','Enabled',0,'REG_DWORD') ENDSELECT ENDIF
RETURN
FUNCTION Str2Hex($inputstring) FOR $x = 1 TO Len($inputstring) $str2hex=$str2hex+DecToHex(Asc(SubStr($inputstring,$x,1)))+'00' NEXT $str2hex=$str2hex+'0000' ENDFUNCTION
Thanks,
Kent [ 06. November 2003, 14:44: Message edited by: kdyer ]
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 811 anonymous users online.
|
|
|