-1

i am trying to find the way to call a simple bash script from a macro of my calc document. i 've hard with this instruction: session.RunApplication("Shell", "/usr/local/bin/essai-macro-bavard.sh '" & #str1 & "'") i've tried a lot of combinations. i've finished by puting the script under my $PATH, in order to assimilate the script to a kind of system command. Not "/usr/local/bin/essai-macro-bavard.sh ..." nor "essai-macro-bavard.sh" works.

Would there be someone to explain me how i have to write RunApplication to allow it to call the script ?

GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
Dim session As Variant
Dim str1 As String
session = CreateScriptService("Session")
str1 = "ici plusieurs mots"
session.RunApplication("Shell", "/usr/local/bin/essai-macro-bavard.sh '" & #str1 & "'")
1
  • Sorry, i just got the answer elsewhere ... Shell("~/myscript.sh") Commented Jan 13 at 10:33

1 Answer 1

1
Sub call_my_script
 Shell("~/my_script.sh")
End Sub

No need to instantiate session or to call RunApplication(), as simple as it has to be :-)

But, if using session and RunApplication, it can work like i have been tried in the form:

Sub call_my_script
    Dim str1 As String
    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
    Dim session As Variant
    session = CreateScriptService("Session")
  
    str1 = "ici plusieurs mots"
    ' essai-macro-bavard.sh n'étant pas une application nommée du système mais un simple fichier exécutable, ...
    file = "/home/.../essai-macro-bavard.sh"
    session.RunApplication("/bin/bash", file & " '" & str1 & "'")
End Sub

provided you have a LibreOffice-calc version sufficiently recent to have solved the bug mentioned here.

Thanks to JPL and Dude on https://forum.openoffice.org/fr/forum

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.