To add a file to winegold, simply drop a file called "myscript.add.yml"
.
{string} optional The name of the script, display in the Process column.
Example:
name: Convert to mobi
{Object} required One of these condition needed to be true.
fileExtension
{string|Array} File extension. Search each string in the fullpath. Not only the extension.
trigger :
fileExtension:
- pdf
- epub
{Object} optional Run theses commands before cmd
, start cmd after it, and stop if there is an error.
exec
{string} execute a command in a shell.eval
{string} Execute javascript in a node child process.
before:
exec: echo hello
{Object} required Main command, return a green validation if everything
exec
{string} execute a command in a shell.eval
{string} Execute javascript in a node child process.
cmd:
eval: console.log('Really boring and useless string.')
{Object} optional
exec
{string} execute a command in a shell.eval
{string} Execute javascript in window, with aneval()
function. You can edit interface if you want/need.
This example open the link to termbin.com when you have done your process:
name: Ping to termbin
trigger:
fileExtension: ping.txt
cmd:
exec: ping -c 4 google.com | nc termbin.com 9999 > {{file}}
after:
eval: require('electron').shell.openExternal(`{{inside}}`);
autolaunch: true
You can use some tag to insert in your commands. Each key need to be surround by two curly brackets, like {{dir}}
,{{namebase}}
or {{file}}
.
Here is an example of tag you can access from your script :
{
file: '\'/Users/art/Downloads/Downloads/Framasoft-Community.epub\'',
dir: '/Users/art/Downloads/Downloads',
name: 'Framasoft-Community',
ext: '.epub',
namebase: 'Framasoft-Community',
inside: 'Content of your file',
path: '/Users/art/Downloads/Downloads/Framasoft-Community.epub'
}
You can use your own tags inside of you YAML file, like this :
var: beautiful
trigger :
fileExtension:
- txt
cmd:
eval: "console.log(`{{var}}`)"
autolaunch: true
If you use the same keywords inside your YAML, your values will be replaced.
Represent the full path & file from your file, edited to use it as a parameter in a shell.
trigger:
fileExtension: .js
cmd:
exec: node <file>
This example launch node if you drag a js file on the app.