Window focus after Restart

Window which is focused, is unfocused after restart. How to get it focused without a mouse click?

I found something similar in one of my old topics. It may work if top window $[w.id] is stored.

DestroyFunc RestartFunction
AddToFunc RestartFunction
+ I Current InfoStoreAdd WinID $[w.id]
+ I WindowId $[infostore.WinID] Focus