Jump to content

RapidQueuer 2.4.4


Datenshi
 Share

Recommended Posts

  • 3 weeks later...
  • Replies 278
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi RomanK, Do you retrieve your IP directly from the ISP DHCP server? cause that could probably be easily implemented, by sending "ipconfig /release" and/or "ipconfig /renew" to CMD. I will probably implement that type of function but im not 100% sure it'll be good for people with very slow DHCP servers and if it'll work with modems(can't debug this type of connection).A non default option should be appropriate. One thing people should think about if they choose to use something like that is, if you're behind a router you'll probably just get a new LAN IP and not a new Public IP. But anyway, ill keep it in mind.

I haven't had much time lately to fix the bugs with 2.2, recently a very close friend of mine died so i haven't really been in the mood to script. I've started fixing some stuff today again tho, but i would like 2.2 to be a reliable release and refrain from releasing it to early.

Edit:

Added above option to 2.2.

Added the option of a soft-stop, basically stop after current download is finished. Pizzi's request

That's what i did yesterday, but a proper changelog will be written when i release 2.2, since there's much more changes.

Edited by Datenshi
Link to comment
Share on other sites

Cant wait for new version ^_^

Not sure if this has been mentioned in this thread, but my ISP has a offpeak time download option. Maybe a schedule start time option would be useful to kick the download off at a certain time?

Cheers

Grant.

CheersGrant

Link to comment
Share on other sites

no, there's no reason for that. RapidQueuer doesn't throttle speed, try to DL manually and compare speed. It could happen that the speed calc is a little bit off..so in reality your speed may be up around 20kb/s at best. Try again without RapidQueuer , write down the average speed then try with Rapidqueuer and compare. Do this just after each other as during peak times Rapidshare lowers bandwidth per connection for everyone.

Btw, i got up to 560kb/s with RapidQueuer which is pretty fast on a Free account ^_^

Edited by Datenshi
Link to comment
Share on other sites

You can run without the progress window and just use tray for info. v2.2 has toggle progress window already. The option in GUI is removed and defaults to minimize to tray without progress window. But easily enabled with tray button.

Link to comment
Share on other sites

very nice code Datenshi

this program is running and What can I do to add new links,new links are added,of start ok ,and then? I want to put add in tray menu,but How to add new links

goog works

this you code

put add in tray menu but

dont add new links

thank you this code

#NoTrayIcon

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_Compression=4

#AutoIt3Wrapper_Res_Fileversion=2.1.1

#AutoIt3Wrapper_Res_LegalCopyright=GPL3

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Include <array.au3>

Opt("TrayMenuMode",1)

Opt("OnExitFunc","closeclean")

FileInstall("design.dat","design.dat");unpacks regular jpg img with rapidshare logo in scriptdir, for gui design

If Not FileExists("LinkList.dat") then

FileWrite("LinkList.dat","")

Endif

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("RapidQueuer 2.1.1", 187, 311, 193, 125)

GUISetBkColor(0xFFFFFF)

$Pic1 = GUICtrlCreatePic("design.dat", 0, 145, 185, 121)

$Buttonstart = GUICtrlCreateButton("Start", 120, 267, 65, 41, 0)

GUICtrlSetTip(-1, "Start Downloading.")

$ButtonNotepad = GUICtrlCreateButton("#", 144, 113, 25, 25, 0)

GUICtrlSetTip(-1, "Opens Notepad with LinkList.dat in RapidQueuer folder."& @CRLF &"If the file doesnt exist choose to create it in Notepad.")

$TextNotepad = GUICtrlCreateLabel("Open LinkList In Notepad", 8, 118, 125, 17)

GUICtrlSetTip(-1, "Opens Notepad with LinkList.dat in RapidQueuer folder."& @CRLF &"If the file doesnt exist choose to create it in Notepad.")

$CheckboxProgWindow = GUICtrlCreateCheckbox("Use Progress Window", 8, 60, 161, 15)

GUICtrlSetTip(-1, "Progress Window will be used during the download process,"& @CRLF &"If unselected, hoover tray icon for information during download.")

GUICtrlSetState($CheckboxProgWindow,$GUI_CHECKED)

$CheckboxClipboard = GUICtrlCreateCheckbox("Monitor Clipboard For Links", 8, 85, 161, 15)

GUICtrlSetTip(-1, "All Clipboard imports are performed before clicking Start"& @CRLF &"so Clipboard monitoring will be turned off during download process.")

$CheckboxShutdown = GUICtrlCreateCheckbox("Shutdown When Done", 8, 35, 161, 15)

GUICtrlSetTip(-1, "Checking this will shutdown computer when all downloads are completed.") ; Credit to Fmen for original idea

$CheckboxOverWrite = GUICtrlCreateCheckbox("Overwrite On Bigger", 8, 10, 161, 15)

GUICtrlSetTip(-1, "If unchecked, Links which filename already exist in download folder, will be skipped."& @CRLF &"Default is overwrite if filesize is larger then existing file.")

GUICtrlSetState($CheckboxOverWrite,$GUI_CHECKED)

$MadeBy = GUICtrlCreateLabel('RapidQueuer'&@CRLF&'by "Datenshi"', 6, 286, 98, 41)

GUICtrlSetFont(-1, 8, 400, 0, "Tahoma")

GuiCtrlSetColor($MadeBy, 0x787878)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

$LastClip = ""

$Errorlinks = 0

Global $BestPing = 100000

Dim $DownloadLinkList

Dim $FinishedDownloads[1]

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $nMsg = BitAND(GUICtrlRead($CheckboxClipboard), $GUI_CHECKED) = $GUI_CHECKED ; Check to see if Clipboard import is activated

$ClipboardFetch = ClipGet()

If StringRegExp($ClipboardFetch, "(http://rapidshare.com/files/\d*/[-a-zA-Z0-9\_\.]*)") AND $LastClip <> $ClipboardFetch Then

$LastClip = $ClipboardFetch

$CollectRapidlinksClipb = StringRegExp($ClipboardFetch,"(http://rapidshare.com/files/\d*/[-a-zA-Z0-9\_\.]*)",3)

$AddClipB = _ArrayToString($CollectRapidlinksClipb,@CRLF)

$AddClipToListQ = MsgBox(4,"Noticed Links","Add The Following To Download List?"&@CRLF&@CRLF&$AddClipB)

If $AddClipToListQ = 6 Then

FileWriteLine("LinkList.dat",$AddClipB)

Endif

Endif

Case $Buttonstart

If BitAND(GUICtrlRead($CheckboxShutdown), $GUI_CHECKED) = $GUI_CHECKED Then ; Check to see if shutdown mode is enabled, if it is ask to confirm, if canceled uncheck and continue

$ShutdownWarningMsg = MsgBox(4,"Warning","Shutdown when done is enabled."&@CRLF&"If you DO NOT wish to automatically shutdown your PC when the downlods complete,choose NO otherwise choose YES to confirm.")

If $ShutdownWarningMsg <> 6 Then

GUICtrlSetState($CheckboxShutdown,$GUI_UNCHECKED)

EndIf

Endif

$Alreadydownloadedcount = CleanLinklist()

If Not @Error Then ; continue if the linklist isnt empty

GUISetState(@SW_HIDE)

TraySetState (1)

$TrayAdd = TrayCreateItem("Add")

$TrayQuit = TrayCreateItem("Quit")

TraySetToolTip("RapidQueuer ")

AdlibEnable("GUIControls",250) ; calls a func to check traymsg, quit button.

If BitAND(GUICtrlRead($CheckboxProgWindow), $GUI_CHECKED) = $GUI_CHECKED Then ; Check if user wants to run with Progress Window, if no dont spawn it.

ProgressOn("Progress Window","Initializing...","",1,1,18)

Endif

_FileReadToArray("LinkList.dat",$DownloadLinkList)

_Arraydelete($DownloadLinkList,0)

If $Alreadydownloadedcount > 0 then

ProgressSet(0,"Skipped: "&$Alreadydownloadedcount&@CRLF&"Files already existing in /download folder.","-")

TraySetToolTip("RapidQueuer " & "Skipped: "&$Alreadydownloadedcount&@CRLF&"Files already existing in /download folder.")

Sleep(5000) ; To make sure people have atleast 5sec to read above progresSet and Tooltip

Endif

For $x = 0 to Ubound($DownloadLinkList) -1

If StringRegExp($DownloadLinkList[$x],"(http://rapidshare.com/files/\d*/[-a-zA-Z0-9\_\.]*)") = 1 Then

If RapidToolsCheck($DownloadLinkList[$x]) = 1 Then

$SubmitRequest = _INetGetSourcePost($DownloadLinkList[$x],"dummy") ; send a dummy post submit, just need source code (saves some space, no need for inet UDF)

$SubmitServer = _StringBetween($SubmitRequest[1],'action="','" method') ; Get submit server from first page

Sleep(2000) ; script was to fast, need to sleep for server to react to earlier finished download.

$SubmitRequest = _INetGetSourcePost($SubmitServer[1],"dl.start=Free") ; Submit Free download request to Submit server

If @Error Then

MsgBox(0,"Failed","Failed to reach link, either it was invalid or you failed to connect to Rapidshare." & @CRLF & $DownloadLinkList[$x] & @CRLF & "Try download it manually.")

Exit

Endif

If StringinStr($SubmitRequest[1],"Or try again in about") Then ; Long forced wait interval of 15min between file downloads.

$MinutesToWait = _StringBetween($SubmitRequest[1],"in about "," minutes.</p>") ; gets exact nr of minutes to wait.

$15mintimer = Timerinit()

$15minPaused = 0

Do

$15minDIFFpause = TimerDiff($15mintimer)

$15minPaused = Int(($15minDIFFpause/1000)/60)

ProgressSet(0,"Sleeptime Left: " & $MinutesToWait[0]-$15minPaused & " min.","Sleeping: "& $MinutesToWait[0]&"min")

TraySetToolTip("RapidQueuer" & @CRLF &"Sleeptime Left: " & $MinutesToWait[0]-$15minPaused & " min.")

Sleep(5000)

Until $15minPaused >= $MinutesToWait[0]

If $15minPaused >= $MinutesToWait[0] Then

$SubmitRequest = _INetGetSourcePost($SubmitServer[1],"dl.start=Free") ; new source request to refrehs it after wait

If @Error Then

MsgBox(0,"Failed","Failed to reach link, either it was invalid or you failed to connect to Rapidshare." & @CRLF & $DownloadLinkList[$x] & @CRLF & "Try download it manually.")

Exit

Endif

Endif

ElseIF StringinStr($SubmitRequest[1],"Currently a lot of users") Then ; Pretty rare event.

MsgBox(0,"To many people","Rapidshare blocked, To many people downloading")

Exit

ElseIf StringinStr($SubmitRequest[1],"Your IP address") Then ; only 1 file at a time, multiple downloads arent possible as free user

MsgBox(0,"Already Downloading","Rapidshare says you're already downloading a file, only 1 download at a time per ip is possible.")

Exit

Endif

$starttime = TimerInit() ; starts timer for the forced countdown of rapidshare

$GetCounterStart = _StringBetween($SubmitRequest[1],"var c=",";") ; Gets the forced countdown starting nr

$DownloadFinalLink = _StringBetween($SubmitRequest[1],"dlf.action=\'","\'") ; gets the actual link to file

$Filename = StringSplit($DownloadFinalLink[0],"/")

$Filename = $Filename[ubound($Filename)-1]

If FileExists("Download\"&$Filename) = 0 OR BitAND(GUICtrlRead($CheckboxOverWrite), $GUI_CHECKED) = $GUI_CHECKED Then ; checks if the file already exist, nessesary cause cleanlist func doesnt check dupe filename

If NOT FileExists(@Scriptdir & "\Download\") Then

DirCreate(@Scriptdir & "\Download\")

Endif

ProgressSet(0,"-","Checking Which Mirror Is Fastest")

TraySetToolTip("RapidQueuer" & @CRLF & "Checking Which Mirror Is Fastest")

$FastestMirror = DeterminFastest() ; simple function, mirror with lowest ping is chosen

$Servername =_StringBetween($FastestMirror,"http://","/") ; Gets the mirror address just for info

Do

$time = Int(TimerDiff($starttime)/1000) ; Do loop until forced countdown is finished

Sleep(1000)

ProgressSet(0,$GetCounterStart[0]-$time & " sec","Sleeping: "&$GetCounterStart[0]&" seconds")

TraySetToolTip("RapidQueuer" & @CRLF & "Sleeping: "&$GetCounterStart[0]&" seconds" & @CRLF & $GetCounterStart[0]-$time & " sec")

Until $time+2 >= $GetCounterStart[0]+2 ; added 2sec to be sure, rapidshare is sensitive

$iSize = InetGetSize($FastestMirror)

If FileExists("Download\"&$Filename) = 1 Then

If $iSize > FileGetSize("Download\"&$Filename) Then

Sleep(2000) ; To make sure the double connection error doesnt trigger upon download.

InetGet($FastestMirror,"Download\"&$Filename,0,1)

While @InetGetActive

$iPercent = Int((@InetGetBytesRead/$iSize)*100)

$SpeedCalc1 = @InetGetBytesRead

Sleep(10000)

$SpeedCalc2 = @InetGetBytesRead

$AveregeSpeed = Int(($SpeedCalc2-$SpeedCalc1)/10240)

If $AveregeSpeed < 0 Then

$AveregeSpeed = 0

Endif ; Stat pulled approx every 10s

$calcKBleft = Int(($iSize-$SpeedCalc2)/1024)

ProgressSet($iPercent,$AveregeSpeed & " kb/s"&" "&Round(($calcKBleft/$AveregeSpeed)/60,0)&" min left"&" Filesize: "& Round($iSize/1048576,1) &"mb"&@CRLF&$iPercent&"% of File Downloaded"&@CRLF&$Servername[0]&" Latency: "&$BestPing&"ms",$Filename)

TraySetToolTip("RapidQueuer" & @CRLF & $Filename & @CRLF & $AveregeSpeed & " kb/s "&$iPercent&"%"&" "&Round(($calcKBleft/$AveregeSpeed)/60,0)&" min left "& Round($iSize/1048576,2) &"mb"&@CRLF&$Servername[0]&" Latency: "&$BestPing&"ms")

WEnd

Else

ProgressSet(0,"Skipped: "&$Filename&@CRLF&" Larger File already existed in /download folder.","-")

TraySetToolTip("RapidQueuer " & "Skipped: "&$Filename&@CRLF&" Larger File already existed in /download folder.")

Endif

Else

Sleep(2000) ; To make sure the double connection error doesnt trigger upon download.

InetGet($FastestMirror,"Download\"&$Filename,0,1)

While @InetGetActive

$iPercent = Int((@InetGetBytesRead/$iSize)*100)

$SpeedCalc1 = @InetGetBytesRead

Sleep(10000)

$SpeedCalc2 = @InetGetBytesRead

$AveregeSpeed = Int(($SpeedCalc2-$SpeedCalc1)/10240)

If $AveregeSpeed < 0 Then

$AveregeSpeed = 0

Endif ; Stat pulled approx every 10s

$calcKBleft = Int(($iSize-$SpeedCalc2)/1024)

ProgressSet($iPercent,$AveregeSpeed & " kb/s"&" "&Round(($calcKBleft/$AveregeSpeed)/60,0)&" min left"&" Filesize: "& Round($iSize/1048576,1) &"mb"&@CRLF&$iPercent&"% of File Downloaded"&@CRLF&$Servername[0]&" Latency: "&$BestPing&"ms",$Filename)

TraySetToolTip("RapidQueuer" & @CRLF & $Filename & @CRLF & $AveregeSpeed & " kb/s "&$iPercent&"%"&" "&Round(($calcKBleft/$AveregeSpeed)/60,0)&" min left"&@CRLF&"Filesize: "& Round($iSize/1048576,2) &"mb"&@CRLF&$Servername[0]&" Latency: "&$BestPing&"ms")

WEnd

Endif

Else

ProgressSet(0,"Skipped: "&$Filename&@CRLF&" Already existed in /download folder.","-")

TraySetToolTip("RapidQueuer " & "Skipped: "&$Filename&@CRLF&" Already existed in /download folder.")

Endif

_ArrayAdd($FinishedDownloads,$x) ; adds element nr to array for deletion upon exit

Sleep(5000)

Else

FileWriteLine("ErrorLinks.dat","["&@YEAR&"/"&@MON&"/"&@MDAY&"]"&"-["&@Hour&":"&@Min&":"&@Sec&"] -- > "&$DownloadLinkList[$x])

_ArrayAdd($FinishedDownloads,$x)

$Errorlinks = 1

EndIf

Endif

Next

AdlibDisable()

ProgressOff()

If BitAND(GUICtrlRead($CheckboxShutdown), $GUI_CHECKED) = $GUI_CHECKED Then

FileDelete("LinkList.dat") ; deletes linklist.dat since all of the links where downloaded

Shutdown(9)

Exit

Else

FileDelete("LinkList.dat")

If $Errorlinks = 1 Then

MsgBox(0,"Finished","RapidQueuer finished, But there where bad links, Errorlinks.dat will be opened to examine.")

Run("Notepad.exe Errorlinks.dat",@Scriptdir)

Exit

Else

MsgBox(0,"Finished","RapidQueuer finished successfully")

Exit

Endif

Endif

Endif

Case $GUI_EVENT_CLOSE

Exit

Case $ButtonNotepad

Run("Notepad.exe LinkList.dat",@Scriptdir)

EndSwitch

Wend

;------------------------------------------

Func GUIControls() ; checks tray for quit msg and runs cleanup upon exit

$traymsg = TrayGetMsg()

Select

Case $traymsg= $TrayAdd

Run("Notepad.exe LinkList.dat",@Scriptdir)

Case $traymsg = $TrayQuit

Exit

EndSelect

EndFunc

;------------------------------------------

Func DeterminFastest() ; gets fastest latency download mirror, rapidshare mirrors trottle speed depending on load, this checks which has the highest possible speed.

$FastestLink = $DownloadFinalLink[1] ; An unknown bug caused this whole func to crash the script. Filling $FasterLink with the first link will prevent "undecalred variable" error.

For $i = 0 to Ubound($DownloadFinalLink) -1

$PingFormat = _StringBetween($DownloadFinalLink[$i],"http://","/")

$PingResult = Ping($PingFormat[0])

sleep(200)

If $PingResult < $BestPing AND $PingResult > 0 Then

$BestPing = $PingResult

$FastestLink = $DownloadFinalLink[$i]

EndIf

Next

Return $FastestLink

Endfunc

;-------------------------------

Func RapidToolsCheck($sPost) ; submit link to rapidlink checker, finds out if the file exist on their servers

Local $Sub ="sub=checkfiles_v1&files="

$raptoolstring = StringRegExp($sPost,"http://rapidshare.com/files/(\d*)/([-a-zA-Z0-9\_\.]*)",3)

$return = _InetGetSource("http://api.rapidshare.com/cgi-bin/rsapi.cgi?"&$Sub&$raptoolstring[0]&"&filenames="&$raptoolstring[1])

If StringInStr($return,"0,0,0,0,0") > 0 Then

Return 0

Else

Return 1

Endif

EndFunc

Func CleanLinklist()

Dim $FinalValidLinkArray[1]

$Alreadydownloadedcount = 0

$LinkListRead = FileRead("LinkList.dat")

$ValidLinkArray = StringRegExp($LinkListRead,"(http://rapidshare.com/files/\d*/[-a-zA-Z0-9\_\.]*)",3)

If @Error Then

MsgBox(0,"Failed","Failed to find any rapidshare links"& @CRLF & "Make sure that you fill LinkList.dat or/and import links from clipboard before pressing Start.")

Run("Notepad.exe LinkList.dat",@Scriptdir)

Return SetError(1)

Endif

For $x = 0 To Ubound($ValidLinkArray) -1

$Filename = StringSplit($ValidLinkArray[$x],"/")

$Filename = $Filename[ubound($Filename)-1]

If StringinStr($Filename,".html") Then

$Filename = StringReplace($Filename,".html","")

Endif

If FileExists("Download\"&$Filename) = 1 AND BitAND(GUICtrlRead($CheckboxOverWrite), $GUI_UNCHECKED) = $GUI_UNCHECKED Then

$Alreadydownloadedcount += 1

Else

_ArrayAdd($FinalValidLinkArray,$ValidLinkArray[$x])

Endif

Next

_FileWriteFromArray("LinkList.dat",$FinalValidLinkArray,1)

Return $Alreadydownloadedcount

EndFunc

;-----------------------------------------------------------------------

Func closeclean() ; runs on exit, save linklist.

For $x = 1 To Ubound($FinishedDownloads) -1

$DownloadLinkList[$FinishedDownloads[$x]] = "" ; replaces already downloaded link with "" its filtered next time clean func is ran

Next

_FileWriteFromArray("LinkList.dat",$DownloadLinkList)

EndFunc

;----------------------------------------------------------------------

Func _FileWriteFromArray($File, $a_Array, $i_Base = 0, $i_UBound = 0)

; Check if we have a valid array as input

If Not IsArray($a_Array) Then Return SetError(2, 0, 0)

; determine last entry

Local $last = UBound($a_Array) - 1

If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last

If $i_Base < 0 Or $i_Base > $last Then $i_Base = 0

; Open output file for overwrite by default, or use input file handle if passed

Local $hFile

If IsString($File) Then

$hFile = FileOpen($File, 2)

Else

$hFile = $File

EndIf

If $hFile = -1 Then Return SetError(1, 0, 0)

; Write array data to file

Local $ErrorSav = 0

For $x = $i_Base To $i_UBound

If FileWrite($hFile, $a_Array[$x] & @CRLF) = 0 Then

$ErrorSav = 3

ExitLoop

EndIf

Next

; Close file only if specified by a string path

If IsString($File) Then FileClose($hFile)

; Return results

If $ErrorSav Then

Return SetError($ErrorSav, 0, 0)

Else

Return 1

EndIf

EndFunc ;==>_FileWriteFromArray

;----------------------------------------------------------------

Func _FileReadToArray($sFilePath, ByRef $aArray)

;==============================================

; Local Constant/Variable Declaration Section

;==============================================

Local $hFile

$hFile = FileOpen($sFilePath, 0)

If $hFile = -1 Then

SetError(1)

Return 0

EndIf

Local $sTemp = FileRead($hFile)

; remove last line separator if any at the end of the file

If StringRight($sTemp, 1) = @LF Then $sTemp = StringTrimRight($sTemp, 1)

If StringRight($sTemp, 1) = @CR Then $sTemp = StringTrimRight($sTemp, 1)

$aArray = StringSplit($sTemp, @CRLF, 1) ; Try Windows @CRLF first

If @error Then $aArray = StringSplit($sTemp, @LF) ; Unix @LF is next most common

If @error Then $aArray = StringSplit($sTemp, @CR) ; Finally try Mac @CR

FileClose($hFile)

Return 1

EndFunc ;==>_FileReadToArray

;----------------------------------------------

Func _StringBetween($sString, $sStart, $sEnd, $vCase = -1, $iSRE = -1)

If $iSRE = -1 Or $iSRE = Default Then

If $vCase = -1 Or $vCase = Default Then

$vCase = 0

Else

$vCase = 1

EndIf

Local $sHold = '', $sSnSStart = '', $sSnSEnd = ''

While StringLen($sString) > 0

$sSnSStart = StringInStr($sString, $sStart, $vCase)

If Not $sSnSStart Then ExitLoop

$sString = StringTrimLeft($sString, ($sSnSStart + StringLen($sStart)) - 1)

$sSnSEnd = StringInStr($sString, $sEnd, $vCase)

If Not $sSnSEnd Then ExitLoop

$sHold &= StringLeft($sString, $sSnSEnd - 1) & Chr(1)

$sString = StringTrimLeft($sString, $sSnSEnd)

WEnd

If Not $sHold Then Return SetError(1, 0, 0)

$sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1))

Local $avArray[uBound($sHold) - 1]

For $iCC = 1 To UBound($sHold) - 1

$avArray[$iCC - 1] = $sHold[$iCC]

Next

Return $avArray

Else

If $vCase = Default Or $vCase = -1 Then

$vCase = '(?i)'

Else

$vCase = ''

EndIf

Local $aArray = StringRegExp($sString, '(?s)' & $vCase & $sStart & '(.*?)' & $sEnd, 3)

If IsArray($aArray) Then Return $aArray

Return SetError(1, 0, 0)

EndIf

EndFunc ;==>_StringBetween Author ........: SmOke_N (Thanks to Valik for helping with the new StringRegExp (?s)(?i) isssue)

;-----------------------------------------

Func _INetGetSourcePost($sURL, $sPost,$Mode = 0) ; Author(s): GtaSpider

Local $iSocket, $sHeader, $sRecv, $iIP, $sHost, $aRegExp, $sHttp1,$iErr,$iSend,$aReturn[2]

If $sURL = '' Or $sPost = '' Then Return SetError(1, 0, 0)

If StringLeft($sURL, 7) <> 'http://' And StringLeft($sURL, 8) <> 'https://' Then $sURL = "http://" & $sURL

If StringRight($sURL, 1) <> "/" Then $sURL &= "/"

$aRegExp = StringRegExp($sURL, "http?://(.*?)/", 3)

If @error Then Return SetError(2, 0, 0)

$sHost = $aRegExp[0]

If $sHost = '' Then Return SetError(3, 0, 0)

$sHttp1 = StringTrimLeft($sURL,StringInStr($sURL,"/",-1,3)-1)

If $sHttp1 = '' Then Return SetError(3, 0, 0)

If $Mode = 0 Then

$sHeader = "POST " & $sHttp1 & " HTTP/1.1" & @CRLF & _

"Host: " & $sHost & @CRLF & _

"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081029 Firefox/2.0.0.18 (.NET CLR 3.5.30729)" & @CRLF & _

"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & @CRLF & _

"Accept-Language: en-us,en;q=0.5" & @CRLF & _

"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF & _

"Keep-Alive: 300" & @CRLF & _

"Referer: "&$DownloadLinkList[$x] & @CRLF & _

"Content-Length: " & StringLen($sPost) & @CRLF & @CRLF & $sPost

ElseIf $Mode = 1 Then

$sHeader = "POST " & $sHttp1 & " HTTP/1.1" & @CRLF & _

"Host: " & $sHost & @CRLF & _

"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.18) Gecko/20081029 Firefox/2.0.0.18 (.NET CLR 3.5.30729)" & @CRLF & _

"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" & @CRLF & _

"Accept-Language: en-us,en;q=0.5" & @CRLF & _

"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" & @CRLF & _

"Keep-Alive: 300" & @CRLF & _

"Referer: "&"http://rapidshare.com/checkfiles.html" & @CRLF & _

"Content-Length: " & StringLen($sPost) & @CRLF & @CRLF & $sPost

Endif

TCPStartup() ;If not already done

$iIP = TCPNameToIP($sHost)

If $iIP = '' Or StringInStr($iIP, ".") = 0 Then Return SetError(4, 0, 0)

$iSocket = TCPConnect($iIP, 80)

If @error Or $iSocket < 0 Then Return SetError(5, 0, 0)

$iSend = TCPSend($iSocket, $sHeader)

If @error Or $iSend < 1 Then Return SetError(6, 0, 0)

While 1

$sRecv = TCPRecv($iSocket, 1024)

$iErr = @error

If $sRecv <> '' Then

While 1

$sRecv &= TCPRecv($iSocket, 1024)

If @error Then ExitLoop 2

WEnd

EndIf

If $iErr Then Return SetError(7,0,0)

WEnd

$aReturn[0] = StringLeft($sRecv,StringInStr($sRecv,@CRLF&@CRLF)-1)

$aReturn[1] = StringTrimLeft($sRecv,StringLen($aReturn[0])+4)

TCPShutdown()

Return $aReturn

EndFunc ;==>_INetGetSourcePost

Func _INetGetSource($s_URL, $s_Header = '')

If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL, 8) <> 'https://' Then $s_URL = 'http://' & $s_URL

Local $h_DLL = DllOpen("wininet.dll")

Local $ai_IRF, $s_Buf = ''

Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0)

If @error Or $ai_IO[0] = 0 Then

DllClose($h_DLL)

SetError(1)

Return ""

EndIf

Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)

If @error Or $ai_IOU[0] = 0 Then

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])

DllClose($h_DLL)

SetError(1)

Return ""

EndIf

Local $v_Struct = DllStructCreate('udword')

DllStructSetData($v_Struct, 1, 1)

While DllStructGetData($v_Struct, 1) <> 0

$ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))

$s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))

WEnd

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])

DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])

DllClose($h_DLL)

Return $s_Buf

EndFunc ;==>_INetGetSource

Edited by mesale0077
Link to comment
Share on other sites

I'm having a hard time understanding you, If you mean that you would like a feature to add new links after you press Start, Then..The problem with that is the code loop only checks the total value of links once, if you increase the "$x" value while in the loop it still think its finished on the initial number.

Link to comment
Share on other sites

this here

$traymsg = TrayGetMsg()

Select

Case $traymsg= $TrayAdd

Run("Notepad.exe LinkList.dat",@Scriptdir)<==== ???******* how is it add new rapid links******

Case $traymsg = $TrayQuit

put add in tray menu and add new rapid links

but new rapid links dont read

Edited by mesale0077
Link to comment
Share on other sites

It doesn't work because

For $x = 0 to Ubound($DownloadLinkList) -1 <- this loop is only checked once. Ubound($DownloadLinkList) will always be the first number. Until you're done. You can not change the number of times its looped so the links you add wont even be found until you restart. Its the design of Rapidqueuer forced by this "limitation" of Autoit For loops.

If anyone knows a workaround i'll be glad to hear about it.

Link to comment
Share on other sites

was bored, check this out. mesale0077

#Include <Array.au3>
Dim $Links[4] = ['Rapidshare.com','Rapidshare.com' ,'Rapidshare.com', 'Rapidshare.com']
    $RealLinks = Ubound($Links) -1
ReDim $Links[$RealLinks+10]; 10 reserved slots for add
    $nradded = 1; keep track of used array slots
        _Arraydisplay($Links)
    For $x = 0 To UBound($Links) -1; ubound return 14 but only 4 real and 10 empty slots
    If $RealLinks+$nradded < $RealLinks+10 then
    $Links[$RealLinks+$nradded] = "Added"
    $nradded += 1
    Endif
                ConsoleWrite($Links[$x]&@CRLF)
    Next
    _Arraydisplay($Links)

check the Scite console, writes out "added" links to the console in the same For Loop. Ofc you'll have to change stuff for it to work with rapidqueuer but the basics are there.

Remember tho, the method you used by adding the links to Linklist.txt isnt a good method tho, cause Rapidqueuer will have to reread the file to see what changed. Better method is to inject the added links directly to the main For Loop running.

Edited by Datenshi
Link to comment
Share on other sites

  • 2 weeks later...

Post for version update:

Changed Progress window Toggable with tray

On/Off the Progress Window with tray, default is OFF

Added very informative Error logging

With 2.2 all errors currently sent out by Rapidshare is supported, and logged to "Errorlog.txt or "criticalerror.txt", the last is only written to if the error causes RapidQueuer to quit(ex. no connection)

Added Error wait for, no slot/IP busy and more

This means, for a couple of errors RapidQueuer will wait and retry until they're gone, For example the "no slots available" or "Your IP is currently downloading" errors.

Added HDD space check

Checks if there's enough space on the HDD for the file to be saved. Pauses script if full.

Added DHCP IP Refresh option

Tries to refresh your IP, this works if you receive an IP directly from your ISP's DHCP server.

Added Proxy support(CERN)

Reads the Regkey containing the Internet explorer proxy settings, the supported proxy servers are limited to CERN based due to AutoIt limitation. Its been tested with SQUID and TOR proxy servers.

Removed online Link validation

This function is no longer necessary and would only cause problems since its an online checker, any invalid or broken links are detected by RapidQueuer offline.

Report any bugs with 2.2 by PM or in this tread. Enjoy!

Edited by Datenshi
Link to comment
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
 Share

  • Recently Browsing   0 members

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