Chr(9) to move through web fields

Hi all, I have a question.
I have to copy several textfields and then paste them in order in a web form.
I use chr(9) between fields but when I paste into the web it pastes a unique string separated by tabs while i’d like to move to the next field using the tab character.

dim c as new Clipboard
c.Text = campodenominazione.Text+Chr(9)+Chr(9)+CampoCellulare.Text+Chr(9)+Chr(9)+CampoMail.Text+Chr(9)+CampoIndirizzo.Text+Chr(9)+Chr(9)+Chr(9)+CampoCitta.Text+Chr(9)+CampoProvincia.Text+Chr(9)+CampoCap.Text

Could someone help me?
Thank you very much.


From what I understand, the data is located within the Xojo application, you then copy this data to the clipboard, then in a browser paste the data into a web form? If this is the case the issue you are running into is that the clipboard stores string data, not keystrokes. It is the actual act of pressing the tab key on the keyboard that moves the cursor from field to field. I can think of a few ways to accomplish what you are looking for, keep in mind not all of these are practical.
*) If you control the webpage, add a button or menu on-page that will use javascript to read the clipboard data and populate the web fields.
*) Include an HTMLViewer in your project, load the desired web page, and use the HTMLViewer.ExecuteJavaScript method to populate the web fields, bypassing the need for the clipboard all-together.
*) Inject a javascript into the web page (assuming your browser supports it) that will read the clipboard data, and using TAB( chr 9) delimiters write out the data into each web field. This method gets complicated if your input data has any TAB chars in it.
*) Depending on platform, write system calls that will send simulated keystrokes into the browser application to ‘type’ out the data. This one I do not recommend as it can get messy and complicated if your not familiar with the system calls and permission issues that come with simulated keystrokes. I only include it as an example for completeness.

The best choice would be if you control the webpage, but for the time I am going to assume you do not. The method I recommend is the HTMLViewer. You can do direct assignment with the ExecuteJavaScript method, with the prerequisite of knowing the id’s of the web fields.

Example with Google:
Create a project with an HTMLViewer, two buttons, and a TextField. I named the HTMLViewer “htmPage”, and the TextField “txtInput”
Create a method:

Sub SetHTMLPageFieldValue(FieldName As String, Value As String)
End Sub

In the first, load, button use the code


In the second, inject, button use the code


*) Run the Xojo app
*) Press the load button
*) Press the inject button
As I mentioned, you will need the id’s of the web fields in order to do this method. If you need help doing this just let me know what the page is(if its public), and what your browser is.

Hi Chris, you’re very kind to answer my question.
I work in an Italian Apple Service Provider and i’ve made a software to manage all the apple products arriving in our service (iPhone included) to be repaired. We have 1 lab and many shops who sends products to us so I’ve made a software who use a mysql database to collect data and all the shops connect to the database remotely through my software.
The software has a basic interaction with Apple GSX (the site we have to use to check warranties, place parts orders, etc) thanks to an unofficial php API called gsxlib so that when the guys at the reception collects customers informations and write the serial number of the product it queries apple to retrieve warranty status, product configurations, etc.
We also use my software to query apple to retrieve part numbers and prices of parts, based on the serial number of the product.
When us technicians have to order the parts we have to log into gsx and fill all the customers informations. Here I’d like to copy and paste all the fields I already have.
Your idea seems very good.
I’ll try (as soon as I have time) to build an HTML viewer directly into my app and I’ll have a look at the source code of the GSX web pace to look for alle the fields Id.

I’ll let you know.
Thank you very much.


You’re great Chris! It works!