$simagemagickhome = "c:\imagemagick" $simagemagickconv = "$simagemagickhome\convert.exe" $simagemagickargs = @( '--%', '-background transparent', '-fill hsb(0,0,0)', '-font arial', '-pointsize 18', '-size 18x26', '-gravity center') ( $i = 0x01; $i -le 0x05; $i++ ) { $y = [char]$i & $simagemagickconv $simagemagickargs label:$y $scharsdir\$y.png #write-host $simagemagickconv $simagemagickargs label:$y $scharsdir\$y.png } using write-host can example copy paste command line , find run correctly if run single line powershell prompt:
c:\imagemagick\convert.exe --% -background transparent -fill hsb(0,0,0) -font arial -pointsize 18 -size 18x26 -gravity center label:☺ c:\users\erics_000\desktop\output\chars\☺.png using call operator '&' inside script not work @ , leads error messages:
convert.exe: unabletoopenblob `--%': no such file or directory @ error/blob.c/openblob/2697. convert.exe: nodecodedelegateforthisimageformat `' @ error/constitute.c/readimage/501. convert.exe: unrecognizedoption `-background transparent' @ error/convert.c/convertimagecommand/858. the article have been reading is: http://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
thank you...
the following script works me:
$simagemagickhome = "c:\dev\im" $simagemagickconv = "$simagemagickhome\convert.exe" $simagemagickargs = @('-background', 'transparent', '-fill', 'hsb(0,0,0)', '-font', 'arial', '-pointsize', '18', '-size', '18x26', '-gravity', 'center') ( $i = 65; $i -le 67; $i++ ) { $y = [char]$i & $simagemagickconv $simagemagickargs label:$y c:\dev\$y.bmp } note cannot write-host arguments , try running command line, powershell special processing & operator (adds quotes needed), not when pass same arguments write-host.
you'd want install pscx , play around echoargs utility bundled gain better understanding of how arguments passed.
Comments
Post a Comment