Registered Member
|
Hi,
I have recently started using Neon after the abandoning of Unity and need help with Service Menus. In Unity I had the following script to rename and tidy up pictures:
I am trying to set up the same thing as a service menu, but am struggling mainly because the files get renamed and the commands don't work anymore after the renaming. So far I've been able to reproduce it using 4 different Actions, but it's a pain to have to click so many times. Any help solving this by having just one Action would be very much appreciated.
|
Registered Member
|
Put your commands into a shell script and call this in the Exec line... |
Registered Member
|
PS: seems I have not completely understood your problem.
Getting the new file name and passing it to the followup commands is probably not easily doable. You could apply the same regexp that you use in "rename" the actual file name via sed e.g. (or do the rename as the last step), but the renaming via jhead might be more problematic. (Maybe jhead can output the new file name to stdout? Then you'd just need to assign the output to a shell variable to get the new name) But, for batch renaming files, have a look at krename. It's normally interactive, i.e. you select the files and how you want to rename them in the GUI, but that can be passed as command line options too to make it "automatic". |
Registered Member
|
Thanks for your ideas.
I tried krename, but while the GUI is very powerful, the command line options are very scarce and did not work here.
I had tried this and couldn't get it to work, but after tinkering a little bit I got it to work. If anyone is interested here is my final service menu/script:
and
One last question, though, I would like the script to work by just right clicking somewhere in the folder without having to first select all the pictures. I've included "inode/directory" in the MimeType, but that doesn't seem to be enough. Anyone know how this could be accomplished? |
Registered Member
|
Well, I have to admit that I never used it from the command line. I just noticed that the options seem to be there...
Looking at the krename service files, it seems to be necessary to add "inode/directory" to the "ServiceTypes" line, not the MimeType:
|
Registered Member
|
Thanks for the tips.
Unfortunately I tried modifying the script as you said, but it still doesn't work. So unless someone else another idea, I'll probably stick to what I have right now. |
Registered Member
|
And what's the problem exactly? I noticed that you wrote "I would like the script to work by just right clicking somewhere in the folder without having to first select all the pictures.", but I think this will only work if you actually right-click *on* a folder, not somewhere *in* a folder. |
Registered Member
|
You are right, I was clicking *inside* the folder, but the files were not modified. The script was being run, because I was asked for the prefix (first command) and I got the popup message from the last command, but none of the files were renamed.
I just tried again clicking *on* the folder from the parent directory this time as you suggest, but I get the same results: ask for prefix, show final popup, but no renaming. I also tried various combinations using:
ServiceTypes=KonqPopupMenu/Plugin,inode/directory or ServiceTypes=KonqPopupMenu/Plugin,all/allfiles,inode/directory including or not X-KDE-ExcludeServiceTypes=kdedevice/* (not sure what that's for?) including or not MimeType=image/jpeg; or MimeType=image/jpeg;inode/directory; Thanks for your help! |
Registered Member
|
Looks like your script is set up to expect things in the current working directory.
You might try adding a line to cd into the specified directory at the top of your script.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
You're right, but like I said, having to go up one directory to be able to click *on* the folder is not a time saver for me.
So I'll stick to selecting the pictures and clicking on them, if I can't have this working by clicking somewhere *in* the folder. Thanks for your help though! |
Registered users: Bing [Bot], Google [Bot], rockscient, Yahoo [Bot]