Wolfgang Christoph Mayr, Königswahl von Franz I.