n$ = GetFrontScreen()
Note that in a multitasking environment like AmigaOS, all screens that aren't owned by your application can disappear at any time and their stack order can change as well, so you need to be prepared that at the time this function returns the screen is no longer front or even doesn't exist any more.
ShowScreen("WORKBENCH")
Print(GetFrontScreen())
This is not guaranteed to return "WORKBENCH", although it will normally do so.
See warning above.