I created a small AHK_L script that runs a specified program on each of the selected files in TC sequentially (like lst2run) but using all available cores. Say you have a quad core and have 200 images to resize using one command. Either you select 50, run the command, select the next 50, run the command, etc., or you select 200 and wait four times longer. With this script you just select them all and run the command.
RunOnAllcores.ahk
Code: Select all
EnvGet, Cores, NUMBER_OF_PROCESSORS
Threads = %Cores%
FileRead, List, %1%
StringSplit, File, List, `n, `r`n
CurFileIndex = 1
Loop, %Threads%
PID%A_Index% = 0
Loop
{
Loop, %Threads%
{
Process, Exist, % PID%A_Index%
IfEqual, ErrorLevel, 0
{
CmdLine = %2%
StringReplace, CmdLine, CmdLine, #####, % File%CurFileIndex%, All
Run, %CmdLine%, , , PID%A_Index%
CurFileIndex++
}
IfEqual, CurFileIndex, %File0%
Break
}
Sleep, 250
} Until CurFileIndex = File0
ExitApp
Pause::Pause
^!#+NumpadSub::
IfNotEqual, Threads, 1
Threads--
Return
^!#+NumpadAdd::
IfNotEqual, Threads, %Cores%
Threads++
Return
Put on a button, hotkey, menu entry or alias, specify:
Code: Select all
%L <your_command_here>
The Pause key pauses the script execution (the running of the commands).
Example:
Code: Select all
Command: RunOnAllCores.ahk
Parameters: %L "C:\Programs\XnView\nconvert.exe -out jpeg -q 80 -v. -opthuff -rexifthumb -rtype lanczos -resize 25%% 25%% -overwrite -keep_icc -dct 2 -keepfiledate #####"
Code: Select all
Run, %CmdLine%, , , PID%A_Index%
Code: Select all
Run, %CmdLine%, , Hide, PID%A_Index%
HTHS
Roman
[EDIT: Version 2, allowing to decrease/increase number of cores used.]