greenfields Posted May 11, 2009 Posted May 11, 2009 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.....
tv_kid Posted May 13, 2009 Posted May 13, 2009 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?
aholtzapfel Posted May 13, 2009 Posted May 13, 2009 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.
tv_kid Posted May 13, 2009 Posted May 13, 2009 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.
K1200 Posted May 16, 2009 Posted May 16, 2009 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.
Raybaudi Posted May 16, 2009 Posted May 16, 2009 ... 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.
Recommended Posts
This topic is 5681 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now