Jump to content

Recommended Posts

Posted

Hi guys,

I've been trying to get the binary data of a bitmap image file which is stored in my PC, i've been looking around and it seems like _ClipBoard_GetData() may be what i am looking for.

The problem is that I can not seem to get it to work, maybe i used it wrong? :ermm:

So here's what I done:

I have a .bmp image on my pc and i copy it

i then run this script

#include <Clipboard.au3>

MsgBox(0, "Example", _ClipBoard_GetData($CF_BITMAP))

but it keeps giving me '0'

Posted

hi XtensionX

instead use the clipboard, I would use FileOpen ($ file, 16) to open the file in binary mode, and FileRead ($ myfile, 1) to read each byte from the file

something like this:

$File = FileOpenDialog('Please choose file', '', 'All files (*.*)', 1)

$myfile = FileOpen($File,16) ; open file in binary mode

FileSetPos($myfile,0,2) ; position "cursor" to last byte in file

$lenoffile = FileGetPos($myfile) ; read actual "cursor" position (last byte in this case)

ConsoleWrite(" - - - - -" & @CRLF & "Dimension of " & $File & " is " & $lenoffile & " bytes" & @CRLF & " - - - - -" & @CRLF & "here are first 320 bytes" & @CRLF & @CRLF)

FileSetPos($myfile,0,0) ; position "cursor" to first byte in file

FileFlush($myfile)

for $x = 1 to 20 ; show first 20 lines (of 16 bytes each)

    for $i = 0 to 15

        $byte = FileRead($myfile,1)  ; read 1 byte (autoincrement position in file)

        ConsoleWrite($byte & " ") ; print out readed byte to consol

    Next ; next byte

    ConsoleWrite(@CRLF)

Next ; next line

Bye

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...