Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Executing external programs

by AnomalousMonk (Chancellor)
on Feb 19, 2019 at 00:20 UTC ( #1230130=note: print w/replies, xml ) Need Help??

in reply to Executing external programs

A modern operating system contains, among other things, an immense amount of code for the purpose of managing the event-driven GUIs that most fancy-schmancy modern applications use for graphically interfacing with... well, users. Using Perl (or any other language I'm aware of) to interface with these system drivers and thus to control an application is like trying to figure out a way to do neurosurgery by mounting scalpels on several dirigibles and then building a radio-control system to use them to operate on a patient in an operating theater set up in the middle of a football stadium.

In other words, this sounds like an XY Problem. What do you really want to do?

Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Executing external programs
by Silt (Novice) on Feb 19, 2019 at 05:50 UTC
    Okay, let me try to rephrase my question then:
    I want to make (as an example) a program, that has access to hundreds of pictures. I want to apply certain effects to all of them with ''. Instead of going through one by one, I would write sth do do that for me. Open --> apply effect --> save --> repeat. GUI is entirely irrelevant.

    Does this example make it more clear?

      G'day Silt,

      "Does this example make it more clear?"

      Yes, that helps. I was about to search for a script, that I provided to someone here years ago, that embedded an editor in Tk. I don't need to do that now. :-)

      I don't have MSWin available nor am I familiar with ""; however, I can tell you how I would do this on my platform using an application that's also available on your platform.

      The application is called ImageMagick. It comes with a commandline tool called convert. I've used this many times, mainly for resizing images or converting images between one format and another; however, as its webpage says:

      "Use the convert program to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more."

      So, perhaps one or more of its features equate to whatever "apply effect" means. If so, download an appropriate "Windows Binary Release" and write your code.

      You've not really provided sufficient information about your application to provide solid help with your code. If it's simply a one-off, quick-and-dirty script, you might get away with something like this:

      my $input_options = ... my $output_options = ... my @files = ... for my $file (@files) { `convert $input_options $file $output_options ${file}.out`; }

      Of course, if this is intended to be production-grade code, you'll want something more substantial.

      I did have a very quick look at I couldn't see any indication of a commandline tool but maybe you know of one: if so, you can probably use that with similar program logic.

      — Ken

      I want to apply certain effects to all of them with ''.

      Image::Magick, Imager, Gimp... or is this just another example? ;-)

      The more specific you are, the better we can help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230130]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2019-03-26 14:27 GMT
Find Nodes?
    Voting Booth?
    How do you Carpe diem?

    Results (125 votes). Check out past polls.