This is my code:
Code: Select all
#NoEnv
#SingleInstance force
for n, param in A_Args ; For each parameter:
{
SplitPath, param, name, dir, ext, name_no_ext, drive
Run, %COMSPEC% /k convert %param% -resize 300 "%name_no_ext% optimised.jpg"
}
ExitApp ;<- Exit the app
Return
I want to select many images and resize and optimise them.
imagemagick code needed to do this one file at a time:
convert input.jpg -resize 300 output.jpg
(Works on png files as well.)
My AHK code works OK when run with files that have no spaces.
With space, problem

If I run: mycode.ahk "file name1.jpg" "file name2.png"
It throws errors.
ALSO: I get DOS windows for every file I run on.
How do I stop that popping up?
I also wanted to do:
- I'd like to output to a new folder that is created by AHK, called 'Output'.
- If the folder exists already, delete the file contents first (no need for prompting asking for permission needed).
It's 4.35am and I'm just not thinking straight!

Any help would be great. Thanks.