Jump to content
Sign in to follow this  
MrChiliCheese

RapidShare Collectors-Zone Info

Recommended Posts

MrChiliCheese

Hey guys,

after writing several silent-scripts and automating my whole XP-Installation, i tried a bigger one and here it is ^_^

With this script you can see the collected premium points of your rapidshare collectors accounts... u just have to write the accounts name and password to the config file in the ScriptDir... i hope someone find it useful and i would be happy about some comments ;)

But enough, here is the script

post-38066-1240523603_thumb.jpg

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=image\icon_info.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt ("GUIOnEventMode", 1)

#include <GUIConstantsEx.au3>
#Include <GUIListView.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <ListviewConstants.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#Include <File.au3>

; Check for ini-File and load accounts
If FileExists (@ScriptDir & "\accounts.ini") = 0 Then
    MsgBox(64,"Error",'Config File "accounts.ini" is missing!' & @CRLF & "Example will be created in ScriptDir")
    IniWrite (@ScriptDir & "\accounts.ini", "General", "count", "2")
    IniWrite (@ScriptDir & "\accounts.ini", "Account 001", "name", "account_name_1")
    IniWrite (@ScriptDir & "\accounts.ini", "Account 001", "pass", "account_password_1")
    IniWrite (@ScriptDir & "\accounts.ini", "Account 002", "name", "account_name_2")
    IniWrite (@ScriptDir & "\accounts.ini", "Account 002", "pass", "account_password_2")
    Exit
Else
    $count = IniRead (@ScriptDir & "\accounts.ini", "General", "count", 0)
    If $count < 1 Then
        MsgBox(64,"Error",'Now account-data found or "count = 0"')
        Exit
    EndIf
    dim $accounts[$count+1][2]
    For $a = 1 To IniRead (@ScriptDir & "\accounts.ini", "General", "count", 0)
        If $a < 10 Then 
            $ini_sec =  "Account 00" & $a
        ElseIf $a < 100 Then 
            $ini_sec =  "Account 0" & $a
        Else
            $ini_sec =  "Account " & $a
        EndIf
        $accounts[$a][0] = IniRead (@ScriptDir & "\accounts.ini", $ini_sec, "name", 0)
        $accounts[$a][1] = IniRead (@ScriptDir & "\accounts.ini", $ini_sec, "pass", 0)
    Next
EndIf

; Create GUI
GUICreate("RapidSummary", 266, 216,-1,-1, -1, $WS_EX_TOOLWINDOW)

$open = GUICtrlCreateButton ("Open", 4, 176,61,20)
GUICtrlSetOnEvent ($open, "Button_Open")

$reload = GUICtrlCreateButton ("Reload ", 69, 176,62,20)
GUICtrlSetOnEvent ($reload, "Button_Reload")

$stop = GUICtrlCreateButton ("Stop", 135, 176,62,20)
GUICtrlSetOnEvent ($stop, "Button_Stop")

$exit = GUICtrlCreateButton ("Exit", 201, 176,61,20)
GUICtrlSetOnEvent ($exit, "Button_Exit")

$progress = GUICtrlCreateProgress(4, 201, 256, 10, $PBS_SMOOTH)

;~ Create Listview, set column size, disable remove move-mouse-coursor and make sortable

$listview = GUICtrlCreateListView ("#|Account|Premium|Regular|Total", 5, 5 , 256 , 166,$LVS_SHOWSELALWAYS,$LVS_EX_GRIDLINES+$LVS_EX_FULLROWSELECT)
GUICtrlSetOnEvent ($listview, "Object_Listview")
For $a = 1 To UBound($accounts,1)-1
    GUICtrlCreateListViewItem($a & "|" & $accounts[$a][0], $listview)
Next

_GUICtrlListView_SetColumn($listview, 0, "#", 0, 2)
If UBound($accounts,1)-1 < 10 Then
    _GUICtrlListView_SetColumn($listview, 1, "Account", 87, 2)
Else
    _GUICtrlListView_SetColumn($listview, 1, "Account", 70, 2)
EndIf
_GUICtrlListView_SetColumn($listview, 2, "Premium", 55, 2)
_GUICtrlListView_SetColumn($listview, 3, "Regular", 55, 2)
_GUICtrlListView_SetColumn($listview, 4, "Total", 55, 2)
_GUICtrlListView_RegisterSortCallBack($listview,True,False)
_GUICtrlListView_SetItemSelected($listview, 0,True,True)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")
$listview_header = HWnd(_GUICtrlListView_GetHeader($listview))
$wProcNew = DllCallbackRegister("_HeaderWindowProc", "ptr", "hwnd;uint;wparam;lparam")
$wProcOld = _WinAPI_SetWindowLong($listview_header, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))

GUISetOnEvent ($GUI_EVENT_CLOSE, "_Exit")

;~ iniate state-variables
$load_data_state = 0
$open_state = 0
$reload_state = 0
$stop_state = 0
$exit_state = 0

;~ Show GUI
GUISetState()
Sleep (2500)
While 1
    If $load_data_state = 0 Then
        GUICtrlSetState ($reload, $GUI_DISABLE)
        GUICtrlSetState ($stop, $GUI_ENABLE)
        _LoadAllData ()
        $load_data_state = 1
        GUICtrlSetState ($stop, $GUI_DISABLE)
        GUICtrlSetState ($reload, $GUI_ENABLE)
    EndIf
    _GUI_Reaction(1,1)
WEnd
        
Exit

;~ Advanced GUI Reaction

Func _GUI_Reaction($case_1,$case_2)
    If $open_state = 1 And $case_1 = 1 Then
        _OpenSelected()
        $open_state = 0
    EndIf
    If $reload_state = 1 And $case_2 = 1 Then
        GUICtrlSetState ($reload, $GUI_DISABLE)
        GUICtrlSetState ($stop, $GUI_ENABLE)
        _ReloadSelectedData ()
        $reload_state = 0
        GUICtrlSetState ($stop, $GUI_DISABLE)
        GUICtrlSetState ($reload, $GUI_ENABLE)
    EndIf
    Sleep (10)
    _ReduceMemory(@AutoItPID)
EndFunc

;~ GUI Functions (for buttons/listview)

Func Button_Open()
    If $open_state = 0 Then
        $open_state = 1
    EndIf
EndFunc

Func Button_Reload()
    If $reload_state = 0 Then
        $reload_state = 1
    EndIf
EndFunc

Func Button_Stop()
    If $stop_state = 0 Then
        $stop_state = 1
    EndIf
EndFunc

Func Button_Exit()
    _Exit()
EndFunc

Func Object_Listview()
    _GUICtrlListView_SortItems($listview, GUICtrlGetState($listview))
EndFunc

;~ Reaction on Input

Func _OpenSelected()
    local $selection = _GUICtrlListView_GetSelectedIndices($listview, True)
    ShellExecute ('https://ssl.rapidshare.com/cgi-bin/collectorszone.cgi?username="' & $accounts[_GUICtrlListView_GetItemText($listview, $selection[1])][0] &  '"&password="' & $accounts[_GUICtrlListView_GetItemText($listview, $selection[1])][1])
EndFunc

Func _ReloadSelectedData ()
    Local $coll_data
    local $selection = _GUICtrlListView_GetSelectedIndices($listview, True)
    
    GUICtrlSetData($progress, 0)
    For $a = 1 To $selection[0]
        _GUICtrlListView_SetItemText($listview, $selection[$a], "",2)
        _GUICtrlListView_SetItemText($listview, $selection[$a], "",3)
        _GUICtrlListView_SetItemText($listview, $selection[$a], "",4)
        $coll_data = _GetPoints($accounts[_GUICtrlListView_GetItemText($listview, $selection[$a])][0],$accounts[_GUICtrlListView_GetItemText($listview, $selection[$a])][1])
        _GUICtrlListView_SetItemText($listview, $selection[$a], $coll_data[0],1)
        _GUICtrlListView_SetItemText($listview, $selection[$a], $coll_data[1],2)
        _GUICtrlListView_SetItemText($listview, $selection[$a], $coll_data[2],3)
        _GUICtrlListView_SetItemText($listview, $selection[$a], $coll_data[3],4)
        GUICtrlSetData($progress, ($a/$selection[0])*100)
        If $stop_state = 1 Then 
            GUICtrlSetData($progress, 100)
            $stop_state = 0
            ExitLoop
        EndIf
    Next
EndFunc

Func _LoadAllData ()
    Local $coll_data
    Local $item
    GUICtrlSetData($progress, 0)
    
    For $a = 1 To UBound($accounts,1)-1
        $coll_data = _GetPoints($accounts[$a][0],$accounts[$a][1])
        $item = _GUICtrlListView_FindText($listview, $a)
        _GUICtrlListView_SetItemText($listview, $item, $coll_data[0],1)
        _GUICtrlListView_SetItemText($listview, $item, $coll_data[1],2)
        _GUICtrlListView_SetItemText($listview, $item, $coll_data[2],3)
        _GUICtrlListView_SetItemText($listview, $item, $coll_data[3],4)
        GUICtrlSetData($progress, ($a/(UBound($accounts,1)-1))*100)
        If $stop_state = 1 Then 
            GUICtrlSetData($progress, 100)
            $stop_state = 0
            ExitLoop
        EndIf
    Next
EndFunc

Func _GetPoints($acc,$pass)
    DirCreate (@ScriptDir & "\tmp")
    $wget_pid = Run (@ScriptDir & '\wget.exe --no-check-certificate --output-document=tmp\collector_sum --post-data="username=' & $acc & '&password=' & $pass & '" https://ssl.rapidshare.com/cgi-bin/collectorszone.cgi', @ScriptDir, @SW_HIDE)
    While ProcessExists ($wget_pid)
        _GUI_Reaction (1,0)
        Sleep (10)
    WEnd
    local $source_split, $data[5]
    local $left_string_regular = '                        <td>RapidPoints:</td><td align=right style="padding-right:30px;"><b><span id="rpo">'
    local $right_string_regular = '</span></b></td>'
    local $left_string_premium = '                        <td><a href="java script:alert(' & Chr(39) & 'These points are generated by premium users. You can collect up to 255 RapidPoints per day. Each day the points will be added to your RapidPoints and the counter will be set to 0.' & Chr(39) & ')" style="cursor:help">RapidPoints PU</a>:</td><td align=right style="padding-right:30px;"><b>'
    local $right_string_premium = '</b></td>'
    _FileReadToArray (@ScriptDir & "\tmp\collector_sum", $source_split)
    For $i = 1 To $source_split[0]
        If StringLeft ($source_split[$i],StringLen($left_string_regular)) = $left_string_regular Then
            local $points_regular
            $points_regular = StringReplace(StringReplace($source_split[$i],$left_string_regular, ""), $right_string_regular,"")
        ElseIf StringLeft ($source_split[$i],StringLen($left_string_premium)) = $left_string_premium Then
            local $points_premium
            $points_premium = StringReplace(StringReplace($source_split[$i],$left_string_premium, ""), $right_string_premium,"")
        EndIf
        If IsDeclared ("points_regular") And IsDeclared ("points_premium") Then
            $data[0] = $acc
            $data[1] = $points_premium
            $data[2] = $points_regular
            $data[3] = $points_premium + $points_regular
            $data[4] = 1
            Return $data
        EndIf
    Next
    $data[0] = $acc
    $data[1] = "error"
    $data[2] = "error"
    $data[3] = "error"
    $data[4] = 0
    Return $data
EndFunc

Func _Exit()
    DirRemove(@ScriptDir & "\tmp",1)
    _GUICtrlListView_UnRegisterSortCallBack($listview)
    GUIDelete()
    If $wProcOld Then
        _WinAPI_SetWindowLong(HWnd(_GUICtrlListView_GetHeader($listview)), $GWL_WNDPROC, $wProcOld)
    EndIf
    If $wProcNew Then DllCallbackFree($wProcNew)
    Exit
EndFunc

;~ Other Functions

Func WM_NOTIFY_EVENTS($hWndGUI, $MsgID, $wParam, $lParam)
    Local $HDN_FIRST = -300
    Local $HDN_ITEMCHANGINGA = $HDN_FIRST - 0    
    Local $TagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return
   
    Local $iEvent = DllStructGetData($TagNMHDR, 3)
    If $iEvent = $HDN_ITEMCHANGINGA Or $iEvent = $HDN_ITEMCHANGINGW Then Return 1
   
    Return $GUI_RUNDEFMSG
EndFunc

Func _HeaderWindowProc($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Switch $hWnd
        Case $listview_header
            Switch $iMsg
                Case $WM_SETCURSOR
                    Return 0
            EndSwitch
    EndSwitch
    Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $iMsg, $wParam, $lParam)
EndFunc

Func _ReduceMemory($i_PID = -1)
    If $i_PID <> -1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf
   
    Return $ai_Return[0]
EndFunc

In the attached file you find the script, the icon and wget :(

Greetings from germany,

yetrael

RapidSummary.zip

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.