#116331 - 2004-03-18 12:31 AM
Outlook/Exchange FAQ tweaking
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Have the following code structure for updating the PRF File for Outlook (Configuration of Outlook/Exchange FAQ).. Code:
; -- OTHER CODE IF @userid<>ReadProfileString($prffile,'General','ProfileName') $rc=WriteProfileString($prffile,'General','ProfileName',@userid) ENDIF IF 'Yes'<>ReadProfileString($prffile,'General','DefaultProfile') $rc=WriteProfileString($prffile,'General','DefaultProfile','Yes') ENDIF IF 'Yes'<>ReadProfileString($prffile,'General','OverwriteProfile') $rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes') ENDIF IF 'No'<>ReadProfileString($prffile,'General','BackupProfile') $rc=WriteProfileString($prffile,'General','BackupProfile','No') ENDIF ; -- OTHER CODE
Now, I got to thinking how to get this to go through consistently, but seems to not produce correct results.  Code:
FOR EACH $FIRST IN Split('ProfileName DefaultProfile OverwriteProfile BackupProfile') FOR EACH $SECOND IN Split('@USERID Yes Yes No') IF $SECOND<>ReadProfileString($prffile,'General',$FIRST) $rc=WriteProfileString($prffile,'General',$FIRST,$SECOND) ENDIF NEXT NEXT
For convenience sake, I put together a piece of test code to verify this - Code:
CLS BREAK ON FOR EACH $FIRST IN Split('ProfileName DefaultProfile OverwriteProfile BackupProfile') FOR EACH $SECOND IN Split('@USERID Yes Yes No') ;IF $SECOND<>ReadProfileString($prffile,'General',$FIRST) ; $rc=WriteProfileString($prffile,'General',$FIRST,$SECOND) ;ENDIF ?$First+','+$second NEXT NEXT get $k
I have also tried - Code:
BREAK ON FOR EACH $FIRST IN Split('ProfileName DefaultProfile OverwriteProfile BackupProfile') PASSTHRU($First) NEXT FUNCTION PASSTHRU($First) FOR EACH $SECOND IN Split('@USERID Yes Yes No') ;IF $SECOND<>ReadProfileString($prffile,'General',$FIRST) ; $rc=WriteProfileString($prffile,'General',$FIRST,$SECOND) ;ENDIF ?$First+','+$second NEXT ENDFUNCTION get $k
Thanks,
Kent
|
|
Top
|
|
|
|
#116332 - 2004-03-24 07:09 PM
Re: Outlook/Exchange FAQ tweaking
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Ok..
Think I have figured it out..
Code:
FOR EACH $f IN Split('ProfileName @userid,DefaultProfile Yes,
OverwriteProfile Yes,BackupProfile No',',')
$header='General'
$f=SPLIT($f)
IF $f[1]<>ReadProfileString($prffile,$header,$f[0])
$rc=WriteProfileString($prffile,$header,$f[0],$f[1])
ENDIF
NEXT
Here is the updated PRFSETTINGS update -
Code:
FUNCTION PRFSETTINGS($prffile,$exchangeserver,$deleteitems)
DIM $rc,$g,$s1,$s2
; Custom Profile Settings
FOR EACH $g IN Split('ProfileName @userid,DefaultProfile Yes,
OverwriteProfile Yes,BackupProfile No',',')
$header='General'
$g=SPLIT($g)
IF $g[1]<>ReadProfileString($prffile,$header,$g[0])
$rc=WriteProfileString($prffile,$header,$g[0],$g[1])
ENDIF
NEXT
FOR EACH $s1 IN Split('AutoNameCheck TRUE,ConfirmOnDelete FALSE,
RemoveSchdPlus FALSE,SelectEntireWord TRUE,
CloseOriginalMessage TRUE,GenReadReceipt FALSE,
GenDeliveryReceipt FALSE,SaveSentMail TRUE',',')
$header='Service1'
$s1=SPLIT($s1)
IF $s1[1]<>ReadProfileString($prffile,$header,$s1[0])
$rc=WriteProfileString($prffile,$header,$s1[0],s1[1])
ENDIF
NEXT
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
FOR EACH $s1 IN Split('HomeServer $exchangeserve,MailboxName @userid',',')
$header='Service2'
$s2=SPLIT($s2)
IF $s2[1]<>ReadProfileString($prffile,$header,$s2[0])
$rc=WriteProfileString($prffile,$header,$s2[0],$s2[1])
ENDIF
NEXT
ENDFUNCTION
Thanks,
Kent
|
|
Top
|
|
|
|
#116333 - 2004-03-25 05:50 PM
Re: Outlook/Exchange FAQ tweaking
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
I can probably clean this up some more. It prints to screen the operators and the conditional values if they are not REDIMmed.
Any updates/ideas to this are welcome.
The inspiration for this is to compact down the structure checking/setting of files.
Code:
;Function INIUPDATE()
;
;Author Kent Dyer (leptonator@hotmail.com)
;
;Action Updates an INI file on an array.
;
;Syntax INIUPDATE("File","section","key","string",optional "operator")
;
;Version 0.5
;
;Date 25 March 2004
;
;Date Revised 25 March 2004
;
INIUPDATE($file,$section,$key,$string,optional $operator)
;Parameters File
; File you are checking/modifying
;
; Section
; Section header you want to target in the file
;
; Key
; Which Key under the Header you are checking
;
; String
; Resulting string you are checking/setting
;
; Operator (optional)
; Default is <> or the Not operator, You could
; use =, >=, <=, etc.
;
;Remarks This is to read in a structure of variables and conditions
; This process then splits them out and checks and uses them.
; This could be used for READVALUE/WRITEVALUE too.
;
;Returns Nothing
;
;Dependencies None
;
;KiXtart Ver 4.02
;
;Example(s)
; $rc=SETOPTION('Explicit','On')
; $rc=SETOPTION('NoVarsInStrings','On')
; DIM $profiledir,$prf,$prffile,$g,$header,$k
; $profiledir='%temp%'
; $prf='Outlook.prf'
; $prffile=$profiledir+'\'+$prf
;
; FOR EACH $g IN Split('ProfileName @userid,DefaultProfile Yes,OverwriteProfile Yes,BackupProfile No',',')
; $header='General'
; $g=SPLIT($g)
; INIUPDATE($prffile,$header,$g[1],$g[0])
; NEXT
; Code
FUNCTION INIUPDATE($file,$section,$key,$string,optional $operator)
DIM $rc
IF NOT $operator
$operator='<>'
ENDIF
REDIM $operator
IF $string $operator ReadProfileString($file,$section,$key)
$rc=WriteProfileString($file,$header,$key,$string)
ENDIF
ENDFUNCTION
Thanks,
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1636 anonymous users online.
|
|
|