Page 1 of 1

Pasting the contents of the clipboard into multiple fields

Posted: Fri Jul 09, 2010 9:15 pm
by SirWobbyTheFirst
Hello everyone.

How does Revolution paste your serial number into the five fields when your activating it on the first run. I've been experimenting with the PasteKey message but with little success. I want a way for the user to just directly paste my applications serial number in without having to hilight each section of it, additionally how do you get rev to switch to the next field when the 5 characters of a field have been entered (Chances are this will be a really noob question).

As per se, all help is most appreciated. Thank you.

Re: Pasting the contents of the clipboard into multiple fields

Posted: Fri Jul 09, 2010 9:51 pm
by doc
How does Revolution paste your serial number into the five fields when your activating it on the first run.
Hello,
I've prepared a simple little sample stack that will show at least one way to do it...
Keep in mind that I didn't add any kind of error checking or such, so that part is up to you. :)

http://www.docstoolchest.com/PasteInFields.rev

...and have a look at "focus" in the rev documentation for the other answer you need.

HTH,
-Doc-

Re: Pasting the contents of the clipboard into multiple fields

Posted: Fri Jul 09, 2010 9:54 pm
by SirWobbyTheFirst
Sup, Doc. (I always wanted to say that)

You don't know the kind of face palm I've just done when you mentioned the word Focus because I used it previously to make a Search box become active when the user clicked on the Search menu item in the menu and it's just hit me like a brick wall. :roll:

Re: Pasting the contents of the clipboard into multiple fields

Posted: Fri Jul 09, 2010 10:20 pm
by doc
Heh... that's never happened to me. :wink:

Here's another little bit of code you can substitute for the one I used in the sample stack. Perhaps a bit more elegant:

Code: Select all

on mouseUp
   put the clipboarddata into tRegistration
   repeat with i =  1 to 5
      put char 1 to 4 of tRegistration into fld (("Field") & (i))
      delete char 1 to 4 in tRegistration
   end repeat
   put "" into fld "RegField"
end mouseUp
...although it's quite simple to code as I did in the original example, I didn't exactly intend to recommend it that way. :)
Sure wouldn't be much fun if you had a lot of fields of data to work with....

-Doc-

Re: Pasting the contents of the clipboard into multiple fields

Posted: Fri Jul 09, 2010 10:27 pm
by SirWobbyTheFirst
Well whenever I am writing code, I always try and find ways of minimizing the number of lines in it. Because for some strange reason I think that the lower the number of lines of code the faster the script will operate and I have been this way even when writing Visual Basic, Revolution, even the Batch files for the DOS and the Command Prompt.

I'll have a bash at that script when I fire Rev up tomorrow. So thank you.