Launch an executable with parameters


#1

Is there any way to launch an executable with the current filename as parameter?

cool.exe "{ current filename }"

Edit: I can do exactly that with this plugin: process-palette


#2

I’m not sure what this has to do with Atom?


#3

While working in atom, with some file open I would like to run that same file thru an external application. That application does something with that file, I think they call it a “build system” in SUBLIME, but I cant seem to find it in ATOM.

https://www.sublimetext.com/docs/build


#4

The script and runner packages are the most common packages used to run code, but there are also packages for specific utilities and languages.


#5

I don’t want to run a script, I want “to open a file with …”, and add the location of the file I am currently editing as argument.

Ea:

Launch Command Open With Notepad
   ---> notepad.exe "c:/path/to/current/file/someRandomNotScriptFile.randomExstension" -Argument1 -Argument2 - ect
...

In sublime I can bind a key, or launch it from the commandpane (ctrl-shift-P).

This is the build system I use in sublime, it renders my markdown to pdf, by using an external application (pandoc). --> so no need for a plugin …

{
  "cmd": ["C:\\Users\\cwn8400\\AppData\\Local\\Pandoc\\pandoc.exe", "-S", "-s", "-f", "markdown", "-t", "docx", "-o", "$file_base_name.docx", "$file_name"],
  "selector": "text.html.markdown"
}

#6

If the existing options don’t do what you want, it should be easy enough to code a function in init.coffee that does this. Atom has all of Node’s capabilities, including the ability to spawn a new process.

This is the build system I use in sublime, it renders my markdown to pdf, by using an external application (pandoc). --> so no need for a plugin …

Well, we have a package for that. You’re also free to invoke pandoc with the BufferedProcess methods, of course.


#7

Pandoc was just an example, its actually an application I have developed myself, its kind-off unwieldy that a plugin needs to be created for every other executable or application we want to launch …

Well I guess that will be the only way to go? --> create a plugin and make use of BufferedProcess methods?

Or can I add a command from within the init file, and make use of the BufferedProcess methods there?

PS: Sorry for all my newb question, and tanks for the time you take to answer them ;), better to make the right choise of where to code it now, then to start coding in the wrong place …


#8

You will be able to do that with process-palette. It’s purpose is to run external application from within Atom and you can use a variety of variables as part of the command to execute, one of which is the current file.


#9

I forgot about process-palette temporarily. Yes, use that.

Most things that a package can do can also be done by the init.coffee file, but launching external executables is not within the realm of standard text editor features, so it’s not included in base Atom.

You also assume that each executable requires a single package, which is untrue. Packages like script, runner, and process-palette have the ability to run a bunch of different executables. More specialized packages like pandoc-convert and gcc-compiler use a specific executable but have interfaces and options customized to that specific task.

Or can I add a command from within the init file, and make use of the BufferedProcess methods there?

You certainly can.


#10

Thanks, this exactly what I was looking for!

@DamnedScholar
Thanks for the extra information, really helpful!