Jump to content
Sign in to follow this  
Floppy

Put Captcha on a GUI

Recommended Posts

Floppy

Hi, what I'm trying to create is a program to automatize the registration on a website.

The problem in this website is there's a captcha that should be typed in an inputbox to prevent bots.

My idea is to create a GUI with the captcha image and an inputbox where user should type the captcha.

The registration page is: http://oknotizie.virgilio.it/register.html.php

I tried getting captcha image with _IEImgGetCollection, but it gets the PHP captcha generator script address.

Browsing the forum I found this script that work great.

#include <IE.au3>
#include <Clipboard.au3>
#include <GDIPlus.au3>
#Include <Memory.au3>
$oIE = _IECreate('http://oknotizie.virgilio.it/register.html.php')
$oImg = _IEImgGetCollection($oIE, 0)
$oRange = $oIE.document.Body.CreateControlRange()
$oRange.Add($oImg)
$oRange.ExecCommand('Copy')

$hImage = _ClipBoard_GetData($CF_BITMAP)

_GDIPlus_Startup()
$oBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hImage)
$nHeight = _GDIPlus_ImageGetHeight($oBitmap)
$nWidth = _GDIPlus_ImageGetWidth($oBitmap)
$Gui = GUICreate('IE Image', $nWidth, $nHeight, 250, 250)
GUISetState()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
_GDIPlus_GraphicsDrawImage($hGraphic, $oBitmap, 0, 0)

Sleep(5000)

_GDIPlus_ImageDispose($oBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()

The problem is that puts the image into Clipboard and the previously datas in Clipboard are deleted.

My question is: Is there a different way to get the same captcha showed on the web page? Or, is there a way to not copy the image into Clipboard?

Thanks for help in advance! >_<

Edited by FSoft

Share this post


Link to post
Share on other sites
Floppy

I though at that solution, but the problem is: "If in that moment the user paste to Clipboard...?"

Is there a way to don't put the image into Clipboard?

Share this post


Link to post
Share on other sites
BrettF
Floppy

I've the same problem of my solution.

It downloads the php script and not the image.

Any solution?

Share this post


Link to post
Share on other sites
Floppy

Yes, but think if the user in that moment copy or paste something!?! All fails...

The thing I don't understand is: Why is needed to put the image to Clipboard and then pick it again?

Edited by FSoft

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.