Autor Thema: Notes.ini mit LS ändern  (Gelesen 3683 mal)

Offline Hardy

  • Aktives Mitglied
  • ***
  • Beiträge: 137
  • Geschlecht: Männlich
  • Wer will sucht Wege , wer nicht will sucht Gründe
    • Homepage
Notes.ini mit LS ändern
« am: 05.09.02 - 15:04:52 »
Hi,

hatten wir hier schon mal einen Code mit dem man
per SmartIcon oder per Aktion Einträge in der Notes.ini
machen oder ändern kann  ?

Wenn ja wäre ich Dankbar für eine Info.

Hardy  ???
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
______________________________
Mit Software ist es wie mit Bananen !
Beides reift beim Kunden !!
______________________________
28 x 6.5.5 im Cluster auf WinSrv 2003

Clients:
6.000 User (Win XP Prof.) 6.5.4

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.730
  • Geschlecht: Männlich
Re: Notes.ini mit LS ändern
« Antwort #1 am: 05.09.02 - 15:30:15 »
manchmal geht so was auch mit Formeln  ;D ;D

Definiert eine Umgebungsvariable, die in der Datei NOTES.INI (Windows, OS/2 und UNIX) oder der Datei "Notes Voreinstellungen" (Macintosh) gespeichert wird.
Syntax
@SetEnvironment( Variablenname ; Wert )
Parameter
Variablenname
Text. Der Name der Umgebungsvariablen (zwischen Anführungszeichen). Wenn Sie für Variablenname eine Textliste eingeben, wird jeder bezeichneten Variablen in der Liste der angegebene Wert zugewiesen. Wenn Sie eine Variable verwenden, die den Feldnamen enthält, lassen Sie hier die Anführungszeichen weg.
Wert
Text. Der Wert, den Sie Variablenname zuweisen möchten. Wenn Wert eine Textliste ist, wird nur der erste Wert in der Liste verwendet; der Rest wird ignoriert.

eknori
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.730
  • Geschlecht: Männlich
Re: Notes.ini mit LS ändern
« Antwort #2 am: 05.09.02 - 15:33:32 »
geht natürlich auch mit Script

SCHREIBEN

Function INI_Write(INI_Path As String, INI_FileName As String,INI_Section As String,INI_Variable As String,INI_Value As String,ErrorMessage As String) As Variant
' this function will locate a given ini file and look for the given section and variable within that inifile. If it does not find the section it will add the section
' the variable and the value.
' if it does find the section it will look for the variable. if it does not find the variable within the given section it will add the variable and the value
' if it does find the variable it will add the new value.
     
' to use this function parameters MUST be specified in the given format....
' INI_PATH example ..... "C:\Windows\"
' INI_FileName example .... "notes.ini"
' INI_Section example .... "[Notes]"
' INI_Variable example .... "Directory"
' INI_Value example .... "c:\notes\data"
' ErrorMessage is used to hold the value of the error message. If the function fails you can find the error message here.
     
' return values for errors
' INIWrite_Path_Not_Found
' INIWrite_File_Not_Found
     
     INI_Write = True
     
     INI_Section = Ucase$(Trim$(INI_Section)) ' convert to uppercase and trim spaces
     INI_Variable = Ucase$(Trim$(INI_Variable)) ' convert to uppercase and trim spaces
     
     Dim FileName As String
     Dim FileHandle As Integer
     Dim TempLine As String
     Dim Counter As Long
     Dim IniFileLines() As String
     Dim SectionFound As Variant
     Dim VariableFound As Variant
     Dim ArrayIndex1 As Long
     Dim ArrayIndex2 As Long
     Dim OutPutArray As Variant
     Dim EqualSignPosition As Integer
     
' first thing to do is check for the existence of the path.
     On Error 76 Resume Next ' Error is Path not found
     FileName = Dir$(INI_Path & "*.*", 0)
     If Error() = "Path not found" Then
           Print "Path Not Found."
           INI_Write = False
           ErrorMessage = "INIWrite_Path_Not_Found"
           Exit Function
     End If
     
' second thing to do is check for the existence of the file.
     FileName = Dir$(INI_Path & INI_FileName,0)
     If FileName = "" Then
           Print "File Not Found"
           INI_Write = False
           ErrorMessage = "INIWrite_File_Not_Found"
           Exit Function
     End If
     
' get a file handle
     FileHandle = Freefile
' open the file
     Open INI_Path & INI_FileName For Input Access Read As FileHandle
     
' now read in the file line by line into an array
     Counter = 0
     Do While Not Eof(FileHandle)
           Line Input #FileHandle , TempLine
           Redim Preserve IniFileLines(Counter) As String
           IniFileLines(Counter) = Ucase$(Trim$(TempLine))
           Counter = Counter + 1
     Loop
     Close #FileHandle
     
' now look for the section
     SectionFound = False
     VariableFound = False
     For ArrayIndex1 = 0 To Counter - 1
           If IniFileLines(ArrayIndex1) = INI_Section Then ' found the correct section
                 SectionFound = True
                 For ArrayIndex2 = ArrayIndex1 + 1 To Counter - 1 ' look for the variable
                       If Left$(IniFileLines(ArrayIndex2),1) = "[" And Right$(IniFileLines(ArrayIndex2),1) = "]" Then ' found next section without finding variable add the variable here.
' insert variable and value
                             Call InsertIntoArray(IniFileLines,Counter,ArrayIndex2,INI_Variable & " = " & INI_Value)
                             VariableFound = True
                             Exit For
                       Else
                             If Not Left$(IniFileLines(ArrayIndex2),1) = ";" Then ' is not a comment
' Locate equal sign in the string
                                   EqualSignPosition = Instr(IniFileLines(ArrayIndex2),"=")
                                   If Not EqualSignPosition = 0 Then ' found the equal sign
                                         If Trim(Left$(IniFileLines(ArrayIndex2),EqualSignPosition - 1)) = INI_Variable Then ' found correct variable
                                               VariableFound = True
' replace the variable and the value
                                               IniFileLines(ArrayIndex2) = INI_Variable & " = " & INI_Value
                                               Exit For
                                         End If
                                   Else
                                         If Not IniFileLines(ArrayIndex2) = "" Then ' append equal sign to the line
                                               IniFileLines(ArrayIndex2) = IniFileLines(ArrayIndex2) & " = "
                                         End If
                                   End If
                             End If
                       End If
                 Next
                 Exit For
           End If
     Next
     
     If SectionFound = False Then ' section never found, insert section, variable and value
' insert section
           Call InsertIntoArray(IniFileLines,Counter-1,Counter,INI_Section)
' insert variable and value
           Call InsertIntoArray(IniFileLines,Counter,Counter+1,INI_Variable & " = " & INI_Value)
     Else
           If VariableFound = False Then 'variable never found, insert variable and value
' insert variable and value
                 Call InsertIntoArray(IniFileLines,Counter-1,Counter,INI_Variable & " = " & INI_Value)
           End If
     End If
     
' write the values of the array out to the ini file
' get a file handle
     FileHandle = Freefile
' open the file
     Open INI_Path & INI_FileName For Output Access Write As FileHandle
     Print Cstr(Ubound(IniFileLines))
     For ArrayIndex1 = 0 To Ubound(IniFileLines)
           If Not IniFileLines(ArrayIndex1) = "" Then
                 If Left$(IniFileLines(ArrayIndex1),1) = "[" And Right$(IniFileLines(ArrayIndex1),1) = "]" Then ' found next section
                       Print #FileHandle , ""
                 End If
                 Print #FileHandle , IniFileLines(ArrayIndex1)
           End If
     Next
     Close #FileHandle
End Function

und LESEN geht so

Function INI_Read(INI_Path As String, INI_FileName As String,INI_Section As String,INI_Variable As String,ReturnValue As String) As Variant
' this function will locate a given ini file and locate a variable within a section. It will return one of the given error
' messages below or the value assigned to the variable.
     
' to use this function parameters MUST be specified in the given format....
' INI_PATH example ..... "C:\Windows\"
' INI_FileName example .... "notes.ini"
' INI_Section example .... "[Notes]"
' INI_Variable example .... "Directory"
' ReturnValue is used to hold the value of the variable read or the error message. If the function fails you can find the error message here.
' If it succeeds it will hold the value of the variable to be read.
     
' return values for errors
' INIRead_Path_Not_Found
' INIRead_File_Not_Found
' INIRead_Section_Not_Found
' INIRead_Variable_Not_Found
     
     INI_Read = True
     ReturnValue = ""
     
     INI_Section = Ucase$(Trim$(INI_Section)) ' convert to uppercase and trim spaces
     INI_Variable = Ucase$(Trim$(INI_Variable)) ' convert to uppercase and trim spaces
     
     Dim FileName As String
     Dim IniFileLines() As String
     Dim FileHandle As Integer
     Dim TempLine As String
     Dim Counter As Long
     Dim ArrayIndex1 As Long
     Dim ArrayIndex2 As Long
     Dim SectionFound As Variant
     Dim VariableFound As Variant
     Dim EqualSignPosition As Integer
     
' first thing to do is check for the existence of the path.
     On Error 76 Resume Next ' Error is Path not found
     FileName = Dir$(INI_Path & "*.*", 0)
     If Error() = "Path not found" Then
           Print "Path Not Found."
           INI_Read = False
           ReturnValue = "INIRead_Path_Not_Found"
           Exit Function
     End If
     
' second thing to do is check for the existence of the file.
     FileName = Dir$(INI_Path & INI_FileName,0)
     If FileName = "" Then
           Print "File Not Found"
           INI_Read = False
           ReturnValue = "INIRead_File_Not_Found"
           Exit Function
     End If
     
' get a file handle
     FileHandle = Freefile
' open the file
     Open INI_Path & INI_FileName For Input Access Read As FileHandle
     
' now read in the file line by line into an array
     Counter = 0
     Do While Not Eof(FileHandle)
           Line Input #FileHandle , TempLine
           Redim Preserve IniFileLines(Counter) As String
           IniFileLines(Counter) = Ucase$(Trim$(TempLine))
           Counter = Counter + 1
     Loop
     Close #FileHandle
     
' now look for the section
     SectionFound = False
     VariableFound = False
     For ArrayIndex1 = 0 To Counter - 1
           If IniFileLines(ArrayIndex1) = INI_Section Then ' found the correct section... go through array until variable is found or next section is found
                 SectionFound = True
                 For ArrayIndex2 = ArrayIndex1 + 1 To Counter - 1 ' look for variable
                       If Left$(IniFileLines(ArrayIndex2),1) = "[" And Right$(IniFileLines(ArrayIndex2),1) = "]" Then ' found next section without finding variable
                             Exit For
                       Else
' check to see if the current line is a comment by looking for a ";" at the leftmost char
                             If Not Left$(IniFileLines(ArrayIndex2),1) = ";" Then ' is not a comment
' Locate equal sign in the string
                                   EqualSignPosition = Instr(IniFileLines(ArrayIndex2),"=")
                                   If Not EqualSignPosition = 0 Then
                                         If Trim(Left$(IniFileLines(ArrayIndex2),EqualSignPosition - 1)) = INI_Variable Then ' found correct variable
                                               VariableFound = True
                                               Print "INI Read Successful"
                                               ReturnValue = Trim(Mid$(IniFileLines(ArrayIndex2),EqualSignPosition+1))
                                               Exit For
                                         End If
                                   End If
                             End If
                       End If
                 Next
                 Exit For ' exit this for loop because already found the section
           End If
     Next
     
     If Not SectionFound Then
           Print "Section Not Found"
           INI_Read = False
           ReturnValue = "INIRead_Section_Not_Found"
     Else
           If Not VariableFound Then
                 Print "Variable Not Found"
                 INI_Read = False
                 ReturnValue = "INIRead_Variable_Not_Found"
           End If
     End If
End Function

eknori
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline Hardy

  • Aktives Mitglied
  • ***
  • Beiträge: 137
  • Geschlecht: Männlich
  • Wer will sucht Wege , wer nicht will sucht Gründe
    • Homepage
Re: Notes.ini mit LS ändern
« Antwort #3 am: 05.09.02 - 15:35:55 »
Danke !

Damit komm ich weiter

Hardy
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
______________________________
Mit Software ist es wie mit Bananen !
Beides reift beim Kunden !!
______________________________
28 x 6.5.5 im Cluster auf WinSrv 2003

Clients:
6.000 User (Win XP Prof.) 6.5.4

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.730
  • Geschlecht: Männlich
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline Till_21

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 708
  • Geschlecht: Männlich
  • I love Germany
Re: Notes.ini mit LS ändern
« Antwort #5 am: 05.09.02 - 15:45:24 »
Oder aber verwende die methode SetEnvironmentVar der NotesSession :
"Call notesSession.SetEnvironmentVar( name$, valueV  [, issystemvar] )"

ein wenig übersichtlicher...

wohl aber erst ab R5 verfügbar

gruss / till
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »

Offline Hardy

  • Aktives Mitglied
  • ***
  • Beiträge: 137
  • Geschlecht: Männlich
  • Wer will sucht Wege , wer nicht will sucht Gründe
    • Homepage
Re: Notes.ini mit LS ändern
« Antwort #6 am: 06.09.02 - 08:24:40 »
Supi  ;D

was will man mehr

Danke nochmals

Hardy
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
______________________________
Mit Software ist es wie mit Bananen !
Beides reift beim Kunden !!
______________________________
28 x 6.5.5 im Cluster auf WinSrv 2003

Clients:
6.000 User (Win XP Prof.) 6.5.4

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz