Replies: 1 comment 2 replies
-
Thanks for the suggestion! I am aware of multiline strings this way in PowerShell, and a previous version of ReplaceOSK even used it. My problem with it is that it breaks code formatting since tabs will be interpreted as a literal part of the string, so you can't use them. Depending on the project I can get over it, but in this case I caved to my pet peeve haha. The quotes and newlines were added with regex, so it wasn't really extra work. :) Restart-Tray gets the handle of the taskbar itself so that any open explorer windows aren't closed in the process. I always have multiple windows open across multiple desktops, so it's annoying to me when applications restart explorer rather than just the handle that needs it. Another peeve, I suppose. |
Beta Was this translation helpful? Give feedback.
-
Hey there. You may not be aware of here strings in PowerShell. When defining the variable $src for the .vb file, you concatenate a bunch of strings together with a new line for each. You could simple encapsulate the entire section into a here string i.e.
$src = @'
code
'@
I just thought this might save you some trouble in the future.
https://devblogs.microsoft.com/scripting/maximizing-the-power-of-here-string-in-powershell-for-configuration-data/
Oh and your restart-tray function, get-process explorer | stop-process would do the same thing (explorer is the same process as far as I can tell that the function kills) not that it matters
Beta Was this translation helpful? Give feedback.
All reactions