For getting target from you UO Client I use a script without attacking the target, so I may target it without the need to show him that!
diferently from you I use the client to call for Injection script using ,exec command.
In UO Client I got a hoteky set with:
NextTarget (or SelectNext ... whatever you have on your client)
Say ",exec mark_target"
In Injection I got:
Wait(100) ; Actually here I use a Ping comand so I'm sure UO client has updated the 'laststatus' info for injection
This is just an example of the process I use, usually I don't use 'lasttarget' because injection changes it's value, so I prefer using 'mytarget' or something like that and checking the value of 'laststatus' before replacing 'mytarget' with empty values or with non human targets