Hi Guys working on a GUI, and taking in from that some text box’es to strings
my scenarios are
If ($from & $Subject is populated and $from does not contain the * character) do X
If (only $from is populated and it does not contain the * character) do Y
If (only $subject is populated and $from is null) do Z
However results are not what i would expect from below
$from = "Text"
$Subject = "text"
#X
if ($from -and $subject -and $from -notmatch "\*")
{
try
{
$listbox1 ="From Field & Subject Field"
}
catch
{
$test = "Something Went Wrong, Please Process Manually"
$listbox1 = $test
}
}
#Y
if ($from -and $from -notmatch "\*" -and $Subject -match "$null")
{
try
{
$listbox1 ="From Field Only"
}
catch
{
$test = "Something Went Wrong, Please Process Manually From Field Only"
$listbox1 = $test
}
#Z
if ($subject -notmatch "$null" -and $from -match "$null")
{
try
{
$listbox1 ="Subject Field Only"
}
catch
{
$test = "Something Went Wrong, Please Process Manually"
$listbox1 = $test
}
}
}
Else
{
$test2 = "Wilcards (*) Cannot Be Used In From Field"
$listbox1 = $test
$listbox1 = $test2
}
cls
$listbox1