Can I add an exiftool shell script to a Ubuntu right-click context menu pulldown

Started by thesun, April 28, 2019, 11:15:47 PM

Previous topic - Next topic

thesun

I always run exiftool (Ubuntu 18.04 LTS) by the cli but would love to have a script in the right-click context menu that I can run to remove unwanted exif data right from the GUI as I'm viewing images.  Rather than need to squint at the filename, possibly mistype it, navigate the shell to the right place, etc...just would be so nice to right-click, choose "Erase Exif" or whatever my shell script is called, and poof, the data vanishes.

Is that possible?  I'm not a coder, but I enjoy fiddling with bash a bit to speed up simple tasks.

Thank you in advance for any help! 

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

thesun

Yes, @stargeek, thank you but of course I already have this part covered.  My question isn't about how to add something TO the menu, but how to ensure that the script I run from the menu will be able to operate on the right-clicked file.

I don't know if I'm explaining it properly, probably not, but I've always run exiftool from the command line, with a line such as:

    exiftool -all= abc.jpg

or

    exiftool -all= *.jpg

But I don't know how, in the script, to specify the following:

    exiftool -all= (whatever file I've just right-clicked on, be it a png, jpg, gif, etc.)

If the context menu is run, is that inherent already in the operation?  If so, what should the script look like?  Do I just say "exiftool -all=" and it runs automagically on the right-clicked file?

Thank you again.

StarGeek

Are you using the Nautilus program mentioned in the link above?  Or something else?

By reading the linked article, in Nautilus you would put exiftool -all= in the Command Path box and %B in the Parameters box.  There are other parameter options apparently available, according to that article, in a legends button.  A script wouldn't be necessary as it would run exiftool directly.

If you're putting exiftool in a bash script file and looking for a way to access the argument passed to it, then it looks like you would use $1, $2, etc to access the various args (see this article).  Though if that's wrong, there are a couple of people who know better who will correct me.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

thesun

Thank you, @Stargeek, this was exactly what I was trying to do...actually, like you said, I didn't need to run a script because it was so simple I could run exiftool directly.

I will look up the $1, $2 stuff shortly...thank you again for the help!

thesun

Looking at that article, I don't think this is what I'm talking about, as the $1, $2, etc., is still done on the command line.

I'm talking about a variable that means $(the-right-clicked-item-I'm-looking-at-selected-from-the-file-manager).  In the case of this exiftool, it's easy to NOT need a script as fma-config-tool takes care of identification.

But if I were to (even for the sake of just doing it!) run a script of exiftool rather than the command directly, that seems harder as I don't know how to pull the selected image into the script as a variable.