Difficulty in how to use Shell Function on Linux

Actually, the real problem is not evince.
Any command line or any app I try to run using Shell is not working.

-------- Mensagem original --------

Let’s try another way (replace with the path to your file):

Sub HyperLinkOpen(ByVal href As String)
  Dim args1(0) as new com.sun.star.beans.PropertyValue
  args1(0).Name = "URL" : args1(0).Value=ConvertToUrl(href)
  createUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(StarDesktop.Frames(0), ".uno:OpenHyperlink", "", 0, args1)
End Sub

Sub Test
  HyperLinkOpen("/home/sokol/Test.pdf")
End Sub

This way it worked. However, wasn’t what I’m looking for.

My real intention is …

.
@Wanderer answer that is possible executing

.
I tried it, and it didn’t work either.
.
I’m using evince only for tests, and I still can’t use the Shell Function as I wish.

My first guess would have been current directory and search path of the shell, but as you already tested absolute paths (according to the screenshots) I think it is neither cause.
.
So the next suspect is the shell you get is restricted. An obvious solution seems to be to start a bash via shell command, like in the examples by @Ratslinger you already found. This bash can then execute your command.
.
Wich distribution of Linux do you use, and wich desktop (gnome, kde, xfce,…)? I assume you didn’t install a LibreOffice from TDF, but use a pre-installed by the distribution?

1 Like


.
Yeah, it’s a pre-installed and updated version.
.
image

Meanwhile, I confirm that it can and probably is a problem with the version of snap
This simple macro:

function Firefox02()
Shell("gnome-calculator")
 Shell("firefox www.google.com")
end function

works perfectly in the atp version of LO that I have installed years ago
Version: 6.2.8.2
Build ID: 1:6.2.8~rc2-0ubuntu0.16.04.1

but that, still working with ubuntu 16.04, it no longer updated to me and I was no longer able to update

Instead, I managed, I don’t know how, to install the LO snap version (7.3) which since then has been automatically updated but in which I discovered just yesterday the same firefox02() function DOES NOT WORK, giving me the same “file not found” error reported in this discussion
And I need to use the Shell function

Unfortunately I don’t want to risk losing version 6.2, which I still use as it is much faster than 7.4, which I use instead to develop software in starbasic.
I know I’m OT, but are there any tutorials to try and install a recent parallel version of LO atp without losing the already installed 6.2?

True! :wink: And so: would you please start a new Q, and reference this one from there?

Hello, old thread but if it can be of any use :

  • Shell takes 1 to 4 arguments, so better use shell("path/to/the/command",WindowStyle,"arguments") so for the evince example above,

Shell("/usr/bin/evince",3,sFilePath)

  • Another clue : afaik on any linux system (at least all debian or redhat flavours I know) there is a “/usr/bin/xdg-open” command taking a file path or URL as an argument and which calls the session wide preferred app for a given file type.
    I use it for any purpose, whatever the type of file, folder or URL I need to open.
    On the example above, I would use Shell("/usr/bin/xdg-open",3,sFilePath) which would open the given PDF with my favorite PDF viewer :slight_smile:
1 Like