cday wrote:m.Th. wrote:From WinXP ages Windows has Visual Basic Script embedded (perhaps I can write something if you wish) and Java Script.
From Win7 onward it has PowerShell - a much more powerful scripting engine.
A need for basic program control actions arises fairly often when using NConvert, and cmd.exe only really seems a good solution if you are already familiar with its criptic notation.
BTW, Windows 10 now has option to install Bash, which is probably a significant improvement on cmd.exe but still probably not a readily accessable way of adding basic control actions without significant prior experience, and in any case it will be a long time before everyone is using Windows 10.
(sorry for the delay)
For Visual Basic Script the things are simple:
You need something like the Run (or Exec) method of a Shell object. See here for the syntax & all: http://ss64.com/vb/run.html
- Code: Select all
Dim oShell ' declare the object (ok, under the hood it allocates a pointer which is, till now, nil
Set oShell = CreateObject("WScript.Shell") ' we actually create it
for i = 0 to 90 step 2
cCmd="nconvert -rotate " & i & "-bgcolor 255 255 255 -out png -clevel 9 -o output\Rotated_" & i & ".png SourceFile.png" 'here we assemble the command
oShell.Run cCmd, 1, True '===== Here is an interesting discussion if we need True or False (True means 'wait for termination' which most probably is needed on an HDD)
Disclaimer: not tested.
Note: Take care to not have spaces in paths. If they appear, then you need to enclose the paths in quotes (")