Version=6.1.3.0 ;This needs to be in the 1st line - don't touch! #SingleInstance FORCE #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. Prog_Name = VidRipper Dnlder_Name = VidRipper_Dnl ProxyServerList = |212.113.5.2:80|148.233.159.58:80|202.94.144.73.80 ; GeneralIniFile = %A_ScriptDir%\_Sessions\%Prog_Name%_General.ini ; IniRead, SaveDir2, %GeneralIniFile%, Settings, SaveDir, %A_Space% ; If SaveDir2 ; SaveDir = %SaveDir2% ; If not SaveDir ; SaveDir = %A_Desktop%\VidRipper_SaveDir ;------AutoExec----------------------- ext = ahk If A_IsCompiled ext = exe Installed = 1 IfNotExist,%Dnlder_Name%.%ext% Installed = IfNotExist,down.ico Installed = If not Installed { ;check internet connection NodeName = www.google.com IP__s := HostToIp(NodeName) DllCall("Ws2_32\WSACleanup") ; always inlude this line after calling to release the socket connection if IP__s <> -1 Sleep, 30 ;connected else { MsgBox, Not possible to run %Prog_Name%: No internet connection!`n`nConnect to the internet and try later! Return ;not connected } ;install SRFolder = VidRipper IfNotExist,%SRFolder% { FileCreateDir,%SRFolder% If ErrorLevel { MsgBox, There's a problem creating %SRFolder% folder for the install process. ExitApp } } URLDownloadToFile,http://fures.hu/my_ahk_updates/%Prog_Name%.%ext%,%SRFolder%\%Prog_Name%.%ext% If ErrorLevel { MsgBox, There's a problem with downloading install files. Make sure you have internet connection ad try later. ExitApp } URLDownloadToFile,http://fures.hu/my_ahk_updates/%Dnlder_Name%.%ext%,%SRFolder%\%Dnlder_Name%.%ext% URLDownloadToFile,http://fures.hu/my_ahk_updates/down.ico,%SRFolder%\down.ico URLDownloadToFile,http://fures.hu/my_ahk_updates/error.ico,%SRFolder%\error.ico URLDownloadToFile,http://fures.hu/my_ahk_updates/info.ico,%SRFolder%\info.ico URLDownloadToFile,http://fures.hu/my_ahk_updates/ok.ico,%SRFolder%\ok.ico URLDownloadToFile,http://fures.hu/my_ahk_updates/search.ico,%SRFolder%\search.ico ;delete self and run downloaded self ;the Dir command should take a few seconds - used as a pause thisBATfile = %A_ScriptDir%\upd_this.bat FileDelete, %thisBATfile% FileAppend, ( dir c:\windows\system32 /b del "%A_ScriptDir%\%A_ScriptName%" start "title" "%A_ScriptDir%\%SRFolder%\%A_ScriptName%" dir c:\windows\system32 /b del "%thisBATfile%" ), %thisBATfile% sleep, 3000 Run, %COMSPEC% /c "%thisBATfile%",,hide ExitApp } upd_URL = http://fures.hu/my_ahk_updates/%Prog_Name%.%ext% SilentProgramUpdate = 0 GoSub, CheckUpdate ;Search Page follow vars PVs = Custom|Google|YouTube|AskJolene XXX PV1 = pn=[PageNumber] PV2 = num=10&start=([PageNumber]-1)*10 PV3 = page=[PageNumber] ;PV4 = stq=([PageNumber]-1)*20 ;PV5 = o=([PageNumber]-1)*10 PV4 = pn=[PageNumber] ;Direct Search keywords DSs = YouTube|AskJolene XXX Video DS1 = http://www.youtube.com/results?search_query=[KeyWords]&search_type=&aq=f&uni=1 ;DS2 = http://www.altavista.com/video/results?itag=ody&q=[KeyWords]&mvf=mpeg&mvf=avi&mvf=qt&mvf=msmedia&mvf=realmedia&mvf=flash&mvf=other&mvd=all ;DS3 = http://www.altavista.com/audio/results?itag=ody&q=[KeyWords]&maf=mp3&maf=wav&maf=msmedia&maf=realmedia&maf=aiff&maf=other&mad=all ;DS4 = http://www.alltheweb.com/search?cat=vid&cs=iso88591&rys=0&itag=crv&q=[KeyWords]&ocjp=1 ;DS5 = http://www.alltheweb.com/search?cat=mp3&cs=iso88591&q=[KeyWords]&rys=0&itag=crv DS2 := "http://search.askjolene.com/search?aid=3&sort=date&mgc=1214123489.77&cc=&adv=&qr=[KeyWords]&submit=Ask%21&media=mov&mindate=&maxdate=&sort=date&len=&nummov=" ;Groupped extensions rar_group = .rar Loop, 9 rar_group = %rar_group%,.r0%i% Loop, 90 rar_group = %rar_group%,.r%i% ;defaults Max_Threads = 8 SR_Download_Multi = 1 ;reset counters NumLinks=0 NumRipps=0 NumFiles=0 ;------Make GUI----------------------- Gui, +lastfound +Resize +MinSize w1 := WinExist() Gui, Color, abccdf ;1E889E ;bbdcef Gui, Add, StatusBar,,Not yet started ;Counters SB_SetParts(200,130,130) SB_SetText("`t`t0 links scanned",2) SB_SetText("`t`t0 links followed",3) SB_SetText("`t`t0 files ripped",4) ;Masking rectangle Gui, Add, Text, vMask x340 y15 w300 h20 0x13, %A_Space% Gui, Font, bold ;Gui, Add, Button, x465 y5 w85 h25 gFeedback_Hot_Button, Feedback Gui, Font, ;Tabs Gui, Add, Tab2, Section -Background x15 y15 w620 h580 Choose1 vmyTab AltSubmit, Start && Setup|Ripper Tree|Download Status|--=Feedback=-- Gui, Tab, 2 ;Ripper Tree ImageListID := IL_Create(5) IL_Add(ImageListID, "down.ico") IL_Add(ImageListID, "error.ico") IL_Add(ImageListID, "info.ico") IL_Add(ImageListID, "ok.ico") IL_Add(ImageListID, "search.ico") Gui, Add, CheckBox, xs+20 ys+35 h20 gTree_Submit vTree_Collaps Checked, Auto-collaps tree branches Gui, Add, CheckBox, x+20 y h20 gTree_Submit vTree_Select Checked, Auto-select curren tree-line Gui, Add, TreeView, xs+5 ys+55 w610 h500 AltSubmit vmap gGui_TV_event ImageList%ImageListID%, Menu, MyContextMenu, Add, Copy link to clipboard, Context_Copy Menu, MyContextMenu, Add, Open link in browser, Context_Open Gui, Tab, 3 ;Download Queue Loop, 16 { Gui, Font, bold Gui, Font, s10 Gui, Add, Text, % "xs+5 ys+" A_Index*27 " w20 h22 Right" , %A_Index%. Gui, Font Gui, Add, Button, x+3 yp w48 h20 vDnl_CloseButton%A_Index% gDnl_CloseProc, Close Gui, Add, Progress, x+5 yp+2 w100 +Smooth cBDDCEF vDnl_ProgressBar%A_Index% Gui, Add, Text, x+3 yp h20 w25 vDnl_Speed%A_Index%, Gui, Add, Text, x+1 yp h20 w5 vDnl_Sepa%A_Index%, Gui, Add, Text, x+1 yp h20 w25 vDnl_avgSpeed%A_Index%, Gui, Add, Text, x+3 yp h20 w25 vDnl_Metric%A_Index%, Gui, Add, Text, x+5 yp h27 w340 vDnl_FileName%A_Index%, Gui, Font, bold Gui, Add, Text, w30 xs+85 yp+2 BackgroundTrans vDnl_ProgressN%A_Index%, Gui, Font Gui, Add, Text, x+1 yp w60 BackgroundTrans vDnl_Size%A_Index%, } ;Gui, Add, Edit, xs+5 ys+25 w565 h440 vDNL_Q -Wrap, Gui, Add, Edit, xs+5 yp+30 w610 h90 vDNL_Q -Wrap, Gui, Tab, 4 ;Feedback Gui, Font, s12 bold Gui, Add, Text, xs+25 ys+45, Please write your opinion, feedback or wishes... Gui, Font, s10 bold Gui, Add, Edit, xs+25 y+15 w570 h260 vFeedback_Edit, Gui, Font, s18 bold Gui, Add, Button, xs+185 y+25 w250 h70 gFeedback_Button, Send Feedback Gui, Font Gui, Font, bold Gui, Add, Text, xs+55 y+10 h20 w525 CRed Center vClick_Again, Gui, Font Gui, Tab, 1 ;top ;Link List Gui, Add, Edit, xs+11 ys+25 w595 h70 vLinkList, Link list to ripp ;Direct search Gui, Add, Text, xs+11 y+5, Add direct search on Gui, Add, DropDownList, x+5 yp-3 w150 vDirSearch AltSubmit, %DSs% Gui, Add, Text, x+5 yp+3, for: Gui, Add, Edit, x+5 yp-3 w220 vDirSearchKeyword, Gui, Add, Button, x+5 yp h20 gDirectSearchAdd,Add to link list ;Save Dir Gui, Add, Text, xs+11 y+25 h20 , Save dir: Gui, Add, Edit, x+5 yp-3 w400 h20 vSaveDir, %SaveDir% Gui, Add, Button, x+5 yp w50 h20 gSaveDir_Browse, Browse Gui, Add, Button, x+5 yp w90 h20 gSaveDir_Open, Open Save-dir ;Save File Gui, Add, Text, xs+11 yp+25 h20 , Save file: Gui, Add, DropDownList, x+5 yp-3 w150 vFileSaveName_Order AltSubmit Choose1, [Timestamp]_[Name].[ext]|[Name]_[Timestamp].[ext] ;Proxy server Gui, Add, Text, x+30 yp+3 h20 , Proxy Server: Gui, Add, ComboBox, x+5 yp-3 w150 vProxyServer Choose1 Disabled, %ProxyServerList% Gui, Add, Text, x+5 yp+3, Not yet working posy = 220 ;1st column ;Download or List or Copy Gui, Add, Edit, % "Section x26 y" posy " w290 h120 Disabled -VScroll", Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%Download Setup%A_Space% Gui, Add, Radio, Section x36 ys+20 h20 gGui_Conf vDownloadFiles Checked, Download files in Gui, Add, Radio, xs yp+40 h20 gGui_Conf vDownloadList, Just create a download-list for a download manager Gui, Add, Radio, xs yp+20 h20 gGui_Conf vDownloadCopy, Just copy download-links to the clipboard Gui, Add, CheckBox, xs+20 yp+17 h20 vConfirmDownloadWindow Checked, Auto-confirm download manager popup window Gui, Add, CheckBox, xs+20 ys+19 h20 vShowDownloadWindows, Show external download windows (oldfashioned) Gui, Add, Edit, xs+100 ys w40 h20 Number vMax_Threads_Edit Gui, Add, UpDown, vMax_Threads Range1-16, %Max_Threads% Gui, Add, Text, x+4 yp+3 h20 , simultaneous downloads Gui, Add, Text, x+1 yp-3 h20 , ;File Download Filters Gui, Add, Edit, Section x26 yp+120 w290 h125 Disabled -VScroll, Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%File Download Filters%A_Space% Gui, Add, Text, xs+10 ys+20, File extension list: Gui, Add, Edit, xs+120 yp w160 h20 vFilterList, .wmv,.mpg,.avi,.mov,.flv,.mp4 Gui, Add, Text, xs+10 yp+20, File name exclude list: Gui, Add, Edit, xs+120 yp w160 h20 vFNexclude, trailer,teaser Gui, Add, Text, xs+10 yp+20, File name include list: Gui, Add, Edit, xs+120 yp w160 h20 vFNinclude, Gui, Add, Text, xs+10 yp+20, Skip file if in history: Gui, Add, Radio, xs+120 yp h20 gGui_Hist vHistGl, Global Gui, Add, Radio, x+2 yp h20 gGui_Hist vHistDir, Save-Dir Gui, Add, Radio, x+2 yp h20 gGui_Hist vHistNo Checked, No Gui, Add, CheckBox, xs+120 yp+20 h20 vHistEx, only if file is still in its Save-Dir ;Session Gui, Add, Edit, Section x26 yp+45 w290 h75 Disabled -VScroll, Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%Session Menegement%A_Space% Gui, Add, Text, xs+10 ys+20, Give a name to this session: Gui, Add, Edit, x+2 yp w136 h20 vSessionName, myRipper Gui, Add, Button, xs+10 yp+25 gSaveSession,Save This Session Gui, Add, Button, x+7 yp gLoadSession,Load Session, History or LinkList ;2nd colum ;Link Follow Filters Gui, Add, Edit, % "Section x350 y" posy " w250 h90 Disabled -VScroll", Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%Link Follow Filters%A_Space% Gui, Add, Text, xs+10 ys+20, Click depth: Gui, Add, Edit, xs+90 yp w50 h20 vClickDepth, Gui, Add, Text, xs+10 yp+20, Url exclude list: Gui, Add, Edit, xs+90 yp w150 h20 vLKexclude, Gui, Add, Text, xs+10 yp+20, Url include list: Gui, Add, Edit, xs+90 yp w150 h20 vLKinclude, ;Tricks Gui, Add, Edit, Section x350 yp+50 w250 h100 Disabled -VScroll, Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%Tricks%A_Space% Gui, Add, CheckBox, xs+10 ys+10 h20 gGui_Strip vdoStripping Checked, Do link stripping? (Link-in-Link) Gui, Add, CheckBox, xs+30 yp+20 h20 vonlyStripping, Follow only stripped links? Gui, Add, CheckBox, xs+10 yp+20 h20 vHQ Checked, Check best quality from YouTube Gui, Add, Text, xs+30 yp+20 h18 , Check fmt= ; Gui, Add, Edit, x+1 y w25 h20 vHQtag_edit, 35 Gui, Add, Text, x+3 y h18 , 22=>35=>18=>6=>5(none) ;Follow Search Gui, Add, Edit, Section x350 yp+50 w250 h90 Disabled -VScroll, Gui, Add, Text, xp+7 yp-7 C0000AA, %A_Space%Follow Search Pages%A_Space% Gui, Add, CheckBox, xs+10 ys+10 h20 gGui_Srch vFollowSearch, Follow Gui, Add, Edit, x+2 yp w25 h20 vMaxFollow, 10 Gui, Add, Text, x+3 yp+3 h20 , pages: Gui, Add, Text, x+0 yp-3 h20 , Gui, Add, DropDownList, x+0 yp w110 vPagNumType gGui_PNType AltSubmit Choose1, %PVs% Gui, Add, Text, xs+10 yp+25, Page Var in link: ( e.g. pn=[PageNumber]*10 ) Gui, Add, Edit, xs+10 yp+15 w230 h20 vPageVar, Gui, Add, Button, xs+0 yp+50 gSaveDefaults,Save These Settings as Default Gui, Tab ;No Tab ;Buttons Row Gui, Add, Button,vBu1 x26 yp+60 w100 h30 gStart, Start Ripper Gui, Add, Button,vBu2 x+10 yp w50 h30 gPauseit, Pause Gui, Add, Button,vBu3 x+10 yp w50 h30 gResumeit, Resume Gui, Add, Button,vBu4 x+10 yp w100 h30 gStop, Stop Ripper Gui, Add, Button,vBu5 x+10 yp w100 h30 gExit, Exit && Stop All Gui, Add, Button,vBu6 x+10 yp w150 h30 gCheckUpdateX, Check Program Update ;Gui, Show, h568 w605, %Prog_Name%Win Gui, Show, h670 w650, %Prog_Name%Win Gui, Submit, NoHide GoSub, LoadDefaults If not DownloadCopy GuiControl, Disable, ConfirmDownloadWindow If not FollowSearch { GuiControl, Disable, PageVar GuiControl, Disable, PagNumType GuiControl, Disable, MaxFollow } If HistNo GuiControl, Disable, HistEx GuiControl, Disable, Pause GuiControl, Disable, Stop GuiControl, Disable, Resume GuiControl, +gGetUrlIE, Internet Explorer_Server1 GuiControl, Hide, UrlIEX GuiControl, Hide, GoIEX GuiControl, Hide, StopIEX GuiControl, Hide, BackIEX ControlClick,x34 y78,ahk_id %w1% Send, ^a ;Checking for broken downloads isDnlProc = 0 PrevProcDnl = Loop, Read, %A_ScriptDir%\%Dnlder_Name%.ini { pos := InStr(A_LoopReadLine,"=") If not pos Continue If (pos = StrLen(A_LoopReadLine)) Continue kell := SubStr(A_LoopReadLine,pos+1) kell = %kell% If not kell Continue isDnlProc += 1 StringSplit,tDnl,kell,| trunID = %tDnl1% turl = %tDnl2% tfil = %tDnl3% PrevProcDnl = %PrevProcDnl%¤%turl%|%tfil% ;Download Queue - PrevProc } If isDnlProc() ;sets PrevProcDnlText { Gui, 99:Add, Text, x20 y20 w300, Some downloads not finished from a previous session: Gui, 99:Add, Text, x20 y+10 w300, %PrevProcDnlText% SplitPath,tfil,tfile,tdir Gui, 99:Add, Text, x20 y+20 w300, Save Dir was:`n%tdir% Gui, 99:Add, Text, x20 y+20 w300, What do you want to do? Gui, 99:Add, Button, x20 y+30 h25 gPrevProcDelAll, Delete All from List Gui, 99:Add, Button, x+20 yp h25 gPrevProcDoAll, Finish All Downloads Now Gui, 99:Add, Button, x+20 yp h25 gPrevProcCancel Default, Cancel Gui, 99:Show } Return ;************************************************************************** GuiSize: Anchor("Mask","w") Anchor("myTab","wh",true) Anchor("LinkList","w",true) Anchor("map","wh",true) Anchor("DNL_Q","wh",true) Anchor("Bu1","x0.5y") Anchor("Bu2","x0.5y") Anchor("Bu3","x0.5y") Anchor("Bu4","x0.5y") Anchor("Bu5","x0.5y") Anchor("Bu6","x0.5y") Return /* Function: Anchor Defines how controls should be automatically positioned relative to the new dimensions of a GUI when resized. Parameters: cl - a control HWND, associated variable name or ClassNN to operate on a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height), optionally followed by a relative factor, e.g. "x h0.5" r - (optional) true to redraw controls, recommended for GroupBox and Button types Examples: > "xy" ; bounds a control to the bottom-left edge of the window > "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio > "h" ; similar to above but directrly proportional to height Remarks: Anchor must always be called within a GuiSize label where AutoHotkey assigns a real value to A_Gui. The only exception is when the second and third parameters are omitted to reset the stored positions for a control. For a complete example see anchor-example.ahk. License: - Version 4.56 by Titan - GNU General Public License 3.0 or higher */ Anchor(i, a = "", r = false) { static c, cs = 12, cx = 255, cl = 0, g, gs = 8, z = 0, k = 0xffff, gx = 1 If z = 0 VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), z := true If a = { StringLeft, gn, i, 2 If gn contains : { StringTrimRight, gn, gn, 1 t = 2 } StringTrimLeft, i, i, t ? t : 3 If gn is not digit gn := gx } Else gn := A_Gui If i is not xdigit { GuiControlGet, t, Hwnd, %i% If ErrorLevel = 0 i := t Else ControlGet, i, Hwnd, , %i% } gb := (gn - 1) * gs Loop, %cx% If (NumGet(c, cb := cs * (A_Index - 1)) == i) { If a = { cf = 1 Break } Else gx := A_Gui d := NumGet(g, gb), gw := A_GuiWidth - (d >> 16 & k), gh := A_GuiHeight - (d & k), as := 1 , dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short") , dw := NumGet(c, cb + 8, "Short"), dh := NumGet(c, cb + 10, "Short") Loop, Parse, a, xywh If A_Index > 1 av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField) , d%av% += (InStr("yh", av) ? gh : gw) * (A_LoopField + 0 ? A_LoopField : 1) DllCall("SetWindowPos", "UInt", i, "Int", 0, "Int", dx, "Int", dy, "Int", dw, "Int", dh, "Int", 4) If r != 0 DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE Return } If cf != 1 cb := cl, cl += cs If (!NumGet(g, gb)) { Gui, %gn%:+LastFound WinGetPos, , , , gh VarSetCapacity(pwi, 68, 0), DllCall("GetWindowInfo", "UInt", WinExist(), "UInt", &pwi) , NumPut(((bx := NumGet(pwi, 48)) << 16 | by := gh - A_GuiHeight - NumGet(pwi, 52)), g, gb + 4) , NumPut(A_GuiWidth << 16 | A_GuiHeight, g, gb) } Else d := NumGet(g, gb + 4), bx := d >> 16, by := d & k ControlGetPos, dx, dy, dw, dh, , ahk_id %i% If cf = 1 { Gui, %gn%:+LastFound WinGetPos, , , gw, gh d := NumGet(g, gb), dw -= gw - bx * 2 - (d >> 16), dh -= gh - by - bx - (d & k) } NumPut(i, c, cb), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short") , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short") Return, true } Dnl_CloseProc: Gui, Submit, NoHide Dnl_Num := SubStr(A_GuiControl,0) ;MsgBox, Number %Dnl_Num% download must be stopped. DetectHiddenWindows,ON IfWinExist,VidRipper_Dnl_%Dnl_Num% { ControlClick,Button1,VidRipper_Dnl_%Dnl_Num%,,,,NA Sleep, 100 } DetectHiddenWindows,OFF Return Dnl_Status_Update: DetectHiddenWindows,ON Loop, %Max_Threads% { IfWinExist,VidRipper_Dnl_%A_Index% { ;ControlGetText,cProgressN,Static2,VidRipper_Dnl_%A_Index% ;Static2 ProgressN ;thisProgressN := SubStr(cProgressN,1,-1) ;83% runIDx = runID%A_Index% IniRead, runID, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx%, %A_Space% If runID { StringSplit,tDnl,runID,| trunID = %tDnl1% turl = %tDnl2% tfil = %tDnl3% tsiz = %tDnl4% tprog = %tDnl5% } thisProgressN := tprog If prevKB%A_Index% { thisSize := prevSize%A_Index% thisKB := thisSize*thisProgressN/100 thisTime := A_TickCount ;millisec timeSlot := (thisTime-prevTime%A_Index%)/1000 ;sec avgtimeSlot := (thisTime-startTime%A_Index%)/1000 ;sec KBchange := (thisKB-prevKB%A_Index%)/8 ;kbit thisSpeed := KBchange/timeSlot ;kbps avgSpeed := thisKB/avgtimeSlot ;kbps GuiControl,, Dnl_Speed%A_Index%,% "" round(thisSpeed,0) "" GuiControl,, Dnl_avgSpeed%A_Index%,% "" round(avgSpeed,0) "" } else { ;ControlGetText,cSize,Static3,VidRipper_Dnl_%A_Index% ;Static3 KB ;thisSize := SubStr(cSize,1,-3) ;1725 KB thisSize := tsiz ;ControlGetText,thisDnlFile,Static1,VidRipper_Dnl_%A_Index% ;Static1 DnlFile thisDnlFile := SubStr(tfil,InStr(tfil,"\",false,0)+1) startTime%A_Index% := A_TickCount ;millisec GuiControl,, Dnl_Sepa%A_Index%,% "/" GuiControl,, Dnl_Metric%A_Index%,% "kbps" GuiControl,, Dnl_Size%A_Index%, % "" round(thisSize/1024,1) " MB" GuiControl,, Dnl_FileName%A_Index%, %thisDnlFile% GuiControl,, Dnl_Speed%A_Index%,% "curr" GuiControl,, Dnl_avgSpeed%A_Index%,% "avg" prevSize%A_Index% := thisSize } GuiControl,, Dnl_ProgressN%A_Index%, % thisProgressN "%" GuiControl,, Dnl_ProgressBar%A_Index%, %cProgressN% GuiControl,, Dnl_Size%A_Index%, % "" round(thisSize/1024,1) " MB" prevKB%A_Index% := thisSize*thisProgressN/100 prevTime%A_Index% := A_TickCount ;millisec } else { GuiControl,, Dnl_FileName%A_Index%, GuiControl,, Dnl_ProgressBar%A_Index%,0 GuiControl,, Dnl_ProgressN%A_Index%, GuiControl,, Dnl_Size%A_Index%, GuiControl,, Dnl_Speed%A_Index%, GuiControl,, Dnl_avgSpeed%A_Index%, } } DetectHiddenWindows,OFF Return Feedback_Hot_Button: GuiControl, Choose, myTab, 4 Return Feedback_Button: Gui, Submit, NoHide URLDownloadToFile,http://fures.hu/ontrack_safety/myMailInnen.php?from=%Prog_Name%@eqnet.hu&to=fures@eqnet.hu&subject=%Prog_Name% Feedback&from_info=&text=%Feedback_Edit%,thisRes.txt If ErrorLevel MsgBox, There was a problem sending your feedback. Please try later! else MsgBox, Your feedback was sent successfully. Thanks for it. FileDelete,thisRes.txt Return Exit: GuiClose: If not Feedback_Tab { Feedback_Tab = 1 GuiControl, Choose, myTab, 4 GuiControl,, Click_Again,If you don't want to Feedback - Click Exit again to quit! Return } Gui, Submit ;FileDelete,%SaveDir%\History_This_Dir.html ;FileDelete,%A_ScriptDir%\History_Global.html ;FileAppend,%This_Dir_Hist%,%SaveDir%\History_This_Dir.html ;FileAppend,%GL_Hist%,%A_ScriptDir%\History_Global.html Loop, %Max_Threads% ;Check for active runIDs { runIDx = runID%A_Index% IniRead, runID, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx% IfNotEqual,runID,ERROR { StringSplit,tDnl,runID,| trunID = %tDnl1% turl = %tDnl2% tfil = %tDnl3% Process, Exist, %trunID% If (ErrorLevel = trunID) ;Successfully closed { Loop, 5 ;try closing { Process, Close, %trunID% If (ErrorLevel = trunID) ;Successfully closed { ;IniWrite, %A_Space%, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx% Break } else Sleep, 200 } } } } FileDelete,%A_ScriptDir%\%Dnlder_Name%.ini ExitApp Return Start: Gui, Submit, NoHide If (ClickDepth="") { MsgBox, Click depth is not defined. Please do! Return } If (not SaveDir) { MsgBox, Save dir is not defined. Please do! Return } IfNotExist,%SaveDir% { MsgBox, 4, , Save dir does not exist: %SaveDir% `n`nCreate it now? IfMsgBox No Return FileCreateDir,%SaveDir% If ErrorLevel { MsgBox, Error creating %SaveDir% Return } } else ;exist SaveDir { IfExist,%SaveDir%\History_This_Dir.html { MsgBox, 4, , Save dir was already used for another ripper session.`n`nAre you sure you want to add downloads to this dir? IfMsgBox No Return } } If (InStr(FilterList,"Filter list") or not FilterList) { MsgBox, File extension list is not defined. Please do! Return } If (LinkList="Link list to ripp" or not LinkList) { MsgBox, Link list is not defined. Please do! Return } ThisRunTime = %A_Now% GoSub, SaveSession SB_SetText("Ripping...",1) GuiControl, Enable, Pause GuiControl, Enable, Stop Ripper GuiControl, Disable, Start Ripper GuiControl, Disable, LinkList TV_Delete() x_url = ;this run history delete FileRead,GL_Hist,%A_ScriptDir%\History_Global.html FileRead,This_Dir_Hist,%SaveDir%\History_This_Dir.html GuiControl, Choose, myTab, 2 FileDelete,%A_ScriptDir%\%Dnlder_Name%.ini Dnl = SetTimer, Checkers, 1000 FilterList2 := FilterList Loop, parse, FilterList2, `, . { If %A_LoopField%_group ;groupped extension { th_gr := %A_LoopField%_group StringReplace,FilterList,FilterList,%A_LoopField%,%th_gr%,All } } Loop, Parse, LinkList, `n, `r { If not A_LoopField Continue link := A_Loopfield P := TV_Add(link) Down_and_Ripp(link,P,ClickDepth,SaveDir,FilterList) If Stopper Break If FollowSearch GoSub, GetNextSearch } FilterList := FilterList2 SB_SetText("Stopped",1) GuiControl, Choose, myTab, 1 GuiControl, Disable, Pause GuiControl, Disable, Stop Ripper GuiControl, Enable, Start Ripper GuiControl, Enable, LinkList GoSub, Gui_Conf Stopper = Return Pauseit: SB_SetText("Paused...",1) GuiControl, Disable, Pause GuiControl, Enable, Resume GuiControl, Enable, LinkList GoSub, Gui_Conf Loop { Sleep, 100 If (Resumer or Stopper) Break } SB_SetText("Ripping resumed...",1) Gui, Submit, NoHide GuiControl, Enable, Pause GuiControl, Disable, Resume GuiControl, Disable, LinkList Resumer = Return Resumeit: Resumer = 1 Return Stop: Stopper = 1 MsgBox,0,,Please wait for the current downloads to finish.`n`nOr click Exit to stop and quit immediately.,5 Return SaveDefaults: Gui, Submit, NoHide IniFile = %A_ScriptDir%\_Sessions\Default_Settings.ini IfNotExist,%A_ScriptDir%\_Sessions\ { FileCreateDir,%A_ScriptDir%\_Sessions If ErrorLevel Return } SB_SetText("Saving Defaults...",1) StringReplace,Links,LinkList,`n,|,All FileDelete,%IniFile% FileAppend, ( SessionName¤%SessionName% LinkList¤%Links% SaveDir¤%SaveDir% DownloadFiles¤%DownloadFiles% DownloadList¤%DownloadList% DownloadCopy¤%DownloadCopy% Max_Threads_Edit¤%Max_Threads_Edit% ShowDownloadWindows¤%ShowDownloadWindows% ConfirmDownloadWindow¤%ConfirmDownloadWindow% FilterList¤%FilterList% FNexclude¤%FNexclude% FNinclude¤%FNinclude% HistGl¤%HistGl% HistDir¤%HistDir% HistNo¤%HistNo% HistEx¤%HistEx% ClickDepth¤%ClickDepth% LKexclude¤%LKexclude% LKinclude¤%LKinclude% doStripping¤%doStripping% onlyStripping¤%onlyStripping% FollowSearch¤%FollowSearch% MaxFollow¤%MaxFollow% PagNumType¤%PagNumType% PageVar¤%PageVar% HQ¤%HQ% HQtag_edit¤%HQtag_edit% Tree_Collaps¤%Tree_Collaps% Tree_Select¤%Tree_Select% FileSaveName_Order¤%FileSaveName_Order% ProxyServerList¤%ProxyServerList% ProxyServer¤%ProxyServer% ),%IniFile% SB_SetText("Defaults Saved:Default_Settings.ini",1) Return SaveSession: Gui, Submit, NoHide ThisRunTime := A_Now StringReplace,SessionName,SessionName,%A_Space%,_,All IniFile = %A_ScriptDir%\_Sessions\Session_%SessionName%_%ThisRunTime%.ini IfNotExist,%A_ScriptDir%\_Sessions\ { FileCreateDir,%A_ScriptDir%\_Sessions If ErrorLevel Return } SB_SetText("Saving Session...",1) StringReplace,Links,LinkList,`n,|,All FileDelete,%IniFile% FileAppend, ( SessionName¤%SessionName% LinkList¤%Links% SaveDir¤%SaveDir% DownloadFiles¤%DownloadFiles% DownloadList¤%DownloadList% DownloadCopy¤%DownloadCopy% Max_Threads_Edit¤%Max_Threads_Edit% ShowDownloadWindows¤%ShowDownloadWindows% ConfirmDownloadWindow¤%ConfirmDownloadWindow% FilterList¤%FilterList% FNexclude¤%FNexclude% FNinclude¤%FNinclude% HistGl¤%HistGl% HistDir¤%HistDir% HistNo¤%HistNo% HistEx¤%HistEx% ClickDepth¤%ClickDepth% LKexclude¤%LKexclude% LKinclude¤%LKinclude% doStripping¤%doStripping% onlyStripping¤%onlyStripping% FollowSearch¤%FollowSearch% MaxFollow¤%MaxFollow% PagNumType¤%PagNumType% PageVar¤%PageVar% HQ¤%HQ% HQtag_edit¤%HQtag_edit% Tree_Collaps¤%Tree_Collaps% Tree_Select¤%Tree_Select% FileSaveName_Order¤%FileSaveName_Order% ProxyServerList¤%ProxyServerList% ProxyServer¤%ProxyServer% ),%IniFile% SB_SetText("Session Saved:Session_" SessionName "_" ThisRunTime ".ini",1) GuiControl,,SessionName,%SessionName% Return LoadDefaults: SessFile = %A_ScriptDir%\_Sessions\Default_Settings.ini Loop,read,%SessFile% { If not A_LoopReadLine Break StringSplit,Line,A_LoopReadLine,¤ If (!Line1) Break IfEqual,Line1,LinkList StringReplace,Line2,Line2,|,`n,All %Line1%=%Line2% If Line1 in ProxyServer,FileSaveName_Order,PagNumType GuiControl,Choose,%Line1%,%Line2% else GuiControl,,%Line1%,%Line2% ;MsgBox, %A_Index% - %Line1% = %Line2%*** } Return LoadSession: FileSelectFile,SessFile,3,%A_ScriptDir%\_Sessions\,Open a session`, history or download-list file,%Prog_Name% Files(*.ini; *.html; *.txt) If ErrorLevel Return IfInString,SessFile,.ini ;session file { Sleep, 30 ;Load Session info Loop,read,%SessFile% { If not A_LoopReadLine Break StringSplit,Line,A_LoopReadLine,¤ If (!Line1) Break IfEqual,Line1,LinkList StringReplace,Line2,Line2,|,`n,All %Line1%=%Line2% IfEqual,Line1,PagNumType GuiControl,Choose,%Line1%,%Line2% else GuiControl,,%Line1%,%Line2% ;MsgBox, %A_Index% - %Line1% = %Line2%*** } } else IfInString,SessFile,.html ;history file { Sleep, 30 ;movie01.mpg - from:http://galleries.adult-empire.com/53/5391/0005/movie01.mpg to:C:\Documents and Settings\Zsolt\Asztal\myRipper3d\20080808015454_movie01.mpg
;get all links from text rgx := "i)]*href\s?=[\s'""]?(.+?)[\s>'""]" murl = searchPos = 1 FileRead,fileContent,%SessFile% Loop { fp := RegExMatch(fileContent, rgx, url, searchPos) url = %url1% If (fp = 0) Break ; Not found If not url Break searchPos := fp + StrLen(url) url := urlDecode(url) murl=%murl%%url%`n } GuiControl,,LinkList,%murl% } else IfInString,SessFile,.txt ;download-list file { Sleep, 30 rgx := "(.+)" murl = searchPos = 1 FileRead,fileContent,%SessFile% Loop { fp := RegExMatch(fileContent, rgx, url, searchPos) url = %url1% If (fp = 0) Break ; Not found If not url Break searchPos := fp + StrLen(url) url := urlDecode(url) murl=%murl%%url%`n } GuiControl,,LinkList,%murl% } Return GetNextSearch: link2 := link If PageVar { Loop ;by pagenum { pagenum := A_Index+1 PageNumber := pagenum SB_SetText("Ripping... Cont.Search page " PageNumber " of " MaxFollow,1) Addi = Loop, parse, PageVar, & { StringSplit, OutVar, A_LoopField, = If (OutVar0 < 2) Break Addi := Addi . "&" . OutVar1 . "=" . Eval(OutVar2) PageNumber := PageNumber-1 Subt := OutVar1 . "=" . Eval(OutVar2) ;PageNumber-1 StringReplace,link2,link2,%Subt%,,All StringReplace,link2,link2,&&,&,All StringReplace,link2,link2,?&,?,All If (SubStr(link2,0,1) = "&") link2 := SubStr(link2,1,-1) PageNumber := PageNumber+1 } If Stopper Break link3 := link2 . Addi link3 := urlDecode(link3) IfNotInString,link3,:// ;www link link3 := "http://" link3 transform, encoded_link, html, %link3% UrlDownloadToFile,%encoded_link3%,%SaveDir%\temp_depth%ClickDepth%.html FileRead fileContent, %SaveDir%\temp_depth%ClickDepth%.html ; If fileContent contains forbidden,not match,not found ; { ; TV_GetText(PrntTxt,Prnt) ; TV_Modify(Prnt,"Icon2",PrntTxt " ==> ERROR CONTENT: not match or 404 not found or 403 forbidden") ; FileDelete,%SaveDir%\temp_depth%ClickDepth%.html ; Break ; } GuiControl,, LinkList, %LinkList%`nFollow Search Pages: page %pagenum%. ;Link:%link3% P := TV_Add(link3) Down_and_Ripp(link3,P,ClickDepth,SaveDir,FilterList) If (Stopper or A_Index+1 >= MaxFollow) Break } GuiControl,, LinkList, %LinkList% } Return DirectSearchAdd: Gui, Submit, NoHide StringReplace,DSKW,DirSearchKeyword,%A_Space%,+,All DSthis := DS%DirSearch% StringReplace,DSthis,DSthis,[KeyWords],%DSKW%,All If (LinkList = "Link list to ripp" or !LinkList) GuiControl,, LinkList, %DSthis% else GuiControl,, LinkList, %LinkList%`n%DSthis% MsgBox, Link for this search is added to the link list. Return PrevProcCancel: Gui, 99:Destroy Return PrevProcDelAll: Gui, 99:Destroy FileDelete, %A_ScriptDir%\%Dnlder_Name%.ini Return PrevProcDoAll: Gui, 99:Destroy IfNotExist,%tdir% FileCreateDir,%tdir% Dnl = %PrevProcDnl% SetTimer, Checkers, 1000 Return Tree_Submit: Gui, Submit, NoHide Return Gui_PNType: Gui, Submit, NoHide PVthis := PV%PagNumType% If (PagNumType = 1) GuiControl, Enable, PageVar else { GuiControl,, PageVar, %PVthis% GuiControl, Disable, PageVar } Return Gui_Strip: ;do stripping Gui, Submit, NoHide If doStripping GuiControl, Enable, onlyStripping else GuiControl, Disable, onlyStripping Return Gui_Hist: ;history Gui, Submit, NoHide If HistNo GuiControl, Disable, HistEx else GuiControl, Enable, HistEx Return Gui_Srch: ;follow search page Gui, Submit, NoHide If FollowSearch { If (PagNumType = 1) GuiControl, Enable, PageVar GuiControl, Enable, MaxFollow GuiControl, Enable, PagNumType } else { GuiControl, Disable, PageVar GuiControl, Disable, MaxFollow GuiControl, Disable, PagNumType } Return Gui_Conf: ;download-list-copy Gui, Submit, NoHide If DownloadCopy GuiControl, Enable, ConfirmDownloadWindow else GuiControl, Disable, ConfirmDownloadWindow If DownloadFiles { GuiControl, Enable, Max_Threads GuiControl, Enable, Max_Threads_Edit GuiControl, Enable, ShowDownloadWindows } else { GuiControl, Disable, Max_Threads GuiControl, Disable, Max_Threads_Edit GuiControl, Disable, ShowDownloadWindows } Return Gui_TV_event: Critical ;GuiControl, +Redraw, map If A_GuiControl <> map return IfEqual, A_GuiEvent, RightClick { TV_GetText(thisText,A_EventInfo) TV_Modify(A_EventInfo,"Select") StringLeft,thisText,thisText,InStr(thisText," ==>") ? (InStr(thisText," ==>")-1) : StrLen(thisText) Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY% } Return Context_Copy: ClipBoard = %thisText% Return Context_Open: IfInString,thisText,:// Run, %thisText% else MsgBox, This link is ready: %thisText%`nWait until it is processed and try to open again. Return SaveDir_Open: Run, %SaveDir% Return SaveDir_Browse: FileSelectFolder, SaveDir, %A_Desktop%, 1, Please select or create a folder to save downloaded files GuiControl,, SaveDir, %SaveDir% ;IniWrite, %SaveDir%, %GeneralIniFile%, Settings, SaveDir Return Down_and_Ripp(link,Prnt,depth,dir,filters) { Global Stopper,FNexclude,onlyStripping,doStripping,LKexclude,LKinclude,FNinclude,ThisRunTime,ConfirmDownloadWindow Global StripStringList,ClickDepth,NumLinks,NumRipps,NumFiles,DupFilter,map,DownloadList,DownloadCopy,x_url,Dnl,SR_Download_Multi,UseIE Global GL_Hist,This_Dir_Hist,HistGl,HistDir,HistEx,rar_group,HQ,HQtag_edit,Tree_Collaps,Tree_Select,FileSaveName_Order,ProxyServer mehet = If (InStr(link,"my___watch") and depth > -2) mehet = 1 If (depth<0 and !mehet) { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon3",PrntTxt " ==> NOT FOLLOW: depth is not enough.") Return } IfInString,link,my___watch StringReplace,link,link,my___watch,watch,all If Stopper Return NumLinks += 1 SB_SetText("`t`t" NumLinks " links scanned",2) SB_SetText("`t`t" NumRipps " links followed",3) SB_SetText("`t`t" NumFiles " files ripped",4) link := urlDecode(link) If (ClickDepth <> depth) ;except for the top level { ;Link exclude-include filters If LKexclude If link contains %LKexclude% { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon3",PrntTxt " ==> FILTER: Link contains exclude: " LKexclude) Return } If LKinclude If link not contains %LKinclude% { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon3",PrntTxt " ==> FILTER: Link not contain include: " LKinclude) Return } } NumRipps += 1 IfNotInString,link,:// link = http://%link% ;download link OutExtension := SubStr(link,InStr(link,".",false,0)) If OutExtension in %filters% ;Download { thisurl := link i = 1 fromJump = 1 GoTo, LoopUrls } else fromJump = Sleep, 100 transform, encoded_link, html, %link% ErrorLevel = URLDownloadToFile,%encoded_link%,%dir%\temp_depth%depth%.html If not ErrorLevel { Sleep, 50 ;Checking 404 Not Found in content ; FileGetSize,FileSize,%dir%\temp_depth%depth%.html ; If (FileSize < (100*1024)) ;if small - check content ; { ; FileRead,SavedFileContent,%dir%\temp_depth%depth%.html ; If SavedFileContent contains forbidden,not found ;if 404 not found - delete ; { ; TV_GetText(PrntTxt,Prnt) ; TV_Modify(Prnt,"Icon2",PrntTxt " ==> ERROR CONTENT: 404 not found or 403 forbidden") ; FileDelete,%dir%\temp_depth%depth%.html ; Return ; } ; } } else { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon2",PrntTxt " ==> ERROR DOWNLOADING.") Return } FileRead fileContent, %dir%\temp_depth%depth%.html murl = kell = 0 iw := 0 ;get Youtube flv object IfInString,link,watch?v= { RegExMatch(link, "i)v=([^&]+)&?.*$", v) ;get it from link ;s := RegExMatch(fileContent, "i)fullscreen?", x) s := RegExMatch(fileContent, "i)swfArgs =", x) If s { If not v1 { ;RegExMatch(fileContent, "i)video_id=(.+?)&", v, s) ;"video_id": "R3HPg2FWEwY", rgx = i)"video_id"\s*:\s*"(.+?)" RegExMatch(fileContent, rgx, v, s) } ;"t": "vjVQa1PpcFMljbj0MDR6BkcCLKcz1mg8sUCYfBSSzK0=", rgx = i)"t"\s*:\s*"(.+?)" RegExMatch(fileContent, rgx, t, s) ;"plid": "AARxP1bncDttiRaF", rgx = i)"plid"\s*:\s*"(.+?)" RegExMatch(fileContent, rgx, l, s) ;

vawt low wind speed electric generators jet blade

rgx = i)<\s*h1\s*>(.+?)< RegExMatch(fileContent, rgx, tit, s) tit := tit1 ;MsgBox, % tit ; RegExMatch(fileContent, "i)&t=(.+?)&", t, s) ; RegExMatch(fileContent, "i)&l=(.+?)&", l, s) ; RegExMatch(fileContent, "i)&title=(.+?)';", tit, s) If (v1 and l1 and t1) { If HQ HQtag := "&fmt=" get_highest_YT_quality(v1,t1,l1) else HQtag = url = http://www.youtube.com/get_video?video_id=%v1%&l=%l1%&t=%t1%%HQtag%¤%tit1% iw++ url := urlDecode(url) murl = %murl%1%url%`n If (filters and depth=0) ;last level If filters contains flv,youtube,yt,flash,mp4 kell = 1 } } } ;get embedded objects src= searchPos := 1 Loop { fp := RegExMatch(fileContent, "i)(src|data)\s?=[\s'""]?(.+?)[\s>'""]", url, searchPos) ;fp := RegExMatch(fileContent, "iJ)src\s*=\s*(?:""(?'l'[^""]+)""|'(?'l'[^']+)'|(?'l'[^\s>]*)[\s>])", url, searchPos) ;MsgBox, %url% - %url1% - %url2% url = %url1% if url in src,data url = %url2% If (fp = 0) Break ; Not found searchPos := fp + StrLen(url) IfEqual, url, # Continue If not url Break iw++ IfInString,url,youtube.com/v/ { RegExMatch(url,"/v/(.*)&",newlink) oldlink := url url = http://www.youtube.com/my___watch?v=%newlink1% murl = %murl%2%url%`n kell = 1 } url := urlDecode(url) OutExtension := SubStr(url,InStr(url,".",false,0)) If (depth=0) { If OutExtension contains %filters% ;Download { murl = %murl%1%url%`n kell = 1 } } else { If OutExtension contains %filters% ;Download murl = %murl%1%url%`n else If url contains /watch?,youtube.com/v/ ;YouTube object murl = %murl%2%url%`n else If url contains url=http,url=www ;Stripped1 murl = %murl%3%url%`n else If url contains =http,=www.,** ;Stripped2 murl = %murl%4%url%`n else murl = %murl%9%url%`n } } ;get all urls: href= searchPos := 1 Loop { fp := RegExMatch(fileContent, "i)]*href\s?=[\s'""]?(.+?)[\s>'""]", url, searchPos) url = %url1% If (fp = 0) Break ; Not found searchPos := fp + StrLen(url) IfEqual, url, # Continue If not url Break iw++ url := urlDecode(url) OutExtension := SubStr(url,InStr(url,".",false,0)) If (depth=0) { If OutExtension contains %filters% ;Download { murl = %murl%1%url%`n kell = 1 } } else { If OutExtension contains %filters% ;Download murl = %murl%1%url%`n else If url contains /watch?,youtube.com/v/ ;YouTube object murl = %murl%2%url%`n else If url contains url=http,url=www ;Stripped1 murl = %murl%3%url%`n else If url contains =http,=www.,** ;Stripped2 murl = %murl%4%url%`n else murl = %murl%9%url%`n } } ; MsgBox, % murl ; Return If (iw=0) { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon3",PrntTxt " ==> NO url/media found in html content.") Return } If (kell=0 and depth=0) { TV_GetText(PrntTxt,Prnt) TV_Modify(Prnt,"Icon3",PrntTxt " ==> NO file-extension found in html content.") Return } ;Sort and screen for duplicates Sort, murl, U ;Unique ;Insert into listview i = 1 Loop, parse, murl, `n { ezurl := SubStr(A_LoopField,2) IfEqual,ezurl,, Continue i++ P%A_Index% := TV_Add(ezurl,Prnt,"Icon999") } ;loop thru all urls - urldecoded LoopUrls: If not fromJump { TV_Modify(Prnt,"Expand") TV_Modify(Prnt,"Icon5") } Loop, %i% { If Stopper Return If not fromJump { Pthis := P%A_Index% If Tree_Select TV_Modify(Pthis,"Select") TV_Modify(Pthis,"Icon5") ;thisurl := murl%A_Index% tuID := TV_GetText(thisurl,Pthis) } if not thisurl { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR: no url") Continue } IfInString,thisurl,javascript: { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: javascript:") Continue } IfInString,thisurl,mailto: { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: mailto:") Continue } IfNotInString,thisurl,:// ;short link { If (InStr(link,"/",false,0) = (InStr(link,"://")+2)) ;the last / = http:// link = %link%/ If (SubStr(thisurl,1,3)="../") { ;link = http://www.dom.com/files/images/joop.html?mi=34&ti=93 eleje := SubStr(link,1,InStr(link,"/",false,0)) ;http://www.dom.com/files/images/ eleje := SubStr(eleje,1,-1) ;http://www.dom.com/files/images eleje := SubStr(link,1,InStr(link,"/",false,0)) ;http://www.dom.com/files/ StringReplace,thisurl,thisurl,../,/,All thisurl := eleje . "/" . thisurl ;only the domain } else If (SubStr(thisurl,1,1)="/") thisurl := SubStr(link,1,InStr(link,"/",false,10)) . "/" . thisurl ;only the domain else thisurl := SubStr(link,1,InStr(link,"/",false,0)) . "/" . thisurl ;also the dirs } StringReplace,thisurl,thisurl,//,/,All StringReplace,thisurl,thisurl,//,/,All StringReplace,thisurl,thisurl,//,/,All StringReplace,thisurl,thisurl,:/,://,All ;Setting filename IfInString,thisurl,youtube.com/get { ;http://www.youtube.com/get_video?video_id=%v1%&l=%l1%&t=%t1%¤%tit1% StringSplit,out,thisurl,¤ thisurl := out1 Save_Clipboard := ClipboardAll Transform, Clipboard, Unicode, %out2% out2 := Clipboard Clipboard := Save_Clipboard If thisurl contains fmt=22,fmt=18 filename := SubStr(out2,1,205) ".mp4" else If thisurl contains fmt=13,fmt=17 filename := SubStr(out2,1,205) ".3gp" else filename := SubStr(out2,1,205) ".flv" } else filename := SubStr(thisurl,InStr(thisurl,"/",false,0)+1) ;do Stripping LinkStripped = If doStripping { LinkStripped := StripLink(thisurl) If LinkStripped thisurl := LinkStripped } OutExtension := SubStr(filename,InStr(filename,".",false,0)) If OutExtension contains %filters% isfile = 1 else isfile = ;history skipit = ;this run If (InStr(thisurl,"watch?v=")) { RegExMatch(thisurl, "i)v=([^&]+)&?.*$", vid) thisvid := vid1 pos := InStr(x_url,thisvid) } else pos := InStr(x_url,thisurl) If pos { ;MsgBox, Same as before`nthisurl=%thisurl%`nthisvid=%thisvid%`nx_url=%x_url% If isfile { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: Same FILE as before.") skipit = 1 } else { vpos := InStr(x_url,"¤",false,pos) hist2 = Loop { x := SubStr(x_url,vpos+A_Index,1) If (!x or x = "|") Break hist2 = %dpx%%x% } If (hist2 >= depth) { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: Same URL as before.") skipit = 1 } } } ;This Dir history If HistDir { pos := InStr(This_Dir_Hist,"from:" thisurl) If pos { If HistEx { topos := InStr(This_Dir_Hist,"to:",false,pos)+3 tovpos := InStr(This_Dir_Hist,"
",false,topos) filehist := SubStr(This_Dir_Hist,topos,tovpos-topos) SplitPath, filehist, OutFileName IfExist,%dir%\%OutFileName% { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History This-Dir: File " OutFileName " already exist in this dir.") skipit = 1 } IfExist,%filehist% { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History This-Dir: File " OutFileName " already exist at: " filehist) skipit = 1 } } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History This-Dir: File " OutFileName " already exist in this dir history.") skipit = 1 } } } ;Global history If HistGl { pos := InStr(GL_Hist,"from:" thisurl) If pos { If HistEx { topos := InStr(GL_Hist,"to:",false,pos)+3 tovpos := InStr(GL_Hist,"
",false,topos) filehist := SubStr(GL_Hist,topos,tovpos-topos) SplitPath, filehist, OutFileName IfExist,%dir%\%OutFileName% { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History Global: File " OutFileName " already exist in this dir") skipit = 1 } IfExist,%filehist% { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History Global: File " OutFileName " already exist at: " filehist) skipit = 1 } } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER History Global. File " OutFileName " already exist in global history") skipit = 1 } } } If skipit Continue TV_Modify(Pthis,"Icon5",thisurl) ;Stripping file-extension from ?k=...&l=... IfNotInString,thisurl,youtube.com/get { IfInString,filename,? StringLeft,filename,filename,InStr(filename,"?")-1 IfInString,filename,& StringLeft,filename,filename,InStr(filename,"&")-1 } OutExtension := SubStr(filename,InStr(filename,".",false,0)) FNNoExtension := SubStr(filename,1,InStr(filename,".",false,0)-1) If OutExtension contains %filters% isfile = 1 else isfile = Save = 1 If OutExtension not contains %filters% ;if url-filename not contains extension filters { ;TV_GetText(PthisTxt,Pthis) ;TV_Modify(Pthis,"",PthisTxt " ==> FILTER: Not in file-extension list.") ;This instance is handled later Save = } If Save If FNinclude If filename not contains %FNinclude% ;if url-filename not contains iclude filters { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: " filename " does not contain include: " FNinclude) ;MsgBox, filename=%filename% Save = } If Save If FNexclude If filename contains %FNexclude% ;if url-filename contains exclude filters { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: " filename " contains exclude: " FNexclude) Save = } Sleep, 100 ;get rid of spec chars: \/:*?|<>" filename := RegExReplace(filename, "i)[\/\\:*?|¤<>""]", "_") ;filename := RegExReplace(filename, "i)[^a-zíéáûõúöüóÍÉÁÛÕÚÖÜÓ0-9~^_ .]", "_") If Save { TV_Modify(Pthis,"Icon1") Timestamp = %A_Now% IfEqual,FileSaveName_Order,2 { FileSaveName = %dir%\DNL_%FNNoExtension%_%Timestamp%.%OutExtension% FileSaveName_final = %dir%\%FNNoExtension%_%Timestamp%.%OutExtension% } else { FileSaveName = %dir%\DNL_%Timestamp%_%FNNoExtension%.%OutExtension% FileSaveName_final = %dir%\%Timestamp%_%FNNoExtension%_%Timestamp%.%OutExtension% } FileAppend,%filename% - from:%thisurl% to:%FileSaveName_final%
`n,%dir%\History_This_Dir.html FileAppend,%filename% - from:%thisurl% to:%FileSaveName_final%
`n,%A_ScriptDir%\History_Global.html This_Dir_Hist = %This_Dir_Hist%%filename% - from:%thisurl% to:%FileSaveName_final%
`n GL_Hist = %GL_Hist%%filename% - from:%thisurl% to:%FileSaveName_final%
`n If DownloadList ;just create a list for a download manager { ErrorLevel = FileAppend,%thisurl%`n,%dir%\%ThisRunTime%_DnlList.txt If not ErrorLevel { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon4",PthisTxt " ==> File added to download-list.") NumFiles += 1 x_url = %x_url%|%thisurl%¤%depth% ;history } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR while adding to download-list.") } } else If DownloadCopy ;just copy to clipboard { ErrorLevel = Clipboard := thisurl Sleep, 250 If not ErrorLevel { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon4",PthisTxt " ==> File copied to clipboard.") NumFiles += 1 x_url = %x_url%|%thisurl%¤%depth% ;history } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR while copying to clipboard.") } IfWinActive,ahk_class #32770 ;download adding window { If ConfirmDownloadWindow { Control,Uncheck,,Button7,A ;auto-generate filename ControlSetText,Edit5,%A_Now%_%filename%,A ;save as Sleep, 30 Send, {enter} Sleep, 250 IfWinActive,ahk_class #32770 ;download confirm window { Send, {enter} Sleep, 250 } } else { WinWaitNotActive,ahk_class #32770 ;download adding window } } } else If SR_Download_Multi ;my multi thread download method { ErrorLevel = Dnl = %Dnl%¤%thisurl%|%FileSaveName_final% ;Download Queue If not ErrorLevel { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon4",PthisTxt " ==> File " FileSaveName_final " added to " Dnlder_Name) NumFiles += 1 x_url = %x_url%|%thisurl%¤%depth% ;history } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR while adding " FileSaveName_final " to " Dnlder_Name) } } else ;oldfashioned one-thread download { Save2 = 1 ErrorLevel = URLDownloadToFile,%thisurl%,%FileSaveName% ;save to dir ;myURLDownloadToFile(thisurl,FileSaveName) If not ErrorLevel { ;Checking 404 Not Found in content ; FileGetSize,FileSize,%FileSaveName% ; If (FileSize < (10*1024)) ;if small - check content ; { ; FileRead,SavedFileContent,%FileSaveName% ; If SavedFileContent contains forbidden,not found ;if 404 not found - delete ; { ; TV_GetText(PthisTxt,Pthis) ; TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR CONTENT: 404 not found or 403 forbidden.") ; FileDelete,%FileSaveName% ; Save2 = ; } ; } If DupFilter { Loop, %dir%\*.* { thisFN := SubStr(A_LoopFileName,16) IfEqual,thisFN,%filename% IfEqual,A_LoopFileSize,%FileSize% { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> DUPL FILTER: " thisFN " file already downloaded. It is not saved.") FileDelete,%FileSaveName% Save2 = Break } } } If Save2 ;OK - leave it saved { Loop, 33 { FileCopy,%FileSaveName%,%FileSaveName_final%,1 If not ErrorLevel Break Sleep, 250 } If not ErrorLevel { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon4",PthisTxt " ==> File " FileSaveName_final " saved OK.") NumFiles += 1 x_url = %x_url%|%thisurl%¤%depth% ;history } else { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR COPYING " FileSaveName " to save location " FileSaveName_final) } FileDelete,%FileSaveName% } SavedFileContent = } else ;ErrorLevel URLDownloadToFile { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon2",PthisTxt " ==> ERROR DOWNLOADING.") FileDelete,%FileSaveName% } } } else ;not Save { If OutExtension in .srt,.txt,.doc,.pdf,.xls,.ppt,.pps,.mov,.mp3,.mpe,.wav,.mp4,.3gp,.avi,.mpg,.wmv,.wma,.flv,.jpg,.gif,.png,.zip,.rar,%rar_group% ;This was a file, but failed the extension filter { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> FILTER: File not in file-extension list.") Continue } If onlyStripping If not LinkStripped ;this is not a stripped link { TV_GetText(PthisTxt,Pthis) TV_Modify(Pthis,"Icon3",PthisTxt " ==> NOT FOLLOWING: not a stripped link.") Continue } x_url = %x_url%|%thisurl%¤%depth% ;history Down_and_Ripp(thisurl,Pthis,depth-1,dir,filters) } } FileDelete,%dir%\temp_depth%depth%.html If Tree_Collaps TV_Modify(Prnt,"-Expand") TV_Modify(Prnt,"Icon4") Return } StripLink(thisurl) { StringReplace,thisurl,thisurl,&,&,All thisurl := urlDecode(thisurl) RegExMatch(thisurl,".*[=*?]([^.]+\.[^.]+\.[^&]+)&?",match,10) ;...=str1.str2.str3...& match = %match1% If match IfNotInString,match,:// ;www... stripped link Return, "http://" . match else Return, match RegExMatch(thisurl,"i).*(u|url|link)=([^&]*)&?",match,1) field_name = %match1% match = %match2% If not match2 Return ;Base64Decode routine Ret := match2 Chars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ StringCaseSense On IfNotInString,Ret,. { Ret2 := Base64Decode(Ret) IfNotInString,Ret2,. { Ret3 := Base64Decode(SubStr(Ret,2,-1)) IfNotInString,Ret3,. Ret := "no_idea_" Ret else Ret := Ret3 } else Ret := Ret2 } else Ret := Ret StringCaseSense Off ;end Base64Decode routine IfNotInString,Ret,:// ;www... stripped link Return, "http://" . Ret else Return, Ret } urlDecode(str) { Loop If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex) StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All Else Break Return, str } Checkers: SetTimer, Checkers, OFF ;st1 := A_TickCount GoSub, Check_myDnlList ;se1 := A_TickCount-st1 ;st1 := A_TickCount GoSub, CheckReadyDNL ;se2 := A_TickCount-st1 ;st1 := A_TickCount GoSub, UpdateDownloadQueue ;se3 := A_TickCount-st1 SetTimer, Checkers, 1000 ;ToolTip Check_myDnlList %se1%`nCheckReadyDNL %se2%`nUpdateDownloadQueue %se3% Return ;#1::ListLines ;#2::ListVars CheckReadyDNL: Critical Loop, %Max_Threads% ;Check for finished runID { runIDx = runID%A_Index% IniRead, runID, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx%, %A_Space% If runID { StringSplit,tDnl,runID,| trunID = %tDnl1% turl = %tDnl2% tfil = %tDnl3% Process, Exist, %trunID% If not ErrorLevel ;This is ready { IniWrite, %A_Space%, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx% ;Post checking FileGetSize,size,%tfil% ;Check size if (size < (10*1024)) ;redirect html { FileRead,SavedFileContent,%tfil% ;if content = html code If SavedFileContent contains ,,
;faulty content IfNotInString,FilterList,.htm { ;delete file FileDelete,%tfil% ;Remove from run-history StringReplace,x_url,x_url,|%turl%,,All ;Remove from History_Global StringReplace,GL_Hist,GL_Hist,from %turl%,*DEL*,All Loop { pos1 := InStr(GL_Hist,"*DEL*") if not pos1 Break chunk1 := SubStr(GL_Hist,1,pos1) pos2 := InStr(chunk1,"",false,pos1) ;1st
forewords from pos1 If pos3 chunk3 := SubStr(GL_Hist,pos2,pos3+3-pos2) StringReplace,GL_Hist,GL_Hist,%chunk3%,,All } ;Remove from History_This_Dir StringReplace,This_Dir_Hist,This_Dir_Hist,from %turl%,*DEL*,All Loop { pos1 := InStr(This_Dir_Hist,"*DEL*") if not pos1 Break chunk1 := SubStr(This_Dir_Hist,1,pos1) pos2 := InStr(chunk1,"",false,pos1) ;1st
forewords from pos1 If pos3 chunk3 := SubStr(This_Dir_Hist,pos2,pos3+3-pos2) StringReplace,This_Dir_Hist,This_Dir_Hist,%chunk3%,,All } LinkList = %LinkList%`n%turl% } } } } } Return Check_myDnlList: Critical Loop, parse, Dnl, ¤ { IfEqual,A_LoopField, Continue StringSplit,tDnl,A_LoopField,| turl = %tDnl1% tfil = %tDnl2% delthis = Loop, %Max_Threads% ;Check for empty runID { runIDx = runID%A_Index% IniRead, runID, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx%, %A_Space% If !runID { ;run downloader - scriptname "url" "save file" "pos-index" "ShowDNLWin or get_highest_YT_quality" "proxy" If A_IsCompiled Run, "%Dnlder_Name%.exe" "%turl%" "%tfil%" %A_Index% %ShowDownloadWindows% %ProxyServer%,,,runID else Run, "%A_AhkPath%" "%Dnlder_Name%.ahk" "%turl%" "%tfil%" %A_Index% %ShowDownloadWindows% %ProxyServer%,,,runID IniWrite, %runID%|%turl%|%tfil%, %A_ScriptDir%\%Dnlder_Name%.ini, Running, %runIDx% delthis = 1 Break } } If delthis { StringReplace, Dnl, Dnl, %A_LoopField%,, A StringReplace, Dnl, Dnl, ¤¤,¤, A } } Return isDnlProc() { Global PrevProcDnlText,Dnlder_Name isDnlProc = 0 PrevProcDnl = PrevProcDnlText = ;Gui, 99:Add, Text, x20 y20 w300, Some downloads not finished from a previous session: Loop, Read, %A_ScriptDir%\%Dnlder_Name%.ini { pos := InStr(A_LoopReadLine,"=") If not pos Continue If (pos = StrLen(A_LoopReadLine)) Continue kell := SubStr(A_LoopReadLine,pos+1) kell = %kell% If not kell Continue isDnlProc += 1 StringSplit,tDnl,kell,| trunID = %tDnl1% turl = %tDnl2% tfil = %tDnl3% PrevProcDnl = %PrevProcDnl%¤%turl%|%tfil% ;Download Queue - PrevProc PrevProcDnlText = %PrevProcDnlText%`n%turl% ;Gui, 99:Add, Text, x20 y+10 w300, %turl% } Return, isDnlProc } UpdateDownloadQueue: ;Critical ;update Download Queue control StringReplace, DNL_Q, Dnl,¤,`n, A GuiControl,,DNL_Q,Waiting for download:`n%DNL_Q% ;update Download status controls If not ShowDownloadWindows GoSub, Dnl_Status_Update Return ;------------------------------------- ; AHK 1.0.46+ ; evaluate arithmetic expressions containing ; unary +,- (-2*3; +3) ; +,-,*,/,\(or % = mod); **(or @ = power) ; (..); var (pi, e); abs(),sqrt(),floor() Eval(x) { ; expression preprocessing Static pi = 3.141592653589793, e = 2.718281828459045 StringReplace x, x,[,, All ;Old [Var] compatibility StringReplace x, x,],, All ;Old [Var] compatibility StringReplace x, x,`%, \, All ; % -> \ for MOD x := RegExReplace(x,"\s*") ; remove whitespace x := RegExReplace(x,"([a-zA-Z]\w*)([^\w\(]|$)","%$1%$2") ; var -> %var% Transform x, Deref, %x% ; dereference all %var% StringReplace x, x, -, #, All ; # = subtraction StringReplace x, x, (#, (0#, All ; (-x -> (0-x If (Asc(x) = Asc("#")) x = 0%x% ; leading -x -> 0-x StringReplace x, x, (+, (, All ; (+x -> (x If (Asc(x) = Asc("+")) StringTrimLeft x, x, 1 ; leading +x -> x StringReplace x, x, **, @, All ; ** -> @ for easier process Loop { ; find innermost (..) If !RegExMatch(x, "(.*)\(([^\(\)]*)\)(.*)", y) Break x := y1 . Eval@(y2) . y3 ; replace "(x)" with value of x } Return Eval@(x) ; no more (..) } Eval@(x) { RegExMatch(x, "(.*)(\+|\#)(.*)", y) ; execute rightmost +- operator IfEqual y2,+, Return Eval@(y1) + Eval@(y3) IfEqual y2,#, Return Eval@(y1) - Eval@(y3) ; execute rightmost */% operator RegExMatch(x, "(.*)(\*|\/|\\)(.*)", y) IfEqual y2,*, Return Eval@(y1) * Eval@(y3) IfEqual y2,/, Return Eval@(y1) / Eval@(y3) IfEqual y2,\, Return Mod(Eval@(y1),Eval@(y3)) ; execute rightmost power StringGetPos i, x, @, R IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) ** Eval@(SubStr(x,2+i)) ; execute rightmost function If !RegExMatch(x,".*(abs|floor|sqrt)(.*)", y) Return x ; no more function IfEqual y1,abs, Return abs( Eval@(y2)) IfEqual y1,floor,Return floor(Eval@(y2)) IfEqual y1,sqrt, Return sqrt( Eval@(y2)) } ;#Include C:\Documents and Settings\Zsolt\Dokumentumok\Autohotkey scripts\myUpdater\myUpdater.ahk CheckUpdateX: fromMenu = 1 GoSub, CheckUpdate fromMenu = Return CheckUpdateMenu: fromMenu = 1 GoSub, CheckUpdate fromMenu = Return CheckUpdate: ;using upd_URL, SilentProgramUpdate If not CheckUpdate__Lang CheckUpdate__Lang = en NodeName = www.google.com IP__s := HostToIp(NodeName) DllCall("Ws2_32\WSACleanup") ; always inlude this line after calling to release the socket connection if IP__s <> -1 Sleep, 30 ;connected else Return ;not connected URLDownloadToFile, %upd_URL%, %A_ScriptDir%\upd_%A_ScriptName% IfNotExist, %A_ScriptDir%\upd_%A_ScriptName% Return CurrentVersion := myGetVersion(A_ScriptFullPath) DLVersion := myGetVersion(A_ScriptDir . "\upd_" . A_ScriptName) IfGreaterOrEqual, CurrentVersion, %DLVersion% { FileDelete, %A_ScriptDir%\upd_%A_ScriptName% If fromMenu IfEqual,CheckUpdate__Lang,hu MsgBox,0,Nincs frissítés,Internet verzió:`t%DLVersion%`nMeglévõ verzió:`t%CurrentVersion%`n`nMost nincs frissítés.,10 else MsgBox,0,No update,Internet version:`t%DLVersion%`nComputer version:`t%CurrentVersion%`n`nNo update now.,10 Return } If not SilentProgramUpdate { IfEqual,CheckUpdate__Lang,hu MsgBox,4,Frissítés a %A_ScriptName% programhoz,Új frissítés elérhetõ a %A_ScriptName% programhoz.`n`nMeglévõ verzió: %CurrentVersion%`nÚj verzió: %DLVersion%`n`nFrissíthetünk most? else MsgBox,4,New version for %A_ScriptName%,An updated version is available for %A_ScriptName%.`n`nCurrent version: %CurrentVersion%`nNew version: %DLVersion%`n`nDo you want to update now? IfMsgBox, No { FileDelete, %A_ScriptDir%\upd_%A_ScriptName% IfEqual,CheckUpdate__Lang,hu MsgBox,0,Nem frissítünk,Nem történt frissítés.,10 else MsgBox,0,No update now,No update now.,10 Return } } GoSub, DoUpdateReload Return myGetVersion(pth) { IfInString, pth, .ahk { Loop, Read, %pth% { StringSplit,ver,A_LoopReadLine,= thisVersion := ver2 Break } } else IfInString, pth, .exe FileGetVersion,thisVersion,%pth% else Return Return, thisVersion } DoUpdateReload: ;the Dir command should take a few seconds - used as a pause thisBATfile = %A_ScriptDir%\upd_this.bat FileDelete, %thisBATfile% FileAppend, ( dir c:\windows\system32 /b del "%A_ScriptDir%\%A_ScriptName%" copy "%A_ScriptDir%\upd_%A_ScriptName%" "%A_ScriptDir%\%A_ScriptName%" del "%A_ScriptDir%\upd_%A_ScriptName%" start "title" "%A_ScriptDir%\%A_ScriptName%" dir c:\windows\system32 /b del "%thisBATfile%" ), %thisBATfile% sleep, 3000 Run, %COMSPEC% /c "%thisBATfile%",,hide ExitApp Return HostToIp(NodeName) ; returns -1 if unsuccessfull or a newline seperated list of valid IP addresses { VarSetCapacity(wsaData, 32) ; The struct is only about 14 in size, so 32 is conservative. result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002) if ErrorLevel ; check ErrorLevel to see if the OS has Winsock 2.0 available: { MsgBox WSAStartup() could not be called due to error %ErrorLevel%. Winsock 2.0 or higher is required. return -1 } if result ; Non-zero, which means it failed (most Winsock functions return 0 on success). { MsgBox % "WSAStartup() indicated Winsock error " . DllCall("Ws2_32\WSAGetLastError") ; % return -1 } PtrHostent := DllCall("Ws2_32\gethostbyname", str, Nodename) if (PtrHostent = 0) Return -1 VarSetCapacity(hostent,16,0) DllCall("RtlMoveMemory",UInt,&hostent,UInt,PtrHostent,UInt,16) h_addr_list := ExtractInteger(hostent,12,false,4) VarSetCapacity(AddressList,12,0) DllCall("RtlMoveMemory",UInt,&AddressList,UInt,h_addr_list,UInt,12) Loop, 3 { offset := ((A_Index-1)*4) PtrAddress%A_Index% := ExtractInteger(AddressList,offset,false,4) If (PtrAddress%A_Index% =0) break VarSetCapacity(address%A_Index%,4,0) DllCall("RtlMoveMemory" ,UInt,&address%A_Index%,UInt,PtrAddress%A_Index%,Uint,4) i := A_Index Loop, 4 { if Straddress%i% Straddress%i% := Straddress%i% "." ExtractInteger(address%i%,(A_Index-1 ),false,1) else Straddress%i% := ExtractInteger(address%i%,(A_Index-1 ),false,1) } Straddress0 = %i% } loop, %Straddress0% ; put them together and return them { _this := Straddress%A_Index% if _this <> IPs = %IPs%%_this% if A_Index = %Straddress0% break IPs = %IPs%`n } return IPs } ExtractInteger(ByRef pSource, pOffset = 0, pIsSigned = false, pSize = 4) { Loop %pSize% result += *(&pSource+pOffset+A_Index-1) << 8*A_Index-8 Return result } get_highest_YT_quality(v1,t1,l1) { Global Dnlder_Name ;run downloader - scriptname "v1" "t1" "l1" "get_highest_YT_quality" "ProxyServer" If A_IsCompiled Run, "%Dnlder_Name%.exe" "%v1%" "%t1%" "%l1%" "get_highest_YT_quality" %ProxyServer%,,,get_highest_YT_quality_runID else Run, "%A_AhkPath%" "%Dnlder_Name%.ahk" "%v1%" "%t1%" "%l1%" "get_highest_YT_quality" %ProxyServer%,,,get_highest_YT_quality_runID DetectHiddenWindows,On WinWait,VidRipper_Dnl_YTq,,5 ret = Loop 100000 { ControlGetText,ret,Static1,VidRipper_Dnl_YTq If ret Break Sleep, 100 } Process,Close,%get_highest_YT_quality_runID% WinWaitClose,VidRipper_Dnl_YTq DetectHiddenWindows,Off If not ret ret = 5 Return, ret } get_highest_YT_quality_old(v1,t1,l1) { ; // fmt=0 -> flv: 320x240 (flv1) / mp3 1.0 22KHz (same as fmt=5) ; // fmt=5 -> flv: 320x240 (flv1) / mp3 1.0 22KHz ; // fmt=6 -> flv: 480x360 (flv1) / mp3 1.0 44KHz (No more...) ; // fmt=13 -> 3gp: 176x144 (mpg4) / ??? 2.0 8KHz ; // fmt=17 -> 3gp: 176x144 (mpg4) / ??? 1.0 22KHz ; // fmt=18 -> mp4: 480x360 (H264) / AAC 2.0 44KHz ; // fmt=22 -> mp4: 1280x720 (H264) / AAC 2.0 44KHz ; // fmt=34 -> flv: 320x240 (flv?) / ??? 2.0 44KHz (default now) ; // fmt=35 -> flv: 640x380 (flv?) / ??? 2.0 44KHz fmts = 22|35|18|6 loop, parse, fmts, | { HQtag = &fmt=%A_LoopField% url = http://www.youtube.com/get_video?video_id=%v1%&l=%l1%&t=%t1%%HQtag% info2 := HttpQueryInfo(url,1) ;MsgBox, info2 = %info2% If info2 not contains timeout,text Return, %A_LoopField% } Return, 5 } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QueryInfoFlag HTTP_QUERY_RAW_HEADERS = 21 Receives all the headers returned by the server. Each header is terminated by "\0". An additional "\0" terminates the list of headers. HTTP_QUERY_CONTENT_LENGTH = 5 Retrieves the size of the resource, in bytes. HTTP_QUERY_CONTENT_TYPE = 1 Receives the content type of the resource (such as text/html). Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp Proxy Settings: INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration INTERNET_OPEN_TYPE_DIRECT 1 // direct to net INTERNET_OPEN_TYPE_PROXY 3 // via named proxy INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS */ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") { hModule := DllCall("LoadLibrary", "str", "wininet.dll") If (Proxy != "") AccessType=3 Else AccessType=1 io_hInternet := DllCall("wininet\InternetOpenA" , "str", "" ;lpszAgent , "uint", AccessType , "str", Proxy , "str", ProxyBypass , "uint", 0) ;dwFlags If (ErrorLevel != 0 or io_hInternet = 0) { DllCall("FreeLibrary", "uint", hModule) return, -1 } iou_hInternet := DllCall("wininet\InternetOpenUrlA" , "uint", io_hInternet , "str", url , "str", "" ;lpszHeaders , "uint", 0 ;dwHeadersLength , "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item , "uint", 0) ;dwContext If (ErrorLevel != 0 or iou_hInternet = 0) { DllCall("FreeLibrary", "uint", hModule) return, -1 } VarSetCapacity(buffer, 1024, 0) VarSetCapacity(buffer_len, 4, 0) Loop, 2 { hqi := DllCall("wininet\HttpQueryInfoA" , "uint", iou_hInternet , "uint", QueryInfoFlag ;dwInfoLevel , "uint", &buffer , "uint", &buffer_len , "uint", 0) ;lpdwIndex If (hqi = 1) { hqi=success break } } IfNotEqual, hqi, success, SetEnv, res, timeout If (hqi = "success") { p := &buffer Loop { l := DllCall("lstrlen", "UInt", p) VarSetCapacity(tmp_var, l+1, 0) DllCall("lstrcpy", "Str", tmp_var, "UInt", p) p += l + 1 res := res . "`n" . tmp_var If (*p = 0) Break } StringTrimLeft, res, res, 1 } DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet) DllCall("wininet\InternetCloseHandle", "uint", io_hInternet) DllCall("FreeLibrary", "uint", hModule) return, res } Base64Decode(code) { StringReplace code, code, =,,All Loop Parse, code { m := A_Index & 3 ; mod 4 IfEqual m,0, { buffer += B64_DeCode(A_LoopField) out := out Chr(buffer>>16) Chr(255 & buffer>>8) Chr(255 & buffer) } Else IfEqual m,1, SetEnv buffer, % B64_DeCode(A_LoopField) << 18 Else buffer += B64_DeCode(A_LoopField) << 24-6*m } IfEqual m,0, Return out IfEqual m,2, Return out Chr(buffer>>16) Return out Chr(buffer>>16) Chr(255 & buffer>>8) } B64_DeCode(c) { ; c = a char in Chars ==> position [0,63] Global Chars Chars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ Return InStr(Chars,c,1) - 1 } Unicode2Ansi(ByRef wString, ByRef sString, nLen = 0) { pString := wString + 0 > 65535 ? wString : &wString If !nLen nLen := DllCall("WideCharToMultiByte" , "Uint", 0 , "Uint", 0 , "Uint", pString , "int", -1 , "Uint", 0 , "int", 0 , "Uint", 0 , "Uint", 0) VarSetCapacity(sString, nLen) DllCall("WideCharToMultiByte" , "Uint", 0 , "Uint", 0 , "Uint", pString , "int", -1 , "str", sString , "int", nLen , "Uint", 0 , "Uint", 0) }