Hi,
You could use something like this:
Xrm.Page.ui.navigation.items.get(id of the item).setFocus()
But, you should set it on the load of the form, which implies it always should be done. Regardless of form opened manually or through script.
Iranian Dynamics CRM Association | انجمن متخصصان ایرانی