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

Full guide to Service Menus?

Tags: None
(comma "," separated)
User avatar
carlosestensser
Registered Member
Posts
51
Karma
0
OS

Full guide to Service Menus?

Tue Mar 27, 2012 6:53 pm
Is there a full guide to KDE service menus somewhere?
I am just trying to create a bash script that operates on several selected files but I can't make it/him/her understand that there are several filenames in $@.
User avatar
google01103
Manager
Posts
6668
Karma
25

Re: Full guide to Service Menus?

Tue Mar 27, 2012 7:22 pm
Service menu tutorials:
http://techbase.kde.org/Development/Tut ... vice_Menus
http://oreilly.com/pub/h/3156

can your script cycle thought the arguments passed?

something like:
# Loop through the command line arguments
ARGV=("$@")
for((n=0;n<$#;n++)); do
furl=${ARGV[$n]}
done

there's an interesting take on this here viewtopic.php?f=43&t=93784 (where I got the above code example)


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
carlosestensser
Registered Member
Posts
51
Karma
0
OS

Re: Full guide to Service Menus?

Tue Mar 27, 2012 7:32 pm
First of all, thanks for the links!
The problem is that "%U" passes to the script a single string containing for example:
"/home/darwin/old backup/1.txt /home/darwin/old backup/2.txt", etc.
What I need is to make the service menu pass the filenames separately or with some kind of delimiter.
If I am not mistaken, your solution points to trying to dissect the multiple instances after they have been passed to the script as one long string, and I don't see how to differentiate the empty spaces which are delimiting the filenames from the empty spaces that are inside the file's name.

EDIT:
I don't understand the syntax of the "for" line that you proposed, but it seems to do the same as using "%F" "%N" in the Service Menu.
User avatar
google01103
Manager
Posts
6668
Karma
25

Re: Full guide to Service Menus?  Topic is solved

Wed Mar 28, 2012 12:23 pm
suggest you post in forum: KDE Development -> Helping hands

explicitly mentioning passing filenames w/spaces from service menu to bash script


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

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