copy text on the screen as text?

A long time ago I wrote a program that copied the screen.
But that produced an image of the screen.

I'm guessing that that is the best one can do but I would like to copy text 
on the screen as text (i.e. as a string)

Do you know if that is possible?

Or maybe, you know why that it is not possible - if so, of course, I'd like 
to know that.

Thanks 


0
Cal
1/20/2010 7:41:23 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

6 Replies
869 Views

Similar Articles

[PageSpeed] 41

  Cal Who wrote:
> A long time ago I wrote a program that copied the screen.
> But that produced an image of the screen.
> 
> I'm guessing that that is the best one can do but I would like to copy text 
> on the screen as text (i.e. as a string)
> 
> Do you know if that is possible?
> 
> Or maybe, you know why that it is not possible - if so, of course, I'd like 
> to know that.
> 
> Thanks 
> 
> 

Hi as a thought you could capture the screen shot as an image as you 
mentioned that you have done before. You could then pass the image 
through an OCR SDK such as http://www.leadtools.com/sdk/ocr/default.htm 
to get the characters from the images.

Hope this helps.

j1mb0jay

#################################################
http://www.dotnethelp.co.uk
0
j1mb0jay
1/20/2010 8:08:33 PM
  Cal Who wrote:
> A long time ago I wrote a program that copied the screen.
> But that produced an image of the screen.
> 
> I'm guessing that that is the best one can do but I would like to copy text 
> on the screen as text (i.e. as a string)
> 
> Do you know if that is possible?

Anything's possible.  :)

After you capture the image, you can use OCR techniques to convert to 
text.  Depending on the target you are actually trying to capture, it's 
even possible you could hack your way into the process and retrieve the 
text data straight from the window or underlying data structures.

The former isn't really even that much of a hack, depending on how much 
you know about the window hierarchy of the process, the specific OS 
version (Vista and Windows 7 have stronger cross-process security), and 
the data you're trying to get, because many windows will just give up 
their text contents when sent a simple window message (e.g. WM_GETTEXT, 
LB_GETTEXT, EM_GETTEXTEX, etc.)

I guess the real question is, why are you trying to do this?  One 
obvious application would be some sort of accessibility assistant.  But 
there are already third-party applications out there to do that.

Actually, speaking of that, Windows does have some kind of accessibility 
hooks that programs like that use.  I don't know anything about the 
specifics, but it's possible you could make progress toward your goal 
using those.

Pete
0
Peter
1/20/2010 8:20:49 PM

j1mb0jay wrote:
>  Cal Who wrote:
>> A long time ago I wrote a program that copied the screen.
>> But that produced an image of the screen.
>>
>> I'm guessing that that is the best one can do but I would like to
>> copy text on the screen as text (i.e. as a string)
>>
>> Do you know if that is possible?
>>
>> Or maybe, you know why that it is not possible - if so, of course,
>> I'd like to know that.
>>
>> Thanks
>>
>>
>
> Hi as a thought you could capture the screen shot as an image as you
> mentioned that you have done before. You could then pass the image
> through an OCR SDK such as
> http://www.leadtools.com/sdk/ocr/default.htm to get the characters
> from the images.
> Hope this helps.
>
> j1mb0jay
>
> #################################################
> http://www.dotnethelp.co.uk

Actually I tried OCR before I posted but the screen resolution is so that 
the image was not good enough.
After your post I changed the screen to 800x600 and tried again.
Used Photoshop to resample to 300 and then the OCR worked great.

Thaks


0
Cal
1/20/2010 9:30:01 PM

Peter Duniho wrote:
>  Cal Who wrote:
>> A long time ago I wrote a program that copied the screen.
>> But that produced an image of the screen.
>>
>> I'm guessing that that is the best one can do but I would like to
>> copy text on the screen as text (i.e. as a string)
>>
>> Do you know if that is possible?
>
> Anything's possible.  :)
>
> After you capture the image, you can use OCR techniques to convert to
> text.  Depending on the target you are actually trying to capture,
> it's even possible you could hack your way into the process and
> retrieve the text data straight from the window or underlying data
> structures.
> The former isn't really even that much of a hack, depending on how
> much you know about the window hierarchy of the process, the specific
> OS version (Vista and Windows 7 have stronger cross-process
> security), and the data you're trying to get, because many windows
> will just give up their text contents when sent a simple window
> message (e.g. WM_GETTEXT, LB_GETTEXT, EM_GETTEXTEX, etc.)
>
> I guess the real question is, why are you trying to do this?  One
> obvious application would be some sort of accessibility assistant. But 
> there are already third-party applications out there to do that.
>
> Actually, speaking of that, Windows does have some kind of
> accessibility hooks that programs like that use.  I don't know
> anything about the specifics, but it's possible you could make
> progress toward your goal using those.
>
> Pete


I may try that just for fun.
Do you think I should try code like we did before managed code came about (I 
still have my Petzold book).
Do people still code the old windows api
If not, can you point me to an example - anything - not necessarily related 
to my original post.

What started this is I did a search for files and wanted to send the result 
list to someone but folders don't allow you to copy the displayed text.

Thanks






0
Cal
1/20/2010 9:38:04 PM
  Cal Who wrote:
> I may try that just for fun.
> Do you think I should try code like we did before managed code came about (I 
> still have my Petzold book).

I'm not aware of support in .NET that would specifically allow that. 
But then, since I'm not familiar at all with the accessibility stuff, 
for all I know that might have .NET support.  For sure, the 
SendMessage() approach would still require the unmanaged API, but of 
course you can use p/invoke to access it from your managed code.

> Do people still code the old windows api

Sure, happens all the time.  In the context of .NET, p/invoke is the 
more common way to do that, but a C++/CLI wrapper is another possible 
approach.  For COM stuff, .NET will even handle most of the heavy 
lifting for you, via COM interop.

There are still lots of programmers out there who don't do anything at 
all with managed code.  It's all the old-school unmanaged Win32 API for 
them (for a small handful of them, they have no choice�for the rest, 
they don't know what they're missing! :) ).

> If not, can you point me to an example - anything - not necessarily related 
> to my original post.

I don't have any examples off the top of my head.

> What started this is I did a search for files and wanted to send the result 
> list to someone but folders don't allow you to copy the displayed text.

Well, for that specific task, I can think of a number of alternatives 
that are FAR superior to trying to scrape text from an Explorer window, 
depending on the exact nature of the search:

   � Use the DIR command
   � Use the FINDSTR command (similar to grep)
   � Write your own file search utility that provides a text export feature

The first two are just regular "user with a command prompt" solutions. 
Just pipe the output to a file if you want to save the output.

Frankly, even if it comes down to needing the third approach, that's 
going to be WAY easier than text scraping.  For an experienced C#/.NET 
developer who has a specific search criteria already in mind, I'd guess 
the basic search logic could be written in 30-60 minutes, with maybe 
another 15-30 minutes to get the output to a text file.  And that's a 
conservative guess; for a relatively simple search, it should take an 
experienced programmer less than 30 minutes to do the whole thing.

For an inexperienced C#/.NET programmer, I suppose it could easily be 
three or four times that long, or even days for a complete newbie that 
has to spend most of their time just researching what APIs are involved 
and how to use them.

But either the screen-scraping (done programmatically�obviously using 
existing tools is much simpler) or direct-to-window/accessibility 
techniques would be MUCH more complicated.  For a programmer for whom it 
would take days to implement the custom search utility approach, it 
could easily take months or a year to accomplish the more complicated 
technique.  :)

Pete
0
Peter
1/20/2010 9:57:25 PM
*  Cal Who wrote, On 20-1-2010 22:38:
> Peter Duniho wrote:
>>   Cal Who wrote:
>>> A long time ago I wrote a program that copied the screen.
>>> But that produced an image of the screen.
>>>
>>> I'm guessing that that is the best one can do but I would like to
>>> copy text on the screen as text (i.e. as a string)
>>>
>>> Do you know if that is possible?
>>
>> Anything's possible.  :)
>>
>> After you capture the image, you can use OCR techniques to convert to
>> text.  Depending on the target you are actually trying to capture,
>> it's even possible you could hack your way into the process and
>> retrieve the text data straight from the window or underlying data
>> structures.
>> The former isn't really even that much of a hack, depending on how
>> much you know about the window hierarchy of the process, the specific
>> OS version (Vista and Windows 7 have stronger cross-process
>> security), and the data you're trying to get, because many windows
>> will just give up their text contents when sent a simple window
>> message (e.g. WM_GETTEXT, LB_GETTEXT, EM_GETTEXTEX, etc.)
>>
>> I guess the real question is, why are you trying to do this?  One
>> obvious application would be some sort of accessibility assistant. But
>> there are already third-party applications out there to do that.
>>
>> Actually, speaking of that, Windows does have some kind of
>> accessibility hooks that programs like that use.  I don't know
>> anything about the specifics, but it's possible you could make
>> progress toward your goal using those.
>
> I may try that just for fun.
> Do you think I should try code like we did before managed code came about (I
> still have my Petzold book).
> Do people still code the old windows api
> If not, can you point me to an example - anything - not necessarily related
> to my original post.
>
> What started this is I did a search for files and wanted to send the result
> list to someone but folders don't allow you to copy the displayed text.

you could try to access Windows Search directly:

http://dedjo.blogspot.com/2007/08/how-to-use-windows-vista-search-api.html

http://msdn.microsoft.com/en-us/library/ee872109%28VS.85%29.aspx

-- 
Jesse Houwing
jesse.houwing at sogeti.nl
0
Jesse
1/20/2010 10:05:13 PM
Reply:

Similar Artilces:

DVD Copy Pro for Mac
[b]DVD Copy Pro for Mac[/b] is a DVD copy software that can support D9 to D5 compression. With simple operation, it can save DVD in four different ways including directly burning to DVD disc, saving as DVD folder, copying into DVD media format that can be played by DVD Player directly, and converting as ISO file for easy movie management. Now this cool Mac DVD Copy also supports the latest released Snow Leopard. You can download [b][url=http://www.dvd-copy-mac.net/download/dvd-copy-pro-mac.zip]DVD Copy Pro for Mac[/url][/b] freely right now. [b]More information:[/b][quote]http://www.dvd-...

Picture behind text in Cells
Is there any way in which a picture can be sent behind the text in the worksheet cells? Or round the other way, is there any way to show the cells contents in front of a picture? Many thanks Bezza Format\sheet\background should do the trick RES That is a valid command. Unfortunately I've got numerous different images that need to be displayed behind cells. I need to use the cells so that the values displayed infront of the different pictures can be used in forumula's. Bezza That is a valid command. Unfortunately I've got numerous different images that need to be displaye...

Tab , setFocus doesn't hilite the text of the field
Hi, I have many fields that should be filled by the user. I added 2 more and I would like to change the tab order. I don't like using the numbers (after pressing Ctrl D, by clicking the fields I change the order) because I have too many fields and it takes time to do that. So I used the script, in each killFocus function I called setFocus function with the right field. The problem is that this function brings the cursor to the right field BUT it doesn't hilite the value in that field so in order to change this value I have first to hilite it. How can I hilite it by script? Th...

Import/copy calendar in Outlook 2003
I got a new computer and installed Office 2003, and wanted to move my calendar to the new PC. I created a new data file called Personal Folders from Old PC. I wanted to copy my calendar OVER my current one in Personal Folders, but don't see a way to do so. I can copy my old calendar into the Pesonal Folders, but can't delete the new, empty Calendar. So I have Calendar, and Calendar 1 under my Personal Folders. Any way to just import/copy my reminders/appointments into my new calendar? Thanks for any advice. Ck G'Day Cathy, 1. Use the Folder List 2. Click on the OLD Cal...

How to filter text automatically
Hi all, I have a workbook that has infomation imported in from access. the info is as shown session date Amount Due Comments 1 1/1/05 234 11 Good 2 2/2/05 123 7 Not so Good this goe's on for 12 sessions. what I need is for excel to check the session on this worksheet 'Import1' against the 'Main Sheet' cellA1 and which ever one matches then the comment is entered into 'Main Sheet' Cell F62. hope that makes sense. Cheers. Alan In cell F62 of Main Sheet, put this formu...

Copy info from one workbook to another?
I have a problem I have a workbook with the function i want like a discribe here. The problem is i want to split the workbook but i don`t know how. Is it possible to have a main workbook with information from other workbooks at each worksheet? I have 20 workbooks with information. I would like to have a main workbook with on sheet1 every row from the 20workbooks with category1, on sheet2 every row from the 20workbooks with category2, etc, etc. The information in the 20workbooks in always only on sheet. The Colum in which the data is has no fix end. I go to fill in the rows trough a...

Secondary Copy
Hi, My customer using Great Plains modified report(Primary Copy). Now he wants new report something similar to the modified GP report with very few changes. I tried to copy the modified report and planned to use us a secondary copy. But the report has temp tables, so I am unable to make secondary copy. Can some one help me in how to make a new report something similar to the modified report, where to launch it. Whether it is possible throught VBA & Modifier? Regards Selvakumar.S A report with a temporary table can only be a primary copy. This is because only a primary copy can b...

local copy of mail
How do you store a copy of all your mail on you local computer when using Exchange? You setup an OST/Offline Folders file. Check with your mail admin if they support that configuration. "Brandon Baker" <brandon@discussions.microsoft.com> wrote in message news:epNKuJ19FHA.4004@TK2MSFTNGP14.phx.gbl... > How do you store a copy of all your mail on you local computer when using > Exchange? > ...

Text to column and paste special transpose
Hi All, I have 1 table like this item_number qty ref 00010-001 3 U34,U36,U43 00013-001 2 U16,U21 12505-001 3 U32,U33,U42 12512-001 3 U5,U6,U27 and 1 want it to become like this item_number qty ref 00010-001 3 U34 00010-001 3 U36 00010-001 3 U43 00013-001 2 U16 00013-001 2 U21 12505-001 3 U32 12505-001 3 U33 12505-001 3 U42 12512-001 3 U5 12512-001 3 U6 12512-001 3 U27 Anybody can help me to program it in macro.. usually i do it manually and have to redo again do to careless. After using Text to Columns on Column C.......comma delimited.........Run the Reorganize macro. Sub ReOrganize...

Outlook 2000 SP3
How can I copy my mail and calendar to CD so that I can take my received and sent mail history to a new computer with Outlook installed? Thanks. >-----Original Message----- >How can I copy my mail and calendar to CD so that I can >take my received and sent mail history to a new computer >with Outlook installed? Thanks. >. > All your data saves in C:\Documents and Settings\Username\Local Settings\Application Data\Microsoft\Outlook\archive.pst and C:\Documents and Settings\Evgeni\Local Settings\Application Data\Microsoft\Outlook\outlook.pst You can either install instan...

CDaoTableDef
I'm developing an application that uses the MicroSoft Access Jet DB engine. This is being done using C++ in VS.net. I need to change the user's db when they use the new version of the program. In particular I need to change the length of a text field in a pre-existing db without loosing the user's data. When I wanted to add a new field I used CDaoTableDef and it worked fine, but I can't locate a method to just update an existing field's properties. Any Ideas on how this can be done?? Thanks, Neil Neil if you need to alter the attributes of a tabledef object, you ...

Copy picture ossice wizard
I have project 2007 standard edition, but the button is not working at all? Any suggestions Hi, The wizard is IMHO useless. Go to Roport, Copy Picture and do without the Wizard what millions have done before the Wizard existed. HTH -- Jan De Messemaeker Microsoft Project Most Valuable Professional +32 495 300 620 For availability check: http://users.online.be/prom-ade/Calendar.pdf "Enrique" <Enrique@discussions.microsoft.com> wrote in message news:72B5AA6C-67AE-468D-B6AE-FF16F52E57BD@microsoft.com... >I have project 2007 standard edition, but the bu...

Parsing Text When Only One Character Can Be Used To Search
Hello: I've spent a couple of hours looking on this site, and have found some excellent new tips, but still need to ask for assistance. I have a series of text rows containing one string that I need to parse. There are no characters I can use as delimeters (inconsistent), and there is no consistent use of text qualifiers; it's in effect, free form text. Here's a sample record ------------------------------------------------------------------------------------------ FROM per_requisitions_v@appslink req2, per_vacancies@appslink vac2, What I need to pull from this string is --...

Expanding Text Box
One one slide: I need to click on title 1 and have a text box appear...then disappear when I click on title 2...and so on. Without using a macro, how can I achieve this? Thank you. Use Custom Animation to set entrance and exit on mouse click, the exact steps would be somewhat dependent on the version of PP your are using. -- James Bart: "According to creationism, there were no cavemen." Homer: "Good riddance! Their drawings sucked and they looked like hippies." "Gina" <Gina@discussions.microsoft.com> wrote in message news:EA63087D-5125-4...

Copy and paste versus copy and insert copied cells
What is the difference between these commands? Try them, it is pretty easy to see the difference -- Regards, Peo Sjoblom "Alana" <Alana@discussions.microsoft.com> wrote in message news:879FED29-5541-41B0-BB2C-7108D42ED593@microsoft.com... > What is the difference between these commands? ...

subtotal copy and paste
Hi I have used the subtotal option in Excel and this is fine. I have also collasped the list so only the subtotal for each category is visible. However I want to copy and paste this list (just the subtotal) into another sheet When I do this it expands and shows all the results. Is it possible to just copy the visible bit. I have looked in paste special but no luck Cheers Hager On Jan 21, 6:38=A0am, Hager <Ha...@discussions.microsoft.com> wrote: > Hi > > I have used the subtotal option in Excel and this is fine. I have also > collasped the list so only the...

How do I change the text in a workbook from upper to lower case
Hi Please can anyone help with this one! I have a large workbook that I have created (just with text - no formulas) and I have done it in caps but now want to change all the text to lower case without having to re-type it all. Excel hslp is confusing so can anyone tell me how to do it please Thanks Mike Hi see: http://www.cpearson.com/excel/case.htm -- Regards Frank Kabel Frankfurt, Germany mike wrote: > Hi > > Please can anyone help with this one! > > I have a large workbook that I have created (just with text - no > formulas) and I have done it in caps but now...

Copy above fails one way, copy below fails another way
I have a table of blood pressure readings that looks something like this: A B C D E 11 12 Averages: 134 83 74 13 R# Date Sys Dia Pul 14 4 8/17/08 138 87 72 15 3 8/15/08 130 84 76 16 2 8/12/08 137 83 70 17 1 8/11/08 129 79 76 Cell A14 contains =A15+1 Cell C12 contains =AVERAGE(C14:C17) Cell D12 contains =AVERAGE(D14:D17) Cell E12 contains =AVERAGE(E14:E17) Every time I take a new reading, I want to add a row to the top of the table, between row 13 (the header) and row 14 (the previous top row). I want to push a...

Business Portal "Copy to Excel" not working in Query pages
Hi, I am using Business Portal 4.0. When browsing through one of the queries pages in Business Portal, i clicked "Copy to Excel" icon. I got an error saying "The Office Web Components (OWC) must be installed to copy results to Excel." at the bottom. I am using Office 2007 on my machine. I came to know that Microsoft Office Web Components will no longer be shipping in Microsoft Office. I tried installing Office 2003 Add-in: Office Web Components from http://www.microsoft.com/downloads/details.aspx?familyid=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en a...

Copying graphs
Hi Is it possible to range value a graph ie I would like to copy the graph to another workbook, show all the information but without the links? Thanks You could copy the chart as a picture, then paste it wherever you want. Select the chart, hold Shift while clicking on the Edit menu, Choose Copy Picture, and select the On Screen and As Picture options, then go to the other workbook/sheet and Paste. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Dixie" <Dixie@discussions.micr...

Copying Views
Is there any way to copy the views under leads so that i can modify them and create different ones. I need to create 15 views and i do not want to do all of them one at a time. Even if there is a way to do it in sql i would love to know -- IT Manager It can be done in SQL, though it's unsupported. What you want need to do is use INSERT ... SELECT to copy rows in the savedquerybase, and give a different savedqueryid For a supported route you can use the CRM web service and create new instances of savedquery. The following article describes how to do this for the userquery, and coul...

Assign Numeric Value to Text
Hi Everyone, I am looking for a way to assign numberical values to 2 different letters (i.e. A equal to 1, B equal to 2). Then what I am looking to do with this is add up, all the letters in numerical value, in a column and get a total on 1 row and then the average on a 2nd row. Any and all help is greatly appreciated. Happy New Years! :D --- Message posted from http://www.ExcelForum.com/ For a range A1:A100 with just one letter in each cell:- =SUMPRODUCT(CODE(UPPER($A$1:$A$100))-64) -- Regards Ken....................... Microsoft MVP - Excel Sys Spe...

Count text with specific criteria ignoring N/A and blanks
Hello I have a list of survey names in A3:A726 and peoples names in Y3:Y726. Column Y also contains N/A and blanks. I am doing a summary table on the next sheet so I need a formula to show if it is 'SurveyName="Manchester" then count 'Autumn 09'!Y3:Y726 to show it has 42 names listed against it (ignoring N/As) Any help would be greatly appreciated. Many thaks Paula Hi, Try this =sumproduct((sheet1!A3:A726="Manchester")*(sheet1!Y3:Y726<>"N/A")*(sheet1!Y3:Y726<>"")) I have not tried this but it should wo...

Having a go with assembly... how do I copy a double into a register??
I'm trying to speed up a maths routine which consists of much iterative multiplication (and adding and subtraction of ) doubles. Now if I declare my doubles as floats float f double d _asm { mov edx, f //ok mov edx, d //error operand size conflict Can someone show me the error of my ways??? Thanks "Si" <me@you.twang> wrote in message news:sm1gk0l60ng23gilu9b68hkcqi3ub9horn@4ax.com... > > > I'm trying to speed up a maths routine which consists of much > iterative multiplication (and adding and subtraction of ) doubles. > > Now if I de...

EXCEL FILE a copy/a copy/a copy ....filename
when i save my excel file i get a saved copy of the file, not the file itself so my file name of a file i save 7 times can have 7 'a copy' in it eg c./my doc/a copy/a copy/ a copy..............a copy/xx.xls Is the file saved as Read Only? Do you get a message on opening asking you if it's read only? Regards, Alan. "ve" <ve@discussions.microsoft.com> wrote in message news:88C3DEBA-2C2E-4DF0-978B-F823E120458A@microsoft.com... > when i save my excel file i get a saved copy of the file, not the file > itself so my file name of a file i save ...