[Kixstart] Gehele section uit INI kopieren

Pagina: 1
Acties:

  • ilovetechno
  • Registratie: Oktober 2001
  • Laatst online: 17-04 12:49
Ik zit met het volgende probleem. Ik wil een deel uit een bepaald INI bestand via het Logon script naar een ander ini bestand kopieren.

Het betreft een gehele section

Voorbeeld:

[SnapwareServerInterface]
NetworkAddress=snapware4.1
Port=5007
Last DownTime=1100199726
SrvDlgLoginTimeout=30
[Stream Information]
LoginName=325
UsersDevice=325
AllowToSavePassword=NO
LoginPassword=
AdsLogin=NO
OpenStreamTimeOut=3000
SnapshotOnConnectionCleared=YES
StreamType=CSTA
[Program]
SnapwarePath=C:\Program Files\Snapware\
[SnapIn Manager]
SnapInName1=
SnapInCommand1=
SnapInState1=
SnapInVisible1=0
[MainWindow]
StatusWndXPos=151
StatusWndYPos=208
Width=742
Height=519
ListSplitter=177
ListSplitter0=140
ColWidthJournal0=150
ColWidthJournal1=100
ColWidthJournal2=100
ColWidthJournal3=70
JournalViewDirection=1
ColWidthLastDialed0=150
ColWidthLastDialed1=150
ColWidthLastDialed2=100
ColWidthMostDialed0=150
ColWidthMostDialed1=150
ColWidthMostDialed2=100
JournalView=LastDialed
UsedLineInfo=
ColJournal0=NAME
ColJournal1=TEL
ColJournal2=START
ColJournal3=TIMESPAN
ColJournal4=
ColHeadingJournal0=Naam
ColHeadingJournal1=Number
ColHeadingJournal2=Time
ColHeadingJournal3=Duration
ColHeadingJournal4=
ColLastDialed0=NAME
ColLastDialed1=ORG
ColLastDialed2=TEL
ColLastDialed3=
ColHeadingLastDialed0=Naam
ColHeadingLastDialed1=Relatie nr.
ColHeadingLastDialed2=Number
ColHeadingLastDialed3=
ColMostDialed0=NAME
ColMostDialed1=ORG
ColMostDialed2=TEL
ColMostDialed3=
ColHeadingMostDialed0=Naam
ColHeadingMostDialed1=Relatie nr.
ColHeadingMostDialed2=Number
ColHeadingMostDialed3=
Visible=1
JournalEntrySuccess=1
JournalEntryNotSuccess=1
JournalEntryInbound=1
JournalEntryOutbound=1
JournalEntryInternal=1
JournalEntryExternal=1


Als ik nu de vetgedrukte sections wil kopieren naar een ander bestand. Nu lukt dit me wel per egel. hier staan ook zat tutorials en voorbeelscriptjes van op kixstart.org . Echter lukt het me niet de hele section te kopieren 8)7 . Het probleem is ook dat stuk al in het doelbestand aanwezig is. Heeft iemand hier iedeen hoe dit op te lossen is?

Ik probeer het met readprofilestring en writeprofilestring

READPROFILESTRING

Retrieves a string from an initialization file.


READPROFILESTRING ("file name", "section", "key")


File name

A string that names the initialization file. If this parameter does not include a full path, Windows searches for the file in the Windows directory.

Section

A string that specifies the section containing the key name. If this parameter is empty, READPROFILESTRING returns all section names in the file.

Key

A string containing the key name whose associated string is to be retrieved. If this parameter is empty, all key names in the section specified by section are returned.

This function is provided for compatibility with 16-bit Windows – based applications. Win32 – based applications store initialization information in the registry.


  • jvdmeer
  • Registratie: April 2000
  • Laatst online: 23:24
Probeer ens het volgende:
code:
1
2
3
4
5
6
7
Open ini als tekst
    lees regel voor regel in
    indien [goede sectie], zet vinkje kopieren aan
    indien [andere sectie], zet vinkje kopieren uit
    indien vinkje kopieren aan, schrijf betreffende item met [writeprofilestring] weg
    ga naar volgende regel tot einde bestand
sluit ini

  • ilovetechno
  • Registratie: Oktober 2001
  • Laatst online: 17-04 12:49
Ik heb de volgende code.

Het lukt me niet om een gehele sectie kopieren. Heeft er iemand een oplossing.

code:
1
2
3
4
5
6
7
8
9
10
11
$sMyIni="C:\Documents and Settings\nickm\Application Data\Telesnap\Snapware.ini"

For Each $sSection In Split(ReadProfileString($sMyIni,"",""),Chr(10))
If $sSection = "Device Status Window"
For Each $sEntry In Split(ReadProfileString($sMyIni,$sSection,""),Chr(10)) 

DO
writeprofilestring("C:\test.ini", "$sSection", "key", "$sEntry ") 
UNTIL

$sEntry  = Sheet17

  • jvdmeer
  • Registratie: April 2000
  • Laatst online: 23:24
ilovetechno schreef op maandag 15 november 2004 @ 14:18:
Ik heb de volgende code.

Het lukt me niet om een gehele sectie kopieren. Heeft er iemand een oplossing.

code:
1
2
3
4
5
6
7
8
9
10
11
$sMyIni="C:\Documents and Settings\nickm\Application Data\Telesnap\Snapware.ini"

For Each $sSection In Split(ReadProfileString($sMyIni,"",""),Chr(10))
If $sSection = "Device Status Window"
For Each $sEntry In Split(ReadProfileString($sMyIni,$sSection,""),Chr(10)) 

DO
writeprofilestring("C:\test.ini", "$sSection", "key", "$sEntry ") 
UNTIL

$sEntry  = Sheet17
Kix is voor mij al weer 3 jaar geleden, maar ik zie hierboven niet de structuur/programma zoals ik het me voorstelde in mijn posting hierboven.
Laat eens het idee los, dat een ini-file bendaerd moet worden als ini-file, en benader hem gewoon als tekstfile (of een verzameling tekstregels).

PS: Kijk naar de commando's Open() en Readline()