|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Download websiteI have been asked to update a website. There are about 100 web pages
whose urls I know but it will take a while for me to get ftp access (corporate stuff). Is there a way for me to automate the process in vb 6 of downloading all the pages as well as the images. It would save me a lot of time Hi all.
Lets assume I have a BitMap image and there are 8 bits per pixel, I have my BITMAPINFOHEADER and 1024 bytes of colour info for a 32 X 32 image. Is there a way of getting the 24 bit colour that will be displayed if using the SetDIBitsToDevice Api. I can do it by creating DCs and bitmaps and applying the bits then checking the colour of the Pixel (GetPixel Api), but is there a way of doing this without using the APIs to create pictures and DCs first. Thanks for any pointers for this Ivar Ivar wrote:
> Hi all. The 1024 bytes would be a table that the 8-bit pixel value indexes.> > Lets assume I have a BitMap image and there are 8 bits per pixel, I > have my BITMAPINFOHEADER and 1024 bytes of colour info for a 32 X > 32 image. Is there a way of getting the 24 bit colour that will be > displayed if using the SetDIBitsToDevice Api. I can do it by > creating DCs and bitmaps and applying the bits then checking the > colour of the Pixel (GetPixel Api), but is there a way of doing > this without using the APIs to create pictures and DCs first. > > Thanks for any pointers for this That probably makes the entries 16 bits each, or 5-6-5 color. The system should use those as the high-order bits of an 8-8-8 (24 bit RGB) color. Just speculation though. I'm sure an expert will be along any second. (-: -- Jim <J**@aol.com> wrote in message
news:g8dl055o6q5qka4oe2gfrrsrl6roue82nj@4ax.com... I'm probably missing something, but until you get your hands on the physical> I have been asked to update a website. There are about 100 web pages > whose urls I know but it will take a while for me to get ftp access > (corporate stuff). Is there a way for me to automate the process in > vb 6 of downloading all the pages as well as the images. It would > save me a lot of time > files all you are going to get is "rendered" pages and "rendered" images no matter what tool you use to view or capture them. These files might be useful if there is no server-side scripting going on, but that is hard to believe in this day and age. Once you get physical access to the files there are numerous utilities available to managing "Web Projects". I'd spend my time researching these tools. -ralph "Jim Mack" <jmack@mdxi.nospam.com> schrieb im Newsbeitrag 8Bit per Pixel gives 256 different ColorIndexes (duh...<g>),news:uGyUrYB1JHA.1248@TK2MSFTNGP06.phx.gbl... > The 1024 bytes would be a table that the 8-bit pixel value indexes. > That probably makes the entries 16 bits each, or 5-6-5 color. The > system should use those as the high-order bits of an 8-8-8 (24 bit > RGB) color. which then point into the 256 * 4Bytes (32Bit per Color) Lookup-Table. This 1024 Byte large Lookup-Table is organized in a "plain way" - one Color after the other, so no Channel- splitting here: BGRA|BGRA|BGRA|...etc. and the above BGRA-sequence 256 times. One can read that into a VB-Array with that structure: Type BGRA B as Byte G as Byte R as Byte A as Byte End Type Dim LUT256(0 to 255) As BGRA then Move-Memory from the End of the DIB into LUT256(0) and the Colors are available in the App. Olaf "Ivar" <Ivar.ekstromer***@ntlworld.com> wrote in message Search MSDN Library for "Bitmap Header Types" using the Search tab and by news:KUGOl.48146$i%2.42943@newsfe15.ams2... > Hi all. > > Lets assume I have a BitMap image and there are 8 bits per pixel, I have > my BITMAPINFOHEADER and 1024 bytes of colour info for a 32 X 32 image. > Is there a way of getting the 24 bit colour that will be displayed if > using the SetDIBitsToDevice Api. I can do it by creating DCs and bitmaps > and applying the bits then checking the colour of the Pixel (GetPixel > Api), but is there a way of doing this without using the APIs to create > pictures and DCs first. titles only. "Nobody" <nob***@nobody.com> wrote in message The above doesn't give the file format. For file format, search for "Bitmap news:OcLpgzD1JHA.6132@TK2MSFTNGP04.phx.gbl... > Search MSDN Library for "Bitmap Header Types" using the Search tab and by > titles only. Storage". See this sample, which reads BMP files and manipulate them directly:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3500&lngWId=1 Thanks for the replies so far.
To demo my problem I've put a bit of code below, add a command button on a form and paste the code. The question is: How to know what long colour will windows draw for each bye value Thanks Ivar The Code: Option Explicit Private Declare Function SetDIBitsToDevice Lib "gdi32" _ (ByVal hdc As Long, ByVal X As Long, _ ByVal y As Long, ByVal dx As Long, ByVal dy As Long, _ ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, _ ByVal NumScans As Long, Bits As Any, BitsInfo As Any, _ ByVal wUsage As Long) As Long Private Declare Function GetPixel Lib "gdi32" _ (ByVal hdc As Long, ByVal X As Long, ByVal y As Long) As Long Private Type BITMAPINFOHEADER biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long End Type Private Sub Command1_Click() Dim TheHeader As BITMAPINFOHEADER Dim I As Integer Dim TheBytes(1023) As Byte 'Create a BitMap header With TheHeader ..biClrUsed = 256 ..biBitCount = 8 ..biHeight = 32 ..biWidth = 32 ..biPlanes = 1 ..biSize = 40 End With 'Asign random values for random colours For I = 1 To 1023 TheBytes(I) = Int(225 * Rnd) Next 'How to know what colour (Long) will be drawn without 'the following code Me.ScaleMode = vbPixels Me.AutoRedraw = True SetDIBitsToDevice Me.hdc, 0, 0, _ 32, 32, 0, 0, 0, 32, TheBytes(0), TheHeader, 0& Me.Refresh 'Find long value of colour at top right corner 'The last pixel to be drawn, Byte index 1023 Me.Caption = TheBytes(1023) & " = " & GetPixel(Me.hdc, 0, 31) End Sub "Ivar" <Ivar.ekstromer***@ntlworld.com> schrieb im Newsbeitrag Adjusted your Code somewhat and made some commentsnews:cuPOl.106124$IC1.30086@newsfe06.ams2... > The question is: > How to know what long colour will windows draw for > each bye value inside. '***Into a Form, then click the Form Option Explicit Private Declare Function SetDIBitsToDevice Lib "gdi32" _ (ByVal hdc As Long, ByVal x As Long, _ ByVal y As Long, ByVal dx As Long, ByVal dy As Long, _ ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, _ ByVal NumScans As Long, Bits As Any, BitsInfo As Any, _ ByVal wUsage As Long) As Long Private Declare Function GetPixel Lib "gdi32" _ (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Private Type BGRA B As Byte G As Byte R As Byte A As Byte End Type Private Type BITMAPINFOHEADER_WithPalette biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long Palette(0 To 255) As BGRA End Type Private Sub Form_Click() Dim i As Long, TheHeader As BITMAPINFOHEADER_WithPalette Dim PxlArr(0 To 31, 0 To 31) As Byte 'these are your Pixels(only Indexes) 'Create a BitMap header With TheHeader .biClrUsed = 256 .biBitCount = 8 .biHeight = -32 'DIBs are "bottom-up", a neg. height ensures a flip .biWidth = 32 .biPlanes = 1 .biSize = 40 'Define some Colors, ranging only from black to "pure blue" For i = 0 To 255 With .Palette(i) .B = i End With Next i End With 'since the above was only a Color-Definition, we now have 'to define, which of the 256 different "darkened blue" 'indices we want to choose in our small 32x32 Bitmap Dim x As Long, y As Long For y = 0 To UBound(PxlArr, 2) For x = 0 To UBound(PxlArr, 1) 'let's try something like a "diagonal gradient"... 'but keep in mind, these are only indices, not the colors... 'though - the higher the index, the more blueish it gets PxlArr(x, y) = (x + 1) * (y + 1) / (32 * 32) * 255 Next x Next y 'now draw what we have If Not AutoRedraw Then AutoRedraw = True SetDIBitsToDevice hdc, 0, 0, 32, 32, 0, 0, 0, 32, _ PxlArr(0, 0), TheHeader, 0& Refresh 'How to know what colour (Long) will be drawn...? Dim ColorBottomRightPxl As Long With TheHeader.Palette(PxlArr(31, 31)) 'PxlArr points into the palette ColorBottomRightPxl = RGB(.R, .G, .B) End With 'small test: Caption = Hex(ColorBottomRightPxl) & " " & Hex(GetPixel(hdc, 31, 31)) End Sub Olaf You are correct. All we really want is the content so we can get a
jumpstart on updating the text and images. Layout etc dose not matter right now On Wed, 13 May 2009 07:34:23 -0500, "Ralph" <nt_consultin***@yahoo.com> wrote: Show quoteHide quote > ><J**@aol.com> wrote in message >news:g8dl055o6q5qka4oe2gfrrsrl6roue82nj@4ax.com... >> I have been asked to update a website. There are about 100 web pages >> whose urls I know but it will take a while for me to get ftp access >> (corporate stuff). Is there a way for me to automate the process in >> vb 6 of downloading all the pages as well as the images. It would >> save me a lot of time >> > >I'm probably missing something, but until you get your hands on the physical >files all you are going to get is "rendered" pages and "rendered" images no >matter what tool you use to view or capture them. These files might be >useful if there is no server-side scripting going on, but that is hard to >believe in this day and age. > >Once you get physical access to the files there are numerous utilities >available to managing "Web Projects". I'd spend my time researching these >tools. > >-ralph > > You are correct. All we really want is the content so we can get a First....if the company doesn't have at least> jumpstart on updating the text and images. Layout etc dose not matter > right now > one copy of the site backed up offline then there's something very wrong. But that aside.... Why not just load a page in a browser and save it with all associated files? If you need to work on editing text and updating images then you probably don't need many pages to get started. And downloading it that way would allow you to keep the CSS and image files in a neat package with the page. As Ralph said, you can't really download the site files anyway. If you really need to download more you can use a "download helper" like HTTrack, as Nobody said. There's not much point in writing something like that. But there are caveats, as Ralph pointed out. A lot of sites compile a page server-side. If you're just downloading pages then you may not be getting anything even close to the actual website files. Also, some sites may block things like HTTrack. (On my own site I try to block all "helpers" and "scrapers", and I serve different pages to IE and non-IE. Those are two examples of problems you might run into.) I once tried HTTrack and found that it seemed to fail more often than not. Maybe that's because a lot of sites block it, or maybe it's related to the lack of actual webpage files on sites that are building pages from a database as they're requested. I'm not sure. Answer to offsite etc questions is that I signed to contract but it
takes a few weeks to get users rights etc and I want to jump start the project HTTtrackr did not work because I could not get the cookies to read properly despite moving the cookie to every known place I downloaded a vb program that I modified to save the web pages but I can not rewrite this line of cade ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, to 1- Not prompt user for a file name 2-HAve the default save as Web page and Graphics (seperatley0 Any help s appreciated Show quoteHide quote On Wed, 13 May 2009 09:35:21 -0400, "mayayana" <mayaXXy***@rcXXn.com> wrote: >> You are correct. All we really want is the content so we can get a >> jumpstart on updating the text and images. Layout etc dose not matter >> right now >> > > First....if the company doesn't have at least >one copy of the site backed up offline then >there's something very wrong. > >But that aside.... > > Why not just load a page in a browser and >save it with all associated files? If you need >to work on editing text and updating images >then you probably don't need many pages to >get started. And downloading it that way >would allow you to keep the CSS and image >files in a neat package with the page. As Ralph >said, you can't really download the site files anyway. > > If you really need to download more you can >use a "download helper" like HTTrack, as Nobody >said. There's not much point in writing something >like that. But there are caveats, as Ralph pointed >out. A lot of sites compile a page server-side. >If you're just downloading pages then you may >not be getting anything even close to the actual >website files. Also, some sites may block things >like HTTrack. (On my own site I try to block all >"helpers" and "scrapers", and I serve different pages >to IE and non-IE. Those are two examples of >problems you might run into.) > > I once tried HTTrack and found that it seemed >to fail more often than not. Maybe that's because a >lot of sites block it, or maybe it's related to the lack >of actual webpage files on sites that are building pages >from a database as they're requested. I'm not sure. > It looks like this is what you want, but it's
not as flexible as you'd like. ExecWB is just simple IE automation: http://msdn.microsoft.com/en-us/library/ms683930(VS.85).aspx Show quoteHide quote > I downloaded a vb program that I modified to save the web pages but I > can not rewrite > this line of cade > > ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, > > to > 1- Not prompt user for a file name > 2-HAve the default save as Web page and Graphics (seperatley0 > > Any help s appreciated tried
OLECMDEXECOPT_DONTPROMPTUSER But cannot find where it was saved to Show quoteHide quote On Wed, 13 May 2009 19:12:54 -0400, "mayayana" <mayaXXy***@rcXXn.com> wrote: >It looks like this is what you want, but it's >not as flexible as you'd like. ExecWB is just >simple IE automation: > >http://msdn.microsoft.com/en-us/library/ms683930(VS.85).aspx > >> I downloaded a vb program that I modified to save the web pages but I >> can not rewrite >> this line of cade >> >> ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, >> >> to >> 1- Not prompt user for a file name >> 2-HAve the default save as Web page and Graphics (seperatley0 >> >> Any help s appreciated > > > You could try monitoring it with Filemon, but> OLECMDEXECOPT_DONTPROMPTUSER > > But cannot find where it was saved to it should just be whatever IE defaults to. That method is supposed to be the same as clicking File -> SaveAs in IE, so whatever that FileSave dialogue suggests as the path for saving should be where the file ends up. There are other less clunky ways to download a file, but if you want IE to do it you could also try using a WB control to navigate to the page, then save the content. If I remember correctly, document.body.outerHTML is the most inclusive property. Doing it that way would also provide the option to parse the HTML for CSS files and IMG tags. |
|||||||||||||||||||||||