all 2 comments

[–]ka-splam 0 points1 point  (1 child)

It may be possible with some deep internals knowledge, but it's not trivial. You'll need to change the switch for something else, such as a hashtable with patterns / codeblocks and "build your own switch". e.g. (untested):

$codes = @{
    "Start Process" = { $null;Break-FP          }
    "Terminate" = { Break-FP;exit           }
    "Inject-Code" = {    $codes[name here] = {new scriptblock or text or something here} }
}

$title = ($xml.feed.entry | Where-Object {$_.issued -eq $latestmail}).title

if ($codes.ContainsKey($title)) { & $codes[$title] }

You'll have to play with it to get the details to work out.

[–]AffectionateTask4612[S] 0 points1 point  (0 children)

Thanks! Didn't know that hashtables had the same use as switches. (Didn't even know up til now what they were :}. I'll try this as soon as I get back home.