HTML Clipboard

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

HTML Clipboard

Post by Tester » Thu Jul 16, 2009 9:38 am

I copied a table from a website into the clipboard. When I get the clipboard with

GetClipboard>txtClipboard

all HTML-code is removed. How can I get the Clipboard including the HTML code?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 16, 2009 12:35 pm

1. You can use HTTPRequest and parse the data,

OR

2. When on the web page, use View Source and then copy the table from that window.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Thu Jul 16, 2009 12:42 pm

The source code is too huge to find the right table in it. I have to mark it with the mouse and then copy it to the clipboard.

Some programs like Ultraedit have a "paste special" command where I can paste the clipboard in true HTML to the editor.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 16, 2009 1:24 pm

Are you doing the copy manually or with a script?

In both cases, somehow you are looking for a visual point to locate the beginning of the table. You should be able to translate that reference point into something that can be located in the source file or the HTTPRequest result. You could use Position and/or RegEx commands to locate the beginning of the table and extract it.

Can you provide some links as samples that we can look at to help you?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Thu Jul 16, 2009 1:33 pm

The user should be able to select any table on a webpage by marking it with the mouse. Then the table is copied to the clipboard by pressing CTRL+C.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Jul 16, 2009 2:30 pm

Tester wrote:The user should be able to select any table on a webpage by marking it with the mouse. Then the table is copied to the clipboard by pressing CTRL+C.
Joe User normally wants to copy just what you are getting, the content of the table, not the webpage code that generated it. As Bob suggests, HTTPRequest is the bulletproof way to do this.

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Thu Jul 16, 2009 2:51 pm

I did exactly write what I need. I need the webcode that generates the table that the user has selected.

So leave me alone with your Joe User answers,please! They do not help anybody!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 16, 2009 5:12 pm

And you have been provided with two methods to get it.

We just need some more info to help parse out the correct table from either of those methods.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Thu Jul 16, 2009 5:50 pm

You can take any table on any webpage to try it. Simply mark the whole table with the mouse and try to get the webpage source making the table into Micro Scheduler. My script is waiting for the user to press a button in a dialog when he has finished marking and copying to clipboard.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 16, 2009 7:02 pm

I am confused about what you need for help at this time. It is possible to get a table from a web page using HTTPRequest and then parsing out the table with its source code. But you indicated that more than one table was present, so we need to know how to identify which table should be copied. The web page layout itself may be build with tables, so it is critical to id which "table" you want.

There is no way we can say fo to any web page and copy the source code of any table without being more specific about exactly what you want. For instance, on this page that you are reading, there are at least 26 areas that are identified as tables, but you probably would not want to copy any of them.

If you can provice links/images to specific pages and point out the "tables" tha you want to copy, then we can probably be of more assistance. The definition of a "table" is not clear at this point.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jul 16, 2009 9:09 pm

Tester wrote:I copied a table from a website into the clipboard. When I get the clipboard with

GetClipboard>txtClipboard

all HTML-code is removed. How can I get the Clipboard including the HTML code?
The HTML code was not removed. It was never there.
Tester wrote:You can take any table on any webpage to try it. Simply mark the whole table with the mouse and try to get the webpage source making the table into Micro Scheduler.
What you are seeing on screen with your browser is not HTML. HTML is interpreted by the browser which then displays text and graphics on the screen. If you copy text from the screen you will only ever get the text as it is displayed. You will never acquire the underlying HTML.

If some software you use is capable of performing a "Paste Special" that pastes the HTML code, then I suspect that software is doing what these kind forum posters are suggesting that you do. It is taking the copied screen output and comparing it to the web page source code and then substituting the appropriate source code for the screen text in the clipboard. When you paste, it appears that you copied the source HTML.

Macro Scheduler does not have a built in function for performing this kind of information substitution. A Macro Scheduler script could be written that could perform this kind of task. Several ideas have been presented for methods that could be used for such a script.

Another possibility would be to automate the software that already has this capability.

Hope this is helpful,
Dick

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Fri Jul 17, 2009 3:22 am

As far as I know, the clipboard stores the information in several different formats: HTML source and plain text, in my case.

For example, you can copy some text from Microsoft Word into the clipboard. If you use another Word instance to retrieve the clipboard content, the text from the clipboard is copied in Word format. If you use another Editor that is not capable of understanding the Word format, it is copied in plain text. So the clipboard stores the same information in plain text and in Word format. It depends on the application what is retrieved from the clipboard.

I think that Macro Scheduler is only able to get the plain text from the clipboard and can not access the formatted text (HTML in my case).

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jul 17, 2009 5:35 pm

You are correct. GetClipBoard retrieves only the text format (cf_text).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts