Reply to topic

Service Menus: Issues with spaces

chipy
Registered Member
Posts
2
Karma
0

Service Menus: Issues with spaces

Sat Aug 18, 2018 7:57 am
Hi there,

I love service menus, 'coz they make our lives much easier.
So I'm having a new one to extract images from a PDF (taken from https://store.kde.org/p/998465%20).

The problem is the code doesn't work properly on pathes or files with spaces in it.
There are no issues for this file: /home/chipy/1.pdf → This works like a charm.

But for a file like saved like: /media/chipy/CHIP WD Ultra/School/School year 2018 - 2019/Spanish/Lists - Q1.pdf the code doesn't work anymore.
How do I have to change the code, to get it work properly?

Code: Select all
[Desktop Action ExtractAllImages]
Exec=which pdfimages; if [ "$?" != "0" ];then kdialog --icon=ks-error --title="Extract All Images" --passivepopup="[Error] Please install pdfimages command and try again."; exit 1; else COUNT="0"; COUNTFILES=$(echo %F|wc -w); COUNTFILES=$((++COUNTFILES)); DBUSREF=$(kdialog --icon=ks-pdf --title="PDF Tools" --progressbar "\t\t\t\t\t\t\t" $COUNTFILES); for file in %F;do COUNT=$((++COUNT)); qdbus $DBUSREF setLabelText "Extracting All Images:  ${file##*/}  [$COUNT/$((COUNTFILES-1))]"; qdbus $DBUSREF Set "" value $COUNT; cd ${file%/*}; pdfimages -p "$file" $(ls "$file"|awk -F . '{print $1}'); kdialog --icon=ks-pdf --title="PDF Tools - Extract all images" --passivepopup="[Finished]   ${file##*/}";done; qdbus $DBUSREF Set "" value $COUNTFILES; sleep 1; qdbus $DBUSREF close;fi
#Icon=ks-pdf
#Icon=application-pdf
#Icon=image-png
Icon=image
Name[de]=Alle Bilder extrahieren


Thank you in advance for your timely responses & support!
Chipy

Reply to topic

Bookmarks



Who is online

Registered users: alra, Baidu [Spider], Bing [Bot], boospy007, claydoh, Exabot [Bot], Google [Bot], passegua, raudt, Sogou [Bot], TG