summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2022-08-02 13:10:46 +0200
committerJean-Pierre Ledure <jp@ledure.be>2022-08-02 15:55:48 +0200
commit6814e4375c9c1e17b6a09dbbd0651034542dec54 (patch)
tree992c1b9df2526d87d83ba32e35cf16d6b202d2cd /wizards
parent076a7cf9e1c7c06b935bf3c733d606c1dcfe8a0c (diff)
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 <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/SF_FileSystem.xba2
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba4
2 files changed, 3 insertions, 3 deletions
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(&quot;RANDBETWEEN&quot;, 1, 999999)
+ lRandom = SF_Session.ExecuteCalcFunction(&quot;RANDBETWEEN.NV&quot;, 1, 999999)
sFile = SF_FileSystem.TemporaryFolder &amp; &quot;SF_&quot; &amp; Right(&quot;000000&quot; &amp; 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:
&apos; If a sheet with same name as input exists in the target sheet, rename it first with a random name
sRandom = &quot;&quot;
If ScriptForge.SF_Array.Contains(vSheets, .SheetName) Then
- lRandom = ScriptForge.SF_Session.ExecuteCalcFunction(&quot;RANDBETWEEN&quot;, 1, 9999999)
+ lRandom = ScriptForge.SF_Session.ExecuteCalcFunction(&quot;RANDBETWEEN.NV&quot;, 1, 9999999)
sRandom = &quot;SF_&quot; &amp; Right(&quot;0000000&quot; &amp; lRandom, 7)
oSheets.getByName(.SheetName).setName(sRandom)
End If
@@ -944,7 +944,7 @@ Try:
&apos; Rename to new sheet name
oSheets.getByName(.SheetName).setName(NewName)
&apos; Reset random name
- If Len(sRandom) &gt; 0 Then oSheets.getByName(srandom).setName(.SheetName)
+ If Len(sRandom) &gt; 0 Then oSheets.getByName(sRandom).setName(.SheetName)
End With
End If
bCopy = True