Hey Devs, take CoolTweak control!
This is a major new feature available since app version 3.2, you can now run custom commands before, after and during processing.
It may be by using a DOS command, a batch script, Powershell, VBScript or any other executable file (exe).
You can extend the power of CoolTweak at will by yourself.
Write your own commands and run them on any file or folder with a single right click, that's the real power of CoolTweak !
A cutom command is an action just like the others for CoolTweak, you can chain them and use the result of the previous command as an input for the next one.
Choose the type of the command to run, its name or the path to the related script file and the parameters to provide it when it is called, that's it.
Global vs file by file commands
There are two ways to run a cutom command, before/after the global processing or during the processing
Before or after the global processing
In this case, the command will be run juste once with the whole list of the files pathes to process.
To enable this type of commande, get to the output options of your menu, select Events tab and check the event which will trigger your command.
In this case, the command will be run on each file to process, provided with the file path as a parameter.
To add this type of command in your processing pipeline, add an action "Custom command" in the action list of your menu.
The parameters given to your command are essential because they provide the path to the file to process and other data about the execution context.
CoolTweak offers a whole set of predefined variables (also known as macros) represented with the {MyVariable} syntax that will be replaced with their real value at runtime, just before running your command.
Click the parameter field of the command to display all the available variables. These variables are diffferent for global or file by file commands.
Global commands variables
{FilePathes} Full pathes of all files to process
{FileCount} The total number of files to be processed
{FileDirectoryPathes} Pathes of all the directories containing the files to process
{FileDirectoryCount} The number of distinct parent directories
{ParamLogFilePath} Log file path (if defined)
{ParamIsAsync} Is the command running asynchronously or not ?
{ParamIsAdminMode} Is the command ran with Administrator privileges ?
{ParamPathDelimiter} The delimiter used to format path in variables
{ParamPathPrefix} The text to add before every file path
{ParamPathSuffix} The text to add after every file path
{ParamPathSeparator} The text to add between two file's pathes
{EngineLabel} Engine label
{EngineVersion} Engine version
File by file commands variables
{FilePath} Current file path
{FileName} Current file name
{FileNameWithoutExtension} Current file name without its extension
{FileNameExtension} Current file extension (ex: .jpg)
{FileDirectoryPath} Path of the directory containing current file
{FileFormat} Current file format
{FileMimeType} Current file mime type
{FileMediaType} Current file category
{FileDefaultExtension} Default extension for current file format (ex: .jpg)
{FileIndex} File index in global processing (0 based)
{FileCount} The total number of files to be processed
{OperationId} Current operation ID
{ParamLogFilePath} Log file path (if defined)
{ParamIsAsync} Is the command running asynchronously or not ?
{ParamIsAdminMode} Is the command ran with Administrator privileges ?
{ParamPathDelimiter} The delimiter used to format path in variables
{OutputFilePath} Final file path (after all processing)
{OutputFileName} Final file name (after all processing)
{OutputFileNameWithoutExtension} Final file name without its extension (after all processing)
{OutputFileNameExtension} Final file extension (after all processing, ex: .jpg)
{OutputFileDirectoryPath} Path of the directory containing the final file (after all processing)
{OriginalFilePath} Original file path
{OriginalFileName} Original file name
{OriginalFileNameWithoutExtension} Original file name without its extension
{OriginalFileNameExtension} Original file extension (ex: .jpg)
{OriginalFileDirectoryPath} Path of the directory containign the original file
{EngineLabel} Engine label
{EngineVersion} Engine version
{ImageWidth} Image width (in pixel)
{ImageHeight} Image height (in pixel)
{ImageHorizontalResolution} Image horizontal resolution (in dpi)
{ImageVerticalResolution} Image vertical resolution (in dpi)
{ImageFrameCount} Image frame count
{ImageMetaAuthors} Image autothors (if available)
{ImageMetaCameraMaker} Camera maker (if available)
{ImageMetaCameraModel} Camera model (if available)
{ImageMetaComment} Image comment (if available)
{ImageMetaCopyright} Image copyright (if available)
{ImageMetaKeywords} Image keywords (if available)
{ImageMetaRating} Image rating (if available)
{ImageMetaSubject} Image subject (if available)
{ImageMetaTitle} Image title (if available)
{ImageMetaExposureTime} Image exposure time (if available)
{ImageMetaFNumber} Image aperture value (if available)
{ImageMetaFocalLength} Image focal length (if available)
{ImageMetaIsoSpeed} Image ISO speed (if available)
{ImageMetaProgramMode} Program mode (if available)
{ImageMetaGpsLatitude} GPS latitude (if available)
{ImageMetaGpsLongitude} GPS Longitude (if available)
For the file by file commands, you can choose if your command alters the processed file contents and then if CooolTweak must reload the file or not before executing the next action to do on the file.
The option "File reloading mode" offfers you 3 possibilities:
Do not reload the file: if your command doesn't change the file contents. CoolTweak won't reload the file after your command ends.
Reload the file from current path: your command modifies the provided file and saves the new version of the file at the same location it was before (overwrite). CoolTweak will reload the file after your command ends at the same location it was before your command actually starts.
Reload another file form a specific path: your command modifies the provided file, saves the new version of the file to another location and returns the corresponding path (not the file content) in the standard output stream. CoolTweak will reload the file after your command ends at the provided location.
You can test very easily your file by file commands to check if they are properly configured with the Test these settings button.
During your developments, you can also trace parameters and outputs in a log file, that's a very convenient way to understand what is happening.
Once your command is working , it is advised to disable this option in order to improve performances.
That's all for this very first introduction of cutom commands, some real life examples will follow soon to complete this document, happy coding untill then :)
Don't hesitate to share your feelings about this new feature to help me improve it.
YannFollow me on twitterCheck my Google+ pageCoolTweak’s creator
Développeurs, prenez le contrôle de CoolTweak !
C'est une nouveauté majeure disponible depuis la version 3.2 du logiciel, il est possible d’exécuter des commandes personnalisées avant, pendant et après les traitements.
Que ce soit par une commande DOS, un script batch, Powershell ou VBScript ou un n'importe quel autre programme, vous pouvez étendre les fonctionnalités de CoolTweak à volonté.
Créez vos propres commandes et lancez les simplement sur n'importe quel fichier ou dossier grâce un simple clic droit, c'est ça la puissance de CoolTweak.
Une commande personnalisée est une action comme les autres pour CoolTweak, vous pouvez les enchainer et utiliser le résultat de la commande précédente pour le transmettre à la suivante.
Choisissez le type de la commande à exécuter, son nom ou le chemin du script correspondant et les paramètres à lui transmettre lors de son appel, c'est tout.
Commandes globales ou par fichier
Il existe deux manières de réaliser une commande personnalisée, soit avant/après les traitements, soit pendant.
Avant ou après les traitements
Dans ce cas la commande sera lancée une seule fois en prenant un paramètre l'ensemble des chemins des fichiers à traiter.
Pour définir une commande de ce type, rendez vous dans les options de sortie de votre menu, onglet événements et sélectionnez l'événement sur lequel devra être déclenchée la commande.
Dans ce cas, la commande sera lancée une fois par fichier à traiter en lui transmettant le chemin du fichier concerné en paramètre
Pour définir une commande de ce type, ajoutez une action du type "Commande personnalisée" dans les actions de votre menu.
Les paramètres transmis à votre commande sont essentiels car ils permettent de lui donner quel fichier elle doit traiter et d'autres informations sur son exécution.
CoolTweak propose tout un lot de variables (aussi appelées macros) prédéfinies dont la syntaxe est du type {MaVariable} et qui seront remplacées par leur valeur réelle juste avant l'appel de la commande.
Cliquez sur le champs des paramètres de la commande pour les afficher toutes, ces variables diffèrent si la commande est globale ou fichier par fichier.
Variables des commandes globales
{FilePathes} Les chemins complets de tous les fichiers à traiter
{FileCount} Le nombre total de fichiers à traiter
{FileDirectoryPathes} Les chemins de tous les les dossiers contenant les fichiers à traiter
{FileDirectoryCount} Le nombre de dossiers parent distincts
{ParamLogFilePath} Chemin de l'éventuel fichier de log (si défini)
{ParamIsAsync} Commande est elle exécutée de manière asynchrone ou pas ?
{ParamIsAdminMode} Commande est elle lancée en mode Administrateur ou pas ?
{ParamPathDelimiter} Le délimiteur utilisé dans les variables de chemin
{ParamPathPrefix} Le texte à ajouter avant chaque chemin de fichier
{ParamPathSuffix} Le texte à ajouter après chaque chemin de fichier
{ParamPathSeparator} Le texte à ajouter entre 2 chemins de fichier
{EngineLabel} Nom du moteur de traitement
{EngineVersion} Version du moteur de traitement
Variables des commandes fichier par fichier
{FilePath} Chemin du fichier courant
{FileName} Nom du fichier courant
{FileNameWithoutExtension} Nom (sans extension) du fichier courant
{FileNameExtension} Extension du fichier courant (ex: .jpg)
{FileDirectoryPath} Dossier contenant le fichier courant
{FileFormat} Format du fichier courant
{FileMimeType} Type mime du fichier courant
{FileMediaType} Catégorie du fichier courant
{FileDefaultExtension} Extension par défaut associée au format du fichier courant (ex: .jpg)
{FileIndex} Indice du fichier dans les traitements (démarre à 0)
{FileCount} Le nombre total de fichiers à traiter
{OperationId} Identifiant de l'opération courante
{ParamLogFilePath} Chemin de l'éventuel fichier de log (si défini)
{ParamIsAsync} Commande est elle exécutée de manière asynchrone ou pas ?
{ParamIsAdminMode} Commande est elle lancée en mode Administrateur ou pas ?
{ParamPathDelimiter} Le délimiteur utilisé dans les variables de chemin
{OutputFilePath} Chemin du fichier final (à la fin des traitements)
{OutputFileName} Nom du fichier final (à la fin des traitements)
{OutputFileNameWithoutExtension} Nom (sans extension) du fichier final (à la fin des traitements)
{OutputFileNameExtension} Extension du fichier final (à la fin des traitements,ex: .jpg)
{OutputFileDirectoryPath} Dossier contenant le fichier final (à la fin des traitements)
{OriginalFilePath} Chemin du fichier original
{OriginalFileName} Nom du fichier original
{OriginalFileNameWithoutExtension} Nom (sans extension) du fichier original
{OriginalFileNameExtension} Extension du fichier original (ex: .jpg)
{OriginalFileDirectoryPath} Dossier contenant le fichier original
{EngineLabel} Nom du moteur de traitement
{EngineVersion} Version du moteur de traitement
{ImageWidth} Largeur de l'image (en pixel)
{ImageHeight} Hauteur de l'image (en pixel)
{ImageHorizontalResolution} Résolution horizontale de l'image (en dpi)
{ImageVerticalResolution} Résolution verticale de l'image (en dpi)
{ImageFrameCount} Nombre de frames de l'image
{ImageMetaAuthors} Auteurs de l'image (si disponible)
{ImageMetaCameraMaker} Fabriquant de l'appareil photo (si disponible)
{ImageMetaCameraModel} Modèle de l'appareil photo (si disponible)
{ImageMetaComment} Commentaire de l'image (si disponible)
{ImageMetaCopyright} Copyright de l'image (si disponible)
{ImageMetaKeywords} Mots clé de l'image (si disponible)
{ImageMetaRating} Note de l'image (si disponible)
{ImageMetaSubject} Sujet de l'image (si disponible)
{ImageMetaTitle} Titre de l'image (si disponible)
{ImageMetaExposureTime} Durée d'exposition de l'image (si disponible)
{ImageMetaFNumber} Ouverture de l'image (si disponible)
{ImageMetaFocalLength} Distance focale de l'image(si disponible)
{ImageMetaIsoSpeed} Sensibilité ISO de l'image(si disponible)
{ImageMetaProgramMode} Programme de l'appareil (si disponible)
{ImageMetaGpsLatitude} Latitude GPS (si disponible)
{ImageMetaGpsLongitude} Longitude GPS (si disponible)
Pour les commandes fichier par fichier, vous pouvez définir si votre commande modifie le contenu du fichier transmis et ainsi si CoolTweak doit prendre en compte ces changements pour les transmettre à la prochaine action ou pas.
L'option "Mode de rechargement du fichier" vous propose 3 options:
Ne pas recharger le fichier: si votre commande ne modifie pas le fichier courant. CoolTweak ne rechargera pas le fichier après l’exécution de la commande.
Recharger le fichier courant: votre commande modifie le fichier transmis et sauve la nouvelle version du fichier au même endroit (écrasement). CoolTweak rechargera le fichier après l’exécution de la commande en se basant sur le chemin du fichier avant l’exécution de la commande.
Recharger depuis un chemin spécifique: votre commande modifie le fichier transmis et le sauve à un autre endroit, et renvoi le chemin complet (attention, pas le contenu) du nouveau fichier dans la sortie standard. CoolTweak rechargera le fichier après l’exécution de la commande en se basant sur le chemin renvoyée par votre commande.
Vous pouvez tester très facilement vos commandes fichier par fichier pour vérifier si elles sont bien paramétrées grâce au bouton tester ces réglages.
Lors de vos développements, il est aussi possible de tracer les paramètres et le statut de l'appel de votre commande dans un fichier de log, c'est très partique pour mieux comprendre ce qui se passe.
Une fois que votre commande fonctionne, il est conseillé de ne plus activer cette option pour gagner en performance.
Voilà pour cette première introduction sur les commandes personnalisées, des exemples concrets d'utilisation vont venir compléter ce document très prochainement, d'ici là, bon code :)
N'hésitez pas a faire des retours sur ces nouvelles fonctionnalités pour qu'elles collent à vos besoins.
Yann Suivez moi sur Twitter Check my Google+ page Créateur de CoolTweak