REM ***** BASIC ***** Dim sWarningFile as String Dim sErrorFile as String Sub Main sWarningFile = InputBox("Please specify a warning file. Path must exist - file will be created!", "Input Parameter") sErrorFile = InputBox("Please specify an error file. It must already exist!", "Input Parameter") rem these arguments should be used for non visible scripting only dim lErrorScriptArgs() as new com.sun.star.beans.PropertyValue dim lWarningScriptArgs(0) as new com.sun.star.beans.PropertyValue lWarningScriptArgs(0).Name = "FilterOptions" lWarningScriptArgs(0).Value = "44,34,0,1,1/5/2/1/3/1/4/1" rem these arguments should be used to simulate an UI using of the API dim lErrorUIArgs(0) as new com.sun.star.beans.PropertyValue lErrorUIArgs(0).Name = "InteractionHandler" lErrorUIArgs(0).Value = createUnoService("com.sun.star.comp.uui.UUIInteractionHandler") dim lWarningUIArgs(1) as new com.sun.star.beans.PropertyValue lWarningUIArgs(0).Name = "InteractionHandler" lWarningUIArgs(0).Value = createUnoService("com.sun.star.comp.uui.UUIInteractionHandler") lWarningUIArgs(1).Name = "FilterOptions" lWarningUIArgs(1).Value = "44,34,0,1,1/5/2/1/3/1/4/1" rem create a temp test file, to produce a warning rem This csv file contains more then 32.000 lines, which isn't supported by our calc module ... createWarningFile() nFail = 0 rem load the error file using an UUI interaction handler T1: MsgBox "load error file in UI mode" Doc = StarDesktop.loadComponentFromURL(ConvertToURL(sErrorFile), "_blank", 0, lErrorUIArgs()) if (MsgBox( "Has you seen an error?", 4, "Check")<>6) then MsgBox "Test failed" + nFail Exit Sub endif nFail = nFail+1 if (not isNull(Doc)) then Doc.close(TRUE) MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 rem load the error file using a still interaction handler T2: MsgBox "load error file in scripting mode" Doc = StarDesktop.loadComponentFromURL(ConvertToURL(sErrorFile), "_blank", 0, lErrorScriptArgs()) if (MsgBox( "Has you seen an error?", 4, "Check")<>7) then MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 if (not isNull(Doc)) then Doc.close(TRUE) MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 rem load the warning file using an UUI interaction handler T3: MsgBox "load warning file in UI mode" Doc = StarDesktop.loadComponentFromURL(ConvertToURL(sWarningFile), "_blank", 0, lWarningUIArgs()) if (MsgBox( "Has you seen a warning?", 4, "Check")<>6) then MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 if (not isNull(Doc)) then Doc.close(TRUE) else MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 rem load the warning file using a still interaction handler T4: MsgBox "load warning file in scripting mode" Doc = StarDesktop.loadComponentFromURL(ConvertToURL(sWarningFile), "_blank", 0, lWarningScriptArgs()) if (MsgBox( "Has you seen a warning?", 4, "Check")<>7) then MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 if (not isNull(Doc)) then Doc.close(TRUE) else MsgBox "Test failed ("+nFail+")" Exit Sub endif nFail = nFail+1 MsgBox "Test was successfull" deleteWarningFile() End Sub '************************************************* ' creates/deletes a CSV file with more then 32.000 lines. ' Loading this file will produce a warning instead ' of an error! '************************************************* Sub createWarningFile iFile = FreeFile Open sWarningFile For Output As #iFile for l=0 to 33000 step 1 Write #iFile,0 next l Close #iFile End Sub Sub deleteWarningFile if (FileExists(sWarningFile)) then Kill sWarningFile endif End Sub