This problem is caused by automatic data type conversion. When the script engine finds only digits and dots in a value it assumes it is dealing with a number, which is not in this case. Data-type conversion rules will be relaxed in version 3.4.21 and later, that should help to avoid this and similar issues. : I use a user defined statement to read sections from a inifile. : when te section from the ini file is mod_18_test1=10.0.0.1 it should return : the ipnumber in the return datatype string. this gives us a type mismatch. : since a string could be anything it really should not matter if I put a : ipnumber : in the string. : I solved it now by making the the ini statement ip10.0.0.1 wich returns : the string ip10.0.0.1 wich can then be converted to 10.0.0.1 by removing : "ip" from : the string. : // : // ***** Declaratie. : Dim strErrorLog, String, "" // Parameter standaard Batchlog : Dim strDefaultIniFile, String, "D:\\BatchRoot\\ini\\Batch.ini" // : Standaard ini directory : Dim strErrorMessage, String, "" // Error message : Dim strFileParm, String, "" // Parameter behorende bij Key : Dim strNewCum, String, "" // Tijdelijke string cum-waarde FileParm : Dim strNewFileParm, String, "" // Aangepaste FileParm : Dim strSubject, String, "" // Mail subject : Dim numLength, Number, 0 // Length of string : Dim numPosBackslash, Number, 0 // Positie Backslash in strFileParm : Dim numReturn, Number, 0 // Variabele numerieke return warde : Dim numStartFileParm, Number, 1 // Start zoeken in strFileParm : Dim numTemp, Number, 0 // Tijdelijke num : Dim blnFileExits, Boolean, False // True indien ini-bestand bestaat : Dim blnLoopFileParm, Boolean, False // False indien geen nieuwe \ in FileParm : Dim blnNoValue, Boolean, False // Waarde in Ini gevonden? standaard is Ja : Dim blnReturn, Boolean, False // Variabele return boolean : // : // Programma : // : // Controleer de naam van het opgegeven ini-bestand. : // Indien gelijk aan 1, wijzig deze dan in het default ini-bestand. : ChooseCase strIniFile EndChoose_strIniFile : Case 1 : Set strIniFile strDefaultIniFile : EndChoose_strIniFile: // Controleer of ini bestand bestaat : FileExists strIniFile blnFileExits : if blnFileExits BestandAanwezig Fout_GeenBestand : BestandAanwezig: IniFileGetKey strIniFile, strSection, strKey, strFileParm : length strFileParm, numLength : isEqual numLength, 0, blnNoValue : ifthen blnNoValue, Fout_GeenWaarde, GevuldeWaarde : GevuldeWaarde: IsEqual strFileParm "leeg" blnReturn : Not blnReturn blnReturn : IfThen blnReturn CheckOnBackSlash : Set strFileParm "" : Goto ReturnFileParm : CheckOnBackSlash: Length strFileParm numLength : LoopUntil blnLoopFileParm EndLoop_blnLoopFileParm : Pos strFileParm, "\\", numStartFileParm numPosBackslash : NotEqual numPosBackslash, 0 blnReturn : If blnReturn Backslash NoBackslash : BackSlash: Subtract numPosBackslash, numStartFileParm numTemp : Mid strFileParm, numStartFileParm, numTemp strNewCum : Concatex strNewFileParm, strNewCum, "\\\\" strNewFileParm : Add numPosBackslash, 1 numStartFileParm : Goto End_If : NoBackSlash: Subtract numLength, numStartFileParm numTemp : Add numTemp, 1 numTemp : Mid strFileParm, numStartFileParm, numTemp strNewCum : Concatex strNewFileParm, strNewCum, strNewFileParm : Set blnLoopFileParm True : End_If: EndLoop_blnLoopFileParm: Set strFileParm strNewFileParm : ReturnFileParm: Goto End : Fout_GeenWaarde: Concatex " Batch Error: Key not found in : ini-file", strSubject : Concatex " Error: Key ", strKey, " niet aanwezig in : ini-bestand ", strIniFile, strErrorMessage : goto ERROR_Routine : Fout_GeenBestand: Concatex " Error: Opgegeven ini-bestand ", : strIniFile, " is niet gevonden", strErrorMessage : goto ERROR_Routine : ERROR_Routine: // Indien strLogFile gevuld, schrijf naar strLogFile : Length strLogFile, numReturn : IsEqual numReturn, 0, blnReturn : IfThen blnReturn WriteToStandardLog : ALG_WriteToDetailLog( strLogFile, strErrorMessage, 1, False ) : Goto MailMessage : WriteToStandardLog: IniFileGetKey strDefaultIniFile, "Algemeen", : "DefaultErrorFile", strErrorLog : ALG_WriteToDetailLog( strErrorLog, strErrorMessage, 0, True ) : MailMessage: // ALG_MailRoutine( "1", "Productie", : "Mail_ErrorRecipient", strSubject, strErrorMessage, : "", strLogFile ) : // ALG_MailRoutine( "1", "SchaduwProductie", : "Mail_ErrorRecipient", strSubject, strErrorMessage, : "", strLogFile ) : // ALG_MailRoutine( "1", "Acceptatie", : "Mail_ErrorRecipient", strSubject, strErrorMessage, : "", strLogFile ) : // ALG_MailRoutine( "1", "Test", : "Mail_ErrorRecipient", strSubject, strErrorMessage, : "", strLogFile ) : set strFileParm, "Error" : End: Return strFileParm
|