I like to fill in a web form with data from a text file and can't figure out how to do that in Text blaze
Maybe someone can point me in the right direction
example:
content of input text file
Field 1 data
Field 2 data
Field 3 data
The form has 3 fields (moving in between with tab)
so the txt blaze macro would look like this
Field 1 data
{key:tab; trim=yes}
Field 2 data
{key:tab; trim=yes}
Field 3 data
I looked at the import/export function but that is a bit too long winded to use frequently.
Is there a way a snippet (generated by some external script) could be loaded from another snippet?
Thanks for that tip. I had a try but the problem is the dynamic command don't work with the clipboard.
I want to fill in data in a field and then tab to the next and fill in again etc.
The {tab} on the clipboard does not get executed as a tab key on the form.
Or is there a way to make this work?
Actually, you can manipulate the {clipboard} contents in many ways.
Here's an example. I've got the following sample data:
Name: Cedric Debono
Profession: Copywriter
Favorite Hobby: Deep-diving into Text Blaze
Now here's how the snippet would work:
{note}
{line1={=split({clipboard},"\n")[1]}} << splits clipboard contents by line break, picks the first bit and assigns it to the variable line1
{line2={=split({clipboard},"\n")[2]}} << splits clipboard contents by line break, picks the second bit and assigns it to the variable line2
{line3={=split({clipboard},"\n")[3]}} << splits clipboard contents by line break, picks the third bit and assigns it to the variable line3
Thanks for that idea.
But this works only if I have a fixed length of fields (lines) to process.
I would like to have my snippet a bit more flexible to deal with variable number of fields. For my current form it's about 40 fields.
Why doesn't it work to have commands in the clipboard like {key:tab}
All that seems to happen is the text gets pasted as is instead of executed.
It would be easy for me to generate the whole snippet externally and then load it with a {clipboard} command. Of course it would even be easier to load the external file directly.