This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Add Service Menu from .sh Script or Command

Tags: None
(comma "," separated)
dzon
Registered Member
Posts
493
Karma
3
This one should show progress in a terminal: Exec=konsole --noclose -e ocrmypdf "%u" ocr_eng.pdf


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
dzon
Registered Member
Posts
493
Karma
3
If that doesn't work, I'm afraid I'm running out of suggestions. However, I do know there's gimagereader-qt5.A front-end to ocr. Never worked with it, but hey...
https://imgur.com/a/I7Xlix2


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
limotux
Registered Member
Posts
12
Karma
0
Now this works o) ;D

Code: Select all
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/pdf;
Actions=Ocr
Icon=applications-pdf

[Desktop Action Ocr]
Name=Ocr
Icon=application-pdf
Termial=true
## This Did Not Work ! WHY? Exec=/home/limo/MyScripts/ocr.sh %F %F

Exec=/home/limo/.local/bin/ocrmypdf -l ara+eng %F %F

I had to find where the command is, add %F %F (input and output files?!)

But I do not know why it is not working with my “.sh” script or with the Alias I created for my script “ocr”
I had to find where the command is, add %F %F (input and output files?!)

But I do not know why it is not working with my “.sh” script or with the Alias I created for my script “ocr”

Thank you very much dzor for your help.
dzon
Registered Member
Posts
493
Karma
3
A, cool. I made a ton of those servicemenus and, as far as I can tell, straight forward commands in the desktop file work best. At least, if the commands are straightforward. I only have, maybe one or two, that actually use an extensive script. Now, keep in mind that you can add pretty much anything in those service menus. Keybindings, scripts, zenity....you name it.https://imgur.com/a/oPrcErz


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
limotux
Registered Member
Posts
12
Karma
0
I really thank you dzon for all your guidance
I am so eager to learn more and more
I will try your suggestions and let you know!
limotux
Registered Member
Posts
12
Karma
0
WOW!!!
This
Code: Select all
 Exec=konsole --noclose -e

is amazing
I did
Code: Select all
Exec=konsole --noclose -e /home/limo/.local/bin/ocrmypdf -l ara+eng %F %F

And it worked!
BUT it did not close after finishing the process.

UPDATE:
Removed the --noclose
Code: Select all
Exec=konsole -e /home/limo/.local/bin/ocrmypdf -l ara+eng %F %F


It worked as expected and closed after finished the job

Still, I do not understand why I could not execute my ".sh" script?
Thank you!
dzon
Registered Member
Posts
493
Karma
3
You'd probably need to add bash in front of the path of the exec. But like I said, if you can add the command straight in the exec, the better. So now, if you should create some other pdf stuff, might as well make some pdf entry with a submenu. The ocr action would go in there along with other actions you might want to apply to pdf files. There are some premade pdf service menus available so if this ocr command shouldn't be in one of those, simply add the action and make sure the action is listed in the actions section. See my first post.


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]