I have gone through the FAQ section for the viewer and also searched around, I have not found an answer.
I am looking to take multiple files, files not necessarily belonging to the same folder, and open them in a D8Viewer.
In PowerShell, $Input
is a variable that has three files stored in it:
C:\Temp\Temp1\drawing.jpg
C:\Temp\Temp2\grey.jpg
C:\Temp\Temp3\orange.jpg
When I attempt to open the three files with the opus D8Viewer nothing happens:
D8Viewer $input
I am able to open the D8Viewer with this, but this is only with a single image file:
D8Viewer $input[1]
Oddly enough, when I have a D8Viewer window already open, invoking the following causes it to close:
D8Viewer $input
I have also tried the passing the files as quoted strings to the D8Viewer, nothing opens:
D8Viewer "C:\Temp\Temp1\drawing.jpg", "C:\Temp\Temp2\grey.jpg", "C:\Temp\Temp3\orange.jpg"
Only the following works:
D8Viewer "C:\Temp\Temp1\drawing.jpg"
By the way I tested the same variable against another image viewer, ImageGlass, all three files are opened:
ImageGlass $input
Thaks for any help.
lxp
June 7, 2023, 2:23pm
2
I am afraid you'll need to call a script that grabs the files from $Input
, adds them to a command object, and then runs Show
on them.
1 Like
I see, well I am willing to go down that route then.
Could you explain abit more, so I know where to get started? by a script, do you mean a script that is internal to Opus (written in JScript)? If so, how would such a script get an input from the command line?
I was not aware that internal opus scripts written by users can get external input in real time. If I have understood you correctly, that sounds promissing for many things.
Thanks!
lxp
June 7, 2023, 3:21pm
4
I'd use a temporary file to hand over the list.
In Powershell, get a tmp file name:
$tmpFile = [System.IO.Path]::GetTempFileName()
Write the file list to the tmp file:
$Input | Out-File -FilePath $tmpFile
In Opus, write a script command that gets the tmp file from the command line. Run it from Powershell:
MyOpusShowCommand $tmpFile
In the script, adding the files to the command object is easy:
cmd.AddFilesFromFile(tmpFile);
Then launch the viewer:
cmd.RunCommand('Show');
To make the start a bit easier, you could use a hardcoded tmp file (e.g. C:\Temp\MyInputFileList.txt
) instead of a dynamically generated one.
1 Like
Aha! he speaks Powershell too!
This is very interesting and it seems simple enough. I will get started on it this weekend.
Just to be clear (so that I dont go assuming the wrong things), when you say:
Run it from Powershell
You mean via DopusRT right?
Thanks allot lxp!, this helps allot!
lxp
June 7, 2023, 8:35pm
6
Right! Should have included that
1 Like
Got it! This is an asnwer to allot more things than just the topic at hand. I really appreciate you for sharing it this with me. Thanks.