I want to know why command "pm" doesn't activate in PowerSell script?

The following script is a PowerShell script that uses Siril commands to enhance red and blue. the command “split” worked to create files by colors r, g, and b. but the command “pm” didn’t work. I don’t know why! What I can do?

$siril = “C:\Program Files\SiriL\bin\siril-cli.exe”

@"
requires $version
cd …
cd $stackfolder
load $supstack

split r g b

load r
pm “r*2.0”
save r2

load b
pm “b*1.5”
save b1

rgbcomp r2 g b1 -out=rcomp

load rcomp

rmgreen
satu 0.6
autostretch
savejpg $supstack

cd …
close
"@ | & $sirilcliexe -s - >log 2>&1

Hello,

you would probably want to escape the double quotes characters in the expression:

pm "b*1.5"

Would be something like this:

pm \`"b*1.5\`"

Cheers,

Cecile

Thank you for your reply.

But on the Siril command list, “pm” using format is pm “image*1.5”.

I write that. but command “pm” doesn’t work.

the command “pm” using format is
제목 없음

@yw_l Welcome to the forum!

Contents between @" and "@ are interpreted literally. I guess you are trying to pass this string to Siril and Siril is failing to understand it. Quick test in PowerShell:

> 2+2
4

> @"
>> "2+2"
>> "@
"2+2"

> @"
>> 2+2
>> "@
2+2

Have you tried pm r*2.0 (with no quotes)? Sorry, I do not know PowerShell; just guessing.

Thank you for your interest!

I tried the one you mentioned, but it still doesn’t work.

And using format on the Siril manual is 제목 없음

Containing Siril commands in a *.ssf file might be the best approach. That should leave the interpretation to Siril rather than PowerShell.

See: Siril Script Files — Siril 1.4.4 documentation.

Yes, there is the format given in the manual, but then, as you are invoking through powershell, you need to adapt to the constraints of the scripting languageas well…

I see other problems than pm in your snippet, for instance, you define:

$siril = “C:\Program Files\SiriL\bin\siril-cli.exe”

but then invoke:

"@ | & $sirilcliexe -s - >log 2>&1

So sirilcliexe is not defined

You don’t get the version so this line:

requires $version

can’t work either.

And finally, there comes the specific of powershell, it’s actually not the quotes that need escaping but the $ sign.
Just tested this:

$sirilcliexe = "C:\Program Files\SiriL\bin\siril-cli.exe"
$version=($(& $sirilcliexe --version) -split ' ')[-1]
@"
requires $version
cd "$PSScriptRoot"
load toto1
pm "`$toto1`$* 2.0"
save toto2
close
"@ | & $sirilcliexe -s - >log.txt 2>&1

And it works. See the ` character right in front of $, which is the escape character for powershell

Also when you share some code snippet, please enclose them between ``` so that the code is not interpreted as markdown.
Cheers,

Cecile

Thank you for your advice!

As you said, I modify it, so everything works fine.

I appreciate your interest and advice again.