Jump to content
Sign in to follow this  
thexshadow

HTML Grab String

Recommended Posts

thexshadow

I'm trying to grab a string off of a test site's member's list. I am trying to make it so when I click the Grab button, the user goes into the input box.

This is what I have so far, any ideas?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <INet.au3>
#include <String.au3>
Opt("TrayIconHide", 1)

Global $User

__steam_window('Grabber', 200, 200)


Func __steam_window($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT)
    Local $oWINDOW = GUICreate($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_LAYERED)
    GUISetFont(8, 400, 0, 'Tahoma')
    GUISetBkColor(0x494E49)
    GUICtrlCreatePic('hdr.bmp', 0, 0, $iWINDOW_WIDTH - 16, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 0, 11, 5, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 16, 11, 4, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 5, 0, 5, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateGraphic(0, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic($iWINDOW_WIDTH - 1, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic(0, $iWINDOW_HEIGHT - 1, $iWINDOW_WIDTH, 1)
    GUICtrlSetColor(-1, 0x686A65)
    Local $oCLOSE = GUICtrlCreatePic('cls.bmp', $iWINDOW_WIDTH - 16, 5, 11, 11, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    Local $oLABELHEADER = GUICtrlCreateLabel($sWINDOW_TITLE, 6, 0, $iWINDOW_WIDTH - 22, 20, $SS_CENTERIMAGE)
    GUICtrlSetColor(-1, 0xD8DED3)
    GUICtrlSetBkColor(-1, 0x5A6A50)
    
    
    Local $Grab = GUICtrlCreateButton('Grab!', 30, 150, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')

    
    
    GUICtrlCreateGraphic(10, 51, 180, 1)
    GUICtrlSetColor(-1, 0x636763)
    
    
    GUICtrlCreateLabel('Username:', 20, 60, 100, 20, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlCreateInput($User, 50, 80, 100, 20, 0x0001)

    
    
    GUICtrlCreateGraphic(10, 30, 180, $iWINDOW_HEIGHT - 40)
    GUICtrlSetColor(-1, 0x686A65)
    

    
    GUICtrlCreatePic('cnr.bmp', 0, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', 0, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUISetState(@SW_SHOW)
    While 1
        Local $eMSG = GUIGetMsg()
        Switch $eMSG
            Case $GUI_EVENT_CLOSE
                Local $iWINDOW_TRANS
                For $iWINDOW_TRANS = 255 To 0 Step -3
                    If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                    Sleep(10)
                Next
                Exit
            Case $oCLOSE
                Local $iWINDOW_TRANS
                For $iWINDOW_TRANS = 255 To 0 Step -3
                    If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                    Sleep(10)
                Next
                Exit
            Case $grab
                $User = _StringBetween(_INetGetSource("http://test.com/"), "Username:", "<br />")
                
            
            
        EndSwitch
    WEnd
EndFunc

Share this post


Link to post
Share on other sites
thexshadow

Sorry, you may need the bmp's from this thread.

http://www.autoitscript.com/forum/index.php?showtopic=95043&view=findpost&p=682968

Share this post


Link to post
Share on other sites
thexshadow

Here is the code without the images that are needed. Like I said before, I can't really think of a way to get the user to popup when I click the Grab button.

Any ideas?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <INet.au3>
#include <String.au3>
Opt("TrayIconHide", 1)
Global $User

GUICreate("Grabber", 200, 200, -1, -1)
    GUISetBkColor(0x494E49)
    Local $Grab = GUICtrlCreateButton('Grab!', 30, 150, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlCreateLabel('Username:', 20, 60, 100, 20, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlCreateInput($User, 50, 80, 100, 20, 0x0001)


    GUISetState(@SW_SHOW)
    While 1
        Local $eMSG = GUIGetMsg()
        Switch $eMSG
            Case $GUI_EVENT_CLOSE
                Exit

            Case $grab
                $User = _StringBetween(_INetGetSource("http://test.com/"), "Username:", "<br />")
        EndSwitch
    WEnd

Share this post


Link to post
Share on other sites
jchd

You're misusing your $User variable.

Assign the input box handle to a variable and perform GUICtrlSetData.

$User = GUICtrlCreateInput(-1, 50, 80, 100, 20, 0x0001)

...

Case $grab

Local $str = _StringBetween(_INetGetSource("http://test.com/"), "Username:", "<br />")

GUICtrlSetData($User, $str)


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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.