Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Print screen with win32api
Emil Sandin
3/12/2007 11:12:00 AM
Hi,
I have seen this question on several locations, but no solution to it. I
want to capture the screen on windows xp. I know that you can do it with
rmagick, but that seems to be for unix-systems only, and rubycocoa for
mac. Since there is a "print screen"-button on the keyboard, I guess
that it should be possible to use win32api to fake a klick on the
keyboard button, and then somehow save the image to disk.
Any ideas?
Regards
Emil
--
Posted via
http://www.ruby-...
.
2 Answers
Harry
3/12/2007 11:35:00 AM
0
On 3/12/07, Emil Sandin <esandin@gmail.com> wrote:
> Hi,
> I have seen this question on several locations, but no solution to it. I
> want to capture the screen on windows xp. I know that you can do it with
> rmagick, but that seems to be for unix-systems only, and rubycocoa for
> mac. Since there is a "print screen"-button on the keyboard, I guess
> that it should be possible to use win32api to fake a klick on the
> keyboard button, and then somehow save the image to disk.
>
> Any ideas?
> Regards
> Emil
I haven't tested this particular command but you should be able to do
it with AutoIt.
You can script AutoIt via Ruby.
Here are some commands.
Printscreen is listed.
http://tiger.la.asu.edu/Quick_Ref/AutoIt_qu...
Harry
--
http://www.kakueki.com/ruby...
Japanese Ruby List Subjects in English
Emil Sandin
3/12/2007 12:51:00 PM
0
Daniele Alessandri wrote:
> On 3/12/07, Emil Sandin <esandin@gmail.com> wrote:
>
> mac. Since there is a "print screen"-button on the keyboard, I guess
>> that it should be possible to use win32api to fake a klick on the
>> keyboard button, and then somehow save the image to disk.
>
>
> Try installing Win32::Screenshot (
>
http://rubyforge.org/projects/win32s...
) and launching the
> following
> script:
>
>
> require 'win32screenshot'
>
> width, height, bitmap = Win32::Screenshot.desktop
> File.open('test.bmp', 'wb') { |file| file.write(bitmap) }
>
>
> You can find more examples in the test folder after installing the gem
> file.
Wow, that sounds exactly right, Thank you!
/Emil
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Print screen with win32api
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password