MScholtes/TechNet-Gallery

Errors with example file

swa72 opened this issue · 6 comments

swa72 commented

I get a bunch of errors with the stock example file. Any idea?

Exception calling "PinWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:1993 char:3
+         [VirtualDesktop.Desktop]::PinWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

File read: C:\Users\swa\Documents\filestarter\files.json
1: notepad Started
<< 4460160 Showing >>
1: notepad Moving window (4460160)
<< 8064464 2296796 >>
2: explorer Waiting for new window class window
<< 8195068 8064464 2296796 >>
<< Found window 8195068 >>
<< 8195068 Showing >>
2: explorer Moving window (8195068)
<< Moving 8195068 to desktop 2 - Games >>
3: outlook Failed to start process outlook! [This command cannot be run due to the error: The system cannot find the file specified.]
<< 396030 395900 69800 135002 10551866 1576320 >>
4: chrome Waiting for new window class window
<< 396030 5639428 395900 69800 135002 10551866 1576320 >>
<< Found window 5639428 >>
<< 5639428 Showing >>
4: chrome Moving window (5639428)
<< Moving 5639428 to desktop 3 - Desktop 3 >>
Exception calling "UnpinWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:2044 char:3
+         [VirtualDesktop.Desktop]::UnpinWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Exception calling "MoveWindow" with "1" argument(s): "Value cannot be null."
At C:\Users\swa\Documents\filestarter\VirtualDesktop.ps1:1735 char:3
+         $Desktop.MoveWindow($Hwnd)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

fin
PS C:\Users\swa\Documents\filestarter>

Hello swa,

what is the "stock example file"? I'm sorry I can't help without any information.

What Windows and Powershell version you are using? Would you please execute $PSVersionTable and post the result.

Greetings

Markus

swa72 commented

Hi,

I was talking about files.json. I'm running W10 Pro, 64bit. Here is the result of the command

PS C:\Users\swa> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Thanks, Stefan

swa72 commented

BTW, outlook is not installed - so that error can be ignored.

Hello swa72,

Windows and Powershell versions are okay.

files.json is not a script but a data file. I still do not know what your script is doing.

The error message lets me guess you are calling something like

Unpin-Window 0

and

Move-Window -Hwnd 0

Or you are trying to access a windows that does not exist (anymore) or is hidden. Maybe you are trying to move a child window?

Greetings

Markus

swa72 commented

Hi Markus,
I have to apologize - I filed the issue in the wrong repo. I was actually using https://github.com/SuperflyJon/FileStarter and got confused with the repos.
Best, Stefan.

OK, SuperflyJon already corrected the issue (I think using the function Get-ConsoleHandle from VirtualDesktop would have been a better choice, but saying that would be too much self-advertising :-) )

Greetings

Markus