Remove selection from SearchField

Since DesktopSearchField has no selectedText or SelectionLenght (which I could set it to ‘0’), I would like to prevent text to be selected (after the control gain focus) by simulating the pressure of right arrow.
How can I do this without touching the keyboard (meaning using only code)?
Thanks !

Are you still wishing to allow the user to enter text?

Yes

I’m not sure that’s possible or wise. What if the user is typing and needs to edit an error?

What are your goals here?

The application it is for my own use (so no other users involved).
What I am try to achieve is to overcome a silly glitch in the code.
Let me explain: when I type the very first character in the search field, a code is triggered to open an additional window, which take the focus aways from the search field and thus prevent me to continue typing in the search field.
I had 2 options, either to use the mouse and bring the focus again to the search field, or using a line of code. I opted for this second option, but unfortunately this has a side effect, since it also select the initial character which is present in the search field. So when I type the next character it overwrite the 1st one. That is why I would like to trigger a right arrow.
Is there a way to do it ? Thanks!

If I understand, this is what you want?

https://nözl.de/xc6pe

Quick and dirty, this Code in the KeyDown-Event of the SearchField:

If Me.Text.Length = 0 Then
  Declare Sub orderFront Lib "AppKit" Selector "orderFront:" (NSWindow As Ptr, sender As Ptr) 
  Dim w As New Window1
  w.Visible = False
  Dim p As Ptr = Ptr(w.Handle) 
  orderFront(p, Nil)
End If

I think my attempt to clarify my request generated even more confusion. Sorry!

After a certain operation I do, I end up with the text in the SearchFiles all selected.
I need to remove the selection. This can be done easily if I can simulate the right arrow.

Is there any way to do this via code ?
Or – as alternative – how can I remove the selection in a serchfield (since this control does NOT have the selectionLength property ?

(Thanks a lot @Marius_Dieter_Noetzel for code you sent. Although it does not solve my problem it is very interesting, and I might se for other things !!)

Hmm, why?

this is exactly, what my code does…

You are right ! My apologies.
It does what I need, although in a more cumbersome way that I expected.
But yes, it works !!! Thanks for that !!

I just don’t understand why it is not possible to do something so simple as in AppleScript it takes just few words:
tell application "System Events" to keystroke (ASCII character 29) --right arrow

Thanks again !