You are not logged in.
Good evening,
I'd like to set a custom action in Thunar File Manager doing this: convert a doc/docx file using lowriter --convert-to pdf , then send the output (pdf) to print with lpr command. I know I can print doc/docx files directly using lowriter -p command, but I'd like to try this option.
Thanks, vladi
OS: Xubuntu 16.04.6
Offline
I don't know the exact commands, work that out in a terminal and then stick them together into the custom action. '&&' would allow the two to complete independently
So one step is covert a doc to pdf.
&&
The last step is printing the doc file.
lowriter --convert-to pdf %f && lowriter -p %f
Offline
@CwF I know , I tried several times, the last step I want is print the PDF file (result of lowriter --convert-to pdf) and not the doc file. So
some thing like this: lowriter --convert-to pdf %f && lpr (new pdf created file)
I don't know how to get this new pdf file and print it with lpr.
OK! I found a way to do that, a small script : for file in "$@"; do (lowriter --convert-to pdf $file); lpr "${file%.*}.pdf"; done
then add the script to Thunar custom actions. I don't know if it's the right way but works.
Last edited by pavloskiv (2020-01-03 13:40:39)
Offline
very good pavloskiv. I didn't catch it was better to print the pdf than the doc.
Is there a good index somewhere of what is legal and possible within the command line of the custom action?
I'd like to make many I don't know how to yet, and calling a script is the easier way, but packaging the script into a single line within the command line seems to break the command, and my thinking. IE. declaring variables, incrementing filenames and the like requires a script? I suppose there is only thunar's variable handling and not general bash possibilities without calling an external script?
Similar to creating a launcher and fitting it all on one long line instead of calling a script, it seems the 'run in terminal' option saves the day while thunar has no such option?
Offline
@Member I'll try to be more didactic: If you write the command above directly to Thunar custom actions it won't work, so you need to create a new file with mousepad or any other txt editor and paste this: #!/bin/bash
for file in "$@"; do (lowriter --convert-to pdf $file); lpr "${file%.*}.pdf";done
save the file and give any name but with .sh extension, make this new file executable (you can save this file in any directory you want), in my case I have this script in ~/Scripts/newfile.sh. After that open Thunar and add the custom action, for command click on the right icon to find the script you just create (navigate to the folder where the script is) then for appearance conditions choose other files and patterns *.doc;*.docx . That's it, thanks for reply.
Offline
[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 532.51 KiB (Peak: 533.13 KiB) ]