Greetings !!
I’m a bit bored to seek for technical documentation that is a bit messy.
There is the description of my goals:
I’m seeking for a way to update in “real time” (without saving the document, run the script, and reopen again)
the sheets in Spreadsheet with sorted datas from two other sheets.
I got a perl script that sorts the datas… as I did not like nore VBA, nore javascript nore Python to do this in a macro.
The script works, I got what I wanted → the data sorted in the different sheets expected to display the sorted datas.
Now I try to trigger a macro each time my “main sheet” is modified.
I created a “sheet event” linked to the macro expected to be triggered (I debugged and saw that each time
I modify a cell the macro is triggered, that’s nice)
The problem is: the perl script seems to do nothing :{
I set the security to “medium” and set the “trusted folder” as the one where the script is located on my filesystem.
This is the code of the macro
Sub Main
REM APPELER UN SCRIPT PERL
Shell("/exemples/perl/tests/libreoffice/oodoc.pl",1,"",true)
REM Shell("/usr/bin/perl",1,"/exemples/perl/tests/libreoffice/oodoc.pl",true)
REM Shell("xterm",1,"/exemples/perl/tests/libreoffice/oodoc.pl",true)
REM TRY TO INDICATE THE TRIGGER IS DONE
Dim bTriggered AS Boolean
Dim mesFeuilles AS object
Dim maCellule AS object
Dim maFeuille AS object
Dim monDoc AS object
monDoc = ThisComponent
mesFeuilles = monDoc.Sheets
maFeuille = mesFeuilles.getByName("Calendrier")
maCellule = maFeuille.getCellByPosition(11,2)
if maCellule.Value = "" OR maCellule.Value = 0 Then
maCellule.Value = 1
End if
End Sub
I tried with “xterm” the “window” flashed and then vanished immediatly but that indicated the Shell() was executed.
My question is: why, the perl script is not showing the results as they were shown when executed
“outside” the LibreOffice application ?