Hi! I am running this Scriptforge python code: -*-*-*-*-*-*-*-*-*-*-*-*-*- CODE -*-*-*-*-*-*-*-*-*-*-*-*-*- from scriptforge import CreateScriptService def msgbox_last_row(*args): bas = CreateScriptService("Basic") myDoc = CreateScriptService("Calc", bas.ThisComponent) last_row = myDoc.LastRow('Sheet1') bas.MsgBox(last_row) -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- The case is that, EVERY single time the document is loaded and the script is executed, Libreoffice asks if I want to activate Java (JRE), since it is necessary to run the script (even if using Java is explicitely disabled). However this is not true, since even if it is not activated and the message is closed, the code runs without problem. To test it: make sure using a Java (JRE) environment is disabled. mikekaganski comment here https://ask.libreoffice.org/t/scriptforge-asks-to-activate-java-jre-even-if-you-dont-need-it/117672/8?u=uralion: 'SF has _FindModuleFromMethod function, which calls getChildNodes from macro organizer; and that tries to load Java, because indeed one of its nodes is Java. But the function explicitly only wants Basic. It seems like they could use ScriptProviderForBasic service 2 instead.' Thank you very much!!!
I confirm the bug in Version: 25.2.0.3 (X86_64) / LibreOffice Community Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069 CPU threads: 6; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb) Locale: fr-BE (en_US.UTF-8); UI: en-US Calc: threaded 1) the given script is written in Python. The same behaviour is observed with next Basic script: Sub Main GlobalScope.BasicLibraries.loadLibrary("ScriptForge") myDoc = CreateScriptService("Calc", ThisComponent) last_row = myDoc.LastRow('Sheet1') MsgBox(last_row) End Sub 2) The message about the JRE does not appear every time the document is opened but only once per LO session. Whatever the answer to the message (Yes/No/Cancel), the execution of the macro continues and ends normally. 3) I confirm Mike's comments. I am able to get a com.sun.star.comp.scripting.ScriptProviderForBasic service with next code: Sub XXX GlobalScope.BasicLibraries.loadLibrary("ScriptForge") GlobalScope.BasicLibraries.loadLibrary("XrayTool") factory = getDefaultContext.getValueByName("/singletons/com.sun.star.script.browse.theBrowseNodeFactory") Set root = factory.createView(com.sun.star.script.browse.BrowseNodeFactoryViewTypes.MACROORGANIZER) a = root.ChildNodes(0) ' user b = a.ChildNodes(0) ' Basic xray b ' com.sun.star.comp.scripting.ScriptProviderForBasic End Sub However this gives the same message about the absence of a JRE. I do not know a better way. Can someone make a suggestion to have a direct access to that service ?
Would 'createUnoService("com.sun.star.comp.scripting.ScriptProviderForBasic")' work?
No, it doesn't work: the service is created but does not contain any subnode.
Right, it needs to be initialized. Either x.initialize(array("user")) or x.initialize(array("share"))
Much better. Thanks.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ff298dfebcd5a6772de53d075e960bddcd4aff46 ScriptForge (SF_Services) fix tdf#165147 do not require JRE It will be available in 25.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Pierre Ledure committed a patch related to this issue. It has been pushed to "libreoffice-25-2": https://git.libreoffice.org/core/commit/6a6c10f25617d492c9db488e31db73c44d687b71 ScriptForge (SF_Services) fix tdf#165147 do not require JRE It will be available in 25.2.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Pierre Ledure and Mike Kaganski (and all others involved if any): I am very grateful for your kindness and efficiency. Thank you very much!