Difficulty in how to use Shell Function on Linux

Vie shell() you execute a traditional command-line, so you can do anything what you can do in a terminal.

lp example.pdf

What does that mean exactly? An error? An unexpected result - which? Nothing at all?

By the way, does evince expect URLs? (I.e., why do you need to use the ConvertToUrl to prepare its argument?)

I wouldn’t say expect, but it can handle http-Urls, so I guess file: should also work. But imho it is not necessary for local files.
.
And I would not expect evince to print directly, it will just show the file. As we can only guess what “is expected” evince may be used as some kind of print-peview.

1 Like

I already tried this. In my case, lpr example.pdf.

Using terminal works fine, but with Shell Function always give a error 53 - File not found. Even when a use Url Notation.
.
Could be something like user or app permission @Wanderer ?

Was not a good choice of worlds. Sorry!
Every time a try to run the macro, it gives error 53 - File not found.

.
I used evince only as a example, to pass the needed arguments in the function. It was a failed attempt to copy the answer given in another thread.
.
I’ll use the function ConvertToUrl, after use File.getSelectFiles() method from API FilePicker.

@Ratslinger Could you help me with this one, please?

I read your answer at this topic.

What kind of manipulations you had to do to make it work ?

You could try

Shell "bash -c 'lpr /home/yourname/example.pdf' "

or test with evince to save paper. I added a space beween the last single ’ and th final " for visibility

@FelipeAle

Haven’t worked with that linked item in about 5 years (as the link shows) but just tried using TDF LO:

Version: 7.3.4.2 / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

On:

Screenshot at 2022-06-18 13-49-46
.
using this line:

Shell ("lpr /home/YOUR_DIRECTORY/Documents/YOUR_FILE_TO_PRINT.pdf")

.
and had no issue. It appears this is what you want?

1 Like

In view of @Wanderer 's question, and the test done by @Ratslinger , I uninstalled my LO (Snap version), and downloaded it from the official site.
.
It’s working perfectly now, and even faster.
.
Thank you all very much for your knowledge and for donating a litlle of your time to help.

Ah! That was the clue. We have some problems with that containerized thing, we can’t e.g. call browser to show the local help.

I’d say, there’s no need to use the TDF release, that is slower than Ubuntu package (because it’s built for a baseline library support), and also doesn’t get automatic updated. Try the apt version, maybe the one from the Ubuntu packaging team’s PPA (if you prefer newer versions than those coming for your Ubuntu release).

1 Like

I don’t understand what you want exactly, but, this lines work fine in my system.

    path_pdf = "/home/mau/Downloads/g1.pdf"
    Shell "evince " & path_pdf

Version: 7.3.4.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.18; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
7.3.4-2
Calc: CL

1 Like

I wrote the same thing in mine. But is not working. Always return error File not found.
.
My example:

sFilePath = "/home/felipe-ale/Documentos/teste.pdf"
Shell ( "evince " & sFilePath )

.
Could be something related with directory, file or app permission ?

What if you simply use Shell ( "evince ") ?

Question is because the Shell is documented to also take command arguments as its optional third argument. I see that others can use the first argument for complete command line, but maybe it’s somehow system-dependent, and you need to pass filepath separately?

(Well, ignore me; the implementation simply concatenates the first and the third arguments, so it should not matter…)

It didn’t work either.
image
.

Still not working.
image
.
I would try to change my LO version, however it seems that it doesn’t matter here.

Nitpicking: you didn’t test exactly what I asked for ("evince"), but "evince " - with a trailing space. Not that it should matter…

Same thing…
image

In my configuration, the evince utility is not initially installed, and when the utility is called through Shell, the same message is displayed as yours.
Try calling evince via terminal.

Version: 7.3.3.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3~rc2-0ubuntu0.20.04.1~lo1
Calc: threaded

Via terminal works fine. It’s already installed.

And if you replace evince with atril?

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

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