Clipboard question

Is there anyway to place the contents of a textbox into the clipboard after a radio or checkbox is clicked using acrobat's javascript functions ?
jerrycsakanyjrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karl Heinz KremerCommented:
I don't think so: You don't have access to any selection routines. So even if you would manage to execute the menu item to copy the current selection, you would not have any control over what's actually selected.

What do you want to accomplish? There may be other ways to end up with the same results, but use a different method.
0
jerrycsakanyjrAuthor Commented:
I would like to do something like this... I have 2 text boxes one with a persons name and one with a social security number. If the social security number has a value in it copy it to the clipboard, if the social security number is empty or has a value of  "" then  copy the value of the person's name to the clipboard starting after the first space.
Example
textbox  1 called :  name
textbox 2 called  : social

If  socials.value = null or empty or "" then
copy name.value to clipboard starting after 1st occurance of " "

else copy social.value to clipboard

So i can paste it into a search field in internet explorer which i will do with a CTRL + V


0
Karl Heinz KremerCommented:
Let's assume you have a button that you cant to press in order to copy the contents, you could use something like this:

var social = this.getField("social");
var name = this.getField("name");

if (social.value != "")
    social.setFocus();
else
    name.setFocus();

app.alert("Copy to clipboard");

app.execMenuItem("Copy");
// end of script

... and it will copy either the contents of the social or name field to the clipboard. However, the whole thing stops to work when you take out the alert box. It looks like you need a change of focus from some other window to the PDF document before the copy operation actually works.

Looks like you are out of luck this time (or you need to do the "Copy" operation manually as well and just use the logic in your form to select the correct field to copy from).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

jerrycsakanyjrAuthor Commented:
That worked, but when it set focus it took out the "-" in the social security number . Is there any way to get them back in ?
0
jerrycsakanyjrAuthor Commented:
Nevermind i changed the format to do an arbutrary match instead of using the social security format. I just put in 999-99-9999
Thanks a bunch.
0
Karl Heinz KremerCommented:
I just wanted to tell you that it works for me :-)
0
jerrycsakanyjrAuthor Commented:
Why do u have to use the alert for it to work ?
0
Karl Heinz KremerCommented:
I don't know. When I first tried it without the alert, I was not able to get it to work. It did however work if I did the Ctrl-C manually after the JavaScript selected the field contents. My assumption was that the contents may not be selected at the time Acrobat calls the menu item (e.g. that it only updates the selection after the complete JavaScript is executed), so I added the alert box to see if the field contents were selected. ... and then it worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Acrobat

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.