FontWeight & FontSize aren't respected when using -AsJob

Jul 8, 2011 at 1:45 PM

I was trying Doug's example at http://www.dougfinke.com/blog/index.php/2011/07/07/powershell-clock-with-showui/ and wanted to run it as a job by replacing -Show with -AsJob. However, by doing so, the details around Font Weight and Font Size are lost. The numbers start looking tiny. I have not tried a generic example yet.

Developer
Jul 8, 2011 at 10:56 PM

Thanks Ravi, yup it causes the same problem for me.

Coordinator
Jul 9, 2011 at 3:24 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Developer
Jul 9, 2011 at 11:53 PM

There is a work around, I pulled those parameters out of the hash table, did not splat them and specified them explicitly on the Label.

It works in ISE and fails at the command line.

Doug

Jul 14, 2011 at 12:14 AM
Edited Jul 14, 2011 at 12:15 AM

James Brundage has a video at http://blog.start-automating.com/post/2011/07/12/Six-Steps-for-Writing-ShowUI-Controls.aspx where he says that ShowUI 1.1 creates an automatic variable for everything in $PSBoundParameters.

In Doug's example, if you replace:

$labelAttributes = @{

with:

$PSBoundParameters['labelAttributes'] = @{

It will work when using -AsJob.
Developer
Jul 14, 2011 at 2:02 AM

That's right. I also posted an update to the clock based on that video.

Here is the post and the code.

 

http://www.dougfinke.com/blog/index.php/2011/07/13/updated-hippy-dippy-powershell-clock-with-showui/