Ask Your Question
0

[SOLVED] Calc macro command .execute under linux

asked 2018-09-19 15:45:52 +0200

lua gravatar image

updated 2018-09-21 11:41:05 +0200

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

edit retag flag offensive close merge delete

Comments

Hmm... is that somehow related to LibreOffice?

Mike Kaganski gravatar imageMike Kaganski ( 2018-09-19 16:03:58 +0200 )edit

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.

Ratslinger gravatar imageRatslinger ( 2018-09-19 16:43:08 +0200 )edit

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.

lua gravatar imagelua ( 2018-09-21 10:27:51 +0200 )edit

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.

Mike Kaganski gravatar imageMike Kaganski ( 2018-09-21 10:45:52 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2018-09-20 19:28:28 +0200

Ratslinger gravatar image

updated 2018-09-21 03:41:39 +0200

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
edit flag offensive delete link more

Comments

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

lua gravatar imagelua ( 2018-09-21 11:09:59 +0200 )edit
0

answered 2018-09-21 11:41:28 +0200

updated 2018-09-21 11:43:20 +0200

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 :-)

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-19 15:45:52 +0200

Seen: 147 times

Last updated: Sep 21 '18