Jump to content
Sign in to follow this  
greenfields

copy from webviewer

Recommended Posts

I have a layout with a webviewer and I want users to be able to highlight text within the webviewer which is copied to the clipboard by a script.

The first line of the script is "Copy[]"

This works fine if the script is run from the scripts menu.

I would ideally like the script to be triggered from pressing a button, however when the button is pressed, the webviewer is no longer selected and the highlighted text is lost.

I'm not sure if the button method is possible but thought it would be worth an ask!

ANy help hugely welcome.....

Share this post


Link to post
Share on other sites

Since you just want to allow users to copy to the clipboard, can't you just get them to highlight the text then use 'Copy' from the Edit menu, or Apple-C?

Share this post


Link to post
Share on other sites

In order to script this with a button you would need to...

GetLayoutObjectAttribute ( "webviewername" ; "source" )

...and use a calulation to extract the desired text from the HTML.

For some websites this is easy, others are next to impossible. (Remember this method can be broken by changes to the website.)

If you do a search on the forums on "scraping web pages" you will find a few examples.

Share this post


Link to post
Share on other sites

I agree that you would need those functions to scrape out the text from a web page, but the query was:

I want users to be able to highlight text within the webviewer which is copied to the clipboard by a script

which suggests that the required text is being highlighted manually by the user.

I think we need some feedback on what exactly is required.

Share this post


Link to post
Share on other sites

I'm not sure if the button method is possible but thought it would be worth an ask!

Insert a GoToObject[ObjectName: ] immediately before the Copy[]. Any highlighted text within the web viewer will then be copied to the clipboard.

Share this post


Link to post
Share on other sites

... and with a

Paste [ Select ; YourField ]

you'll have the selected text pasted into YourField.

BTW: any text selection can be dragged from the WebViewer and dropped into the field.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.