wizards/source/scriptforge/SF_FileSystem.xba | 2 +- wizards/source/sfdocuments/SF_Calc.xba | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
New commits: commit 6814e4375c9c1e17b6a09dbbd0651034542dec54 Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Tue Aug 2 13:10:46 2022 +0200 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Tue Aug 2 15:55:48 2022 +0200 ScriptForge - tdf#150203 Use RANDBETWEEN.NV i.o. RANDBETWEEN Extract of the bug report (Rafael Lima) This bug affects a method from the ScriptForge library, more specifically the GetTempName method from the FileSystem service, which relies on calling RANDBETWEEN. Because of this bug, GetTempName only works in English, but fails in other languages. Below is a sample code for testing the GetTempName error. Sub TestTempName GlobalScope.BasicLibraries.LoadLibrary("ScriptForge") fs = CreateScriptService("FileSystem") MsgBox fs.GetTempName() End sub Interestingly changing RANDBETWEEN for RANDBETWEEN.NV in the macro above will work. Occurrences of the use of RANDBETWEEN: wizards/source/scriptforge/SF_FileSystem.xba wizards/source/sfdocuments/SF_Calc.xba Change-Id: Iea38f11acb7113aa5eaab1feff7a0e64a739aada Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137691 Tested-by: Jean-Pierre Ledure <j...@ledure.be> Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> Tested-by: Jenkins diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 8b21ea9a70df..21464c708fe5 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -1178,7 +1178,7 @@ Check: SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Try: - lRandom = SF_Session.ExecuteCalcFunction("RANDBETWEEN", 1, 999999) + lRandom = SF_Session.ExecuteCalcFunction("RANDBETWEEN.NV", 1, 999999) sFile = SF_FileSystem.TemporaryFolder & "SF_" & Right("000000" & lRandom, 6) Finally: diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 8cfbd3419791..b929faccd58c 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -935,7 +935,7 @@ Try: ' If a sheet with same name as input exists in the target sheet, rename it first with a random name sRandom = "" If ScriptForge.SF_Array.Contains(vSheets, .SheetName) Then - lRandom = ScriptForge.SF_Session.ExecuteCalcFunction("RANDBETWEEN", 1, 9999999) + lRandom = ScriptForge.SF_Session.ExecuteCalcFunction("RANDBETWEEN.NV", 1, 9999999) sRandom = "SF_" & Right("0000000" & lRandom, 7) oSheets.getByName(.SheetName).setName(sRandom) End If @@ -944,7 +944,7 @@ Try: ' Rename to new sheet name oSheets.getByName(.SheetName).setName(NewName) ' Reset random name - If Len(sRandom) > 0 Then oSheets.getByName(srandom).setName(.SheetName) + If Len(sRandom) > 0 Then oSheets.getByName(sRandom).setName(.SheetName) End With End If bCopy = True