May 11, 200916 yr 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.....
May 13, 200916 yr 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?
May 13, 200916 yr 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.
May 13, 200916 yr 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.
May 16, 200916 yr 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.
May 16, 200916 yr ... 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.
Create an account or sign in to comment