[SOLVED] Calc macro command .execute under linux

Hi,
i’m having trouble with a macro under linux with the .execute command
i want to execute a command line ( here “vlc file:///path/testbs.mp4 --sub-file //path/test.srt”
witch i usely do by : oShell.execute(“vlc”, videoetsst, 0) where videoetsst=file:///path/testbs.mp4 --sub-file //path/test.srt

my problem is that this command under linux mint seem to send
vlc ‘file:///path/testbs.mp4 --sub-file //path/test.srt’
with the 2 little quote around the argument that prevent vlc to peek the command correctly
(i think this quote problem isn’t gonna be a problem only with vlc)
To be precise, there is no problem with the .execute if i don’t specify the default program to use for a video but here i can’t do that because of the argument --sub-file //path/test.srt needed to have what i want.
Under windows 7 the command works fine

Is there a solution to my problem?
thanks

Hmm… is that somehow related to LibreOffice?

This appears to be a cross post (AOO Forum) of this question → .execute argument issue with linux.

When cross posting, please note this when asking the same in another forum. It can help saving duplicate effort.

If you prefer my question is how to run a command line with a libreoffice/linux macro.
I’ve done my homework so my question expose the issue with a command that is not a simple file launcher but a little more complex one.

If you prefer …

I asked because your question didn’t have clear clue that it is related to LibreOffice. Word “macro”, as well as method name “.execute”, aren’t specific enough; and otherwise, it only mentioned Linux and VLC. If you started your question like in that cross-post (like “I have a macro launching video with subtitles in vlc working fine on libreoffice calc under windows 7 …”), it would not provoke my question.

Hello,

Have now tested this on Mint 18.3 using LO v6.1.0.3. Test files were obtained from here → JavaScript: HTML5 Video with SRT Subtitles. A second srt file was created for testing.

Used the following line to execute the video with specific subtitle file:

Shell "vlc /home/linuxnow/jellies.mp4 --sub-file /home/linuxnow/jellies.srt"

Changing the srt file resulted in the correct subtitles being displayed for the file chosen:

Shell "vlc /home/linuxnow/jellies.mp4 --sub-file /home/linuxnow/MYjellies2.srt"

Edit:

For flexibility, this also works:

file1 = "/home/linuxnow/jellies.mp4"
file2 = "/home/linuxnow/jellies.srt"
videoTest = "vlc " & file1 & " --sub-file " & file2
Shell videoTest

Thanks a lot launching by the shell command including the program in the command line do it perfectly Again thanks for your time and help

You must had been using something like

oShell = createUnoService("com.sun.star.system.SystemShellExecute")

to get the object with .execute method. Well - looking through the code of class ShellExec, I see this magic:

if( nFlags != 42 )
    escapeForShell(aBuffer, OUStringToOString(aParameter, osl_getThreadTextEncoding()));
else
    aBuffer.append(OUStringToOString(aParameter, osl_getThreadTextEncoding()));

so - the answer to your question is, as always, The Answer to the Ultimate Question of Life, the Universe, and Everything :slight_smile:

Specifically - using 42 as the last argument to .execute could possibly help.