Home > Software design >  Open a File in with shell script in application without new instance?
Open a File in with shell script in application without new instance?

Time:03-29

I've got a picture converting tool for ubuntu which opens a window, where you can drag-and-drop a jpeg and automatically convert it in to a .wepb file. Another option is to convert the pictures directly via the command line:

user@linux-desktop: ./jpeg2webp /Home/User/Dekstop/Pic1.jpeg

It work fine but when i use the bash/shell script it always opens a new instance of the Application.

Is there a way to tell the script to open the jpeg in the already opened instance maybe via the pid and prevent opening another instance? Or emulate a drag-and-drop on the app-window with the file path?

for example: tell /Home/User/Dekstop/Pic1.jpeg to drag and drop on ./jpeg2webp application window

CodePudding user response:

I was unable to find any information about the application you are using.

An alternative approach would be to use imagemagicks convert tool:

convert in.jpg out.webp

For convenience you could also use a small wrapper script to convert a file while keeping the original filename:

#!/bin/bash
name="${1%.*}"  #get name from command line argument
convert "$1" "$name".webp  

And run it as following:

./cwepb foo.jpg

CodePudding user response:

Thank you so much for your answer and suggesting me this tool. But i forgot to mention that this tool was written for the company that i work for and is automatically converting the pictures in to webp and adds a watermark logo on each picture so i have to use this tool. As far as i know its a xwindow tool using XDND for drag and drop. The person who wrote it is not reachable anymore.

isn't there another way to get a jpeg into that window using the command line?

  • Related