Thanks Mathias. I chose #1 and wrote the code:
@var $selected_files[] = GetSourceSelectedFileNames();
@var $all_files[] = GetSourceItems();
@var $same_name_files[];
@var $n;
@var $i;
@var $aux;
@var $aux2;
@var $selected_file_name_no_ext;
for($n = 0; $n < arrayCount($selected_files); $n++)
{
    $selected_file_name_no_ext = PathGetNamePart($selected_files[$n], 1);
    //LogAppInfo($selected_file_name_no_ext);
    for($i = 0; $i < arrayCount($all_files); $i++)
    {
        $aux = $all_files[$i];
        $aux2 = PathGetNamePart($aux, 0);
        //LogAppInfo('is ' + $aux2 + ' equal to ' + $selected_file_name_no_ext + ' ?');
      // For some reason if we compare using == instead of StrIsWildMatchNoCase, it always enters the if
        if (StrIsWildMatchNoCase($aux2, $selected_file_name_no_ext + '.*') == 1)
        {
            //LogAppInfo('equals');
            arrayAdd($same_name_files, $aux2);
        }
    }    
} 

SetSourceSelected($same_name_files, 1);