; Includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ; Options OnAutoItExitRegister("_On_Exit") ; Varriables ; Static ; Undeclared Global $s_RSS Global $h_GUI[2] Global $s_RSS_TV[1] Global $s_RSS_Movie[1] Global $i_Current_GUI = 0 Global $i_Failed = 0 ; Integers Global $i_Min_Cols = 2 Global $i_Max_Years = 3 Global $i_Font_Size = 16 Global $i_GUI_Padding = 30 Global $i_Last_Position = 1 Global $i_Hide_Scrollbar = 0 Global $i_Current_Year = @Year Global $i_Max_Width_Default = Round(@DesktopWidth * (6/7)) Global $i_Max_Height_Default = Round(@DesktopHeight * (6/7)) Global $i_Max_Width = $i_Max_Width_Default Global $i_Max_Height = $i_Max_Height_Default ; Colors Global $i_Font_Color = 0xDCDCDC Global $i_Background_Color_1 = 0x171717 Global $i_Background_Color_2 = 0x282828 ; Arrays Global $a_Year[0] Global $a_Information[0][0] Global $a_Scrollbar_Info_Extra[1][9] Global $a_Scrollbar_Info[1][10] = [[0, 0, 0, 0, -1]] Global $a_Movie[2] = ["68747470733A2F2F7974732E61672F7273732F302F616C6C2F616C6C2F30", "68747470733A2F2F7974732E61672F7273732F302F"] Global $a_TV[2] = ["687474703A2F2F6578747261746F7272656E742E63632F7273732E786D6C3F747970653D706F70756C6172266369643D38", "687474703A2F2F6578747261746F7272656E742E63632F7273732E786D6C3F747970653D706F70756C617226747970653D736561726368267365617263683D"] ; Strings Global $s_Settings = @ScriptDir & "\Videos.ini" Global $s_Download_Path = @UserProfileDir & "\Downloads\" Global $s_Sound = "C:\Users\Tyler\Documents\Programming\Autoit\Sounds\Pulse.mp3" ; Dynamic ; Video Settings Global $i_TV = _Settings_Read("Videos", "$i_TV") Global $i_Top = _Settings_Read("Videos", "$i_Top", -1) Global $i_Left = _Settings_Read("Videos", "$i_Left", -1) Global $i_Maximized = _Settings_Read("Videos", "$i_Maximized") Global $i_Year = _Settings_Read("Videos", "$i_Year") Global $i_Rating = _Settings_Read("Videos", "$i_Rating") Global $i_Search = _Settings_Read("Videos", "$i_Search") Global $i_Movie = _Settings_Read("Videos", "$i_Movie", 1) Global $i_Genre = _Settings_Read("Videos", "$i_Genre", "all") Global $i_Quality = _Settings_Read("Videos", "$i_Quality", "all") ; Executable _Startup() ; Functions ; Download RSS Func _Download_RSS() Local $s_Split_1, $s_Split_2, $h_Download, $i_Start_Year $s_RSS_Movie[0] = _HexToString($a_Movie[1]) & $i_Quality & "/" & $i_Genre & "/" & $i_Rating $s_RSS_TV[0] = _HexToString($a_TV[1]) & $i_Search If StringInStr($i_Year, "+") Then $i_Start_Year = Int(StringStripWS(StringReplace($i_Year, "+", ""), 8)) If ($i_Current_Year - $i_Start_Year + 1) > $i_Max_Years Then Redim $a_Year[$i_Max_Years] Else Redim $a_Year[$i_Current_Year - $i_Start_Year + 1] EndIf For $i = 0 To UBound($a_Year) - 1 $a_Year[$i] = $i_Start_Year + $i Next Else Redim $a_Year[1] $a_Year[0] = Int($i_Year) EndIf If $i_Movie Then For $i = 0 To UBound($s_RSS_Movie) - 1 For $j = 0 To UBound($a_Year) - 1 $s_Split_1 = StringSplit($s_RSS_Movie[$i], "/rss/", 1) $s_Split_2 = StringSplit($s_Split_1[2], "/") _InetGet($s_Split_1[1] & "/rss/" & $a_Year[$j] & "/" & $s_Split_2[2] & "/" & $s_Split_2[3] & "/" & $s_Split_2[4], $s_Download_Path & "RSS.txt") $s_RSS = $s_RSS & FileRead($s_Download_Path & "RSS.txt") Next Next ElseIf $i_TV Then For $i = 0 To UBound($s_RSS_TV) - 1 If StringCompare($i_Search, "0") = 0 Then _InetGet(_HexToString($a_TV[0]), $s_Download_Path & "RSS.txt") Else _InetGet($s_RSS_TV[$i], $s_Download_Path & "RSS.txt") EndIf $s_RSS = $s_RSS & FileRead($s_Download_Path & "RSS.txt") Next EndIf EndFunc ; Parse Titles Func _Parse_Titles() Local $s_Titles If $i_Movie Then $s_Titles = _StringBetween($s_RSS, "<![CDATA[", "]") ElseIf $i_TV Then $s_Titles = _StringBetween($s_RSS, "<item><title><![CDATA[", "]") EndIf If IsArray($s_Titles) Then For $i = 0 To UBound($s_Titles) - 1 $s_Titles[$i] = StringReplace($s_Titles[$i], ".", " ") $s_Titles[$i] = StringReplace($s_Titles[$i], " -", "") Next Redim $a_Information[UBound($s_Titles) - 1][8] For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][0] = $s_Titles[$i] Next EndIf EndFunc ; Parse Quality Func _Parse_Quality() Local $s_Split For $i = 0 To UBound($a_Information) - 1 If StringInStr($a_Information[$i][0], "3d", 0) Then $a_Information[$i][1] = 6 ElseIf StringInStr($a_Information[$i][0], "1080", 0) Then $a_Information[$i][0] = StringReplace($a_Information[$i][0], "1080", "") $a_Information[$i][1] = 5 ElseIf StringInStr($a_Information[$i][0], "720", 0) Then $a_Information[$i][0] = StringReplace($a_Information[$i][0], "720", "") $a_Information[$i][1] = 4 ElseIf StringInStr($a_Information[$i][0], "bdrip", 0) Or StringInStr($a_Information[$i][0], "brrip", 0) Or StringInStr($a_Information[$i][0], "dvdrip", 0) Or StringInStr($a_Information[$i][0], "webrip", 0) Then $a_Information[$i][1] = 3 ElseIf StringInStr($a_Information[$i][0], "hdrip", 0) Or StringInStr($a_Information[$i][0], "hdtv", 0) Or StringInStr($a_Information[$i][0], "web-dl", 0) Or StringInStr($a_Information[$i][0], "mpeg", 0) Then $a_Information[$i][1] = 2 ElseIf StringInStr($a_Information[$i][0], "cam", 0) Or StringInStr($a_Information[$i][0], "tc", 0) Then $a_Information[$i][1] = 1 Else $a_Information[$i][1] = 0 EndIf Next EndFunc ; Parse Year Func _Parse_Year() Local $a_Match If $i_Movie Then For $i = 0 To UBound($a_Information) - 1 If StringInStr($a_Information[$i][0], "20") Then $a_Information[$i][2] = StringLeft(StringTrimLeft($a_Information[$i][0], StringInStr($a_Information[$i][0], "20") - 1), 4) ElseIf StringInStr($a_Information[$i][0], "19") Then $a_Information[$i][2] = StringLeft(StringTrimLeft($a_Information[$i][0], StringInStr($a_Information[$i][0], "19") - 1), 4) Else $a_Information[$i][2] = 0 EndIf Next ElseIf $i_TV Then For $i = 0 To UBound($a_Information) - 1 $a_Match = StringRegExp($a_Information[$i][0], "[sS][0-9][0-9]", 1) If IsArray($a_Match) Then $a_Information[$i][2] = Int(StringTrimLeft($a_Match[0], 1)) EndIf $a_Match = StringRegExp($a_Information[$i][0], "[eE][0-9][0-9]", 1) If IsArray($a_Match) Then $a_Information[$i][3] = Int(StringTrimLeft($a_Match[0], 1)) EndIf If $a_Information[$i][2] = "" Then $a_Information[$i][2] = 0 If $a_Information[$i][3] = "" Then $a_Information[$i][3] = 0 Next EndIf EndFunc ; Parse Clean Func _Parse_Clean() Local $a_Match For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][0] = StringReplace($a_Information[$i][0], "(", "") $a_Information[$i][0] = StringReplace($a_Information[$i][0], ")", "") $a_Information[$i][0] = StringReplace($a_Information[$i][0], "[", "") $a_Information[$i][0] = StringReplace($a_Information[$i][0], "]", "") $a_Information[$i][0] = StringReplace($a_Information[$i][0], "{", "") $a_Information[$i][0] = StringReplace($a_Information[$i][0], "}", "") $a_Match = StringRegExp($a_Information[$i][0], "[sS][0-9][0-9]", 1) If IsArray($a_Match) Then $a_Information[$i][0] = StringSplit($a_Information[$i][0], $a_Match[0], 1)[1] $a_Match = StringRegExp($a_Information[$i][0], "[eE][0-9][0-9]", 1) If IsArray($a_Match) Then $a_Information[$i][0] = StringSplit($a_Information[$i][0], $a_Match[0], 1)[1] $a_Match = StringRegExp($a_Information[$i][0], "[0-9][0-9][0-9][0-9]", 1) If IsArray($a_Match) Then $a_Information[$i][0] = StringSplit($a_Information[$i][0], $a_Match[0], 1)[1] $a_Information[$i][0] = StringStripWS($a_Information[$i][0], $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES) Next EndFunc ; Parse Images Func _Parse_Images() If $i_Movie Then Local $s_Covers = _StringBetween($s_RSS, '<img src="', '"') If IsArray($s_Covers) Then For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][4] = $s_Covers[$i] Next EndIf EndIf EndFunc ; Parse Rating Func _Parse_Rating() If $i_Movie Then Local $s_Ratings = _StringBetween($s_RSS, "IMDB Rating: ", "<") If IsArray($s_Ratings) Then For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][3] = StringTrimRight($s_Ratings[$i], 3) Next EndIf EndIf EndFunc ; Parse Downloads Func _Parse_Downloads() Local $s_Downloads = _StringBetween($s_RSS, '<enclosure url="', '"') If IsArray($s_Downloads) Then For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][5] = $s_Downloads[$i] Next EndIf EndFunc ; Parse Website Func _Parse_Website() Local $s_Website = _StringBetween($s_RSS, '<a href="', '"') If IsArray($s_Website) Then For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][6] = $s_Website[$i] Next EndIf EndFunc ; Delete Repeats Func _Delete_Repeats() Local $i_Rows = Ubound($a_Information, 1), $i_Cols = Ubound($a_Information, 2), $a_Temp[$i_Rows][$i_Cols], $i_Count = 0, $i_Bound_1 = UBound($a_Information) - 1, $i_Bound_2 = UBound($a_Information) - 1 $s_RSS = "" While $i_Bound_1 >= 0 $i_Bound_2 = UBound($a_Information) - 1 While $i_Bound_2 >= 0 If ($i_Bound_1 <> $i_Bound_2) And (StringCompare($a_Information[$i_Bound_1][0], $a_Information[$i_Bound_2][0]) = 0) And (StringCompare($a_Information[$i_Bound_1][1], $a_Information[$i_Bound_2][1]) = 0) And (StringCompare($a_Information[$i_Bound_1][2], $a_Information[$i_Bound_2][2]) = 0) And (StringCompare($a_Information[$i_Bound_1][3], $a_Information[$i_Bound_2][3]) = 0) Then $a_Information[$i_Bound_1][0] = "" $i_Bound_2 = $i_Bound_2 - 1 Wend $i_Bound_1 = $i_Bound_1 - 1 Wend For $i = 0 to $i_Rows - 1 If $a_Information[$i][0] <> "" Then For $j = 0 To $i_Cols - 1 $a_Temp[$i_Count][$j] = $a_Information[$i][$j] Next $i_Count = $i_Count + 1 EndIf Next Redim $a_Temp[$i_Count][$i_Cols] $a_Information = $a_Temp For $i = 0 To UBound($a_Information) - 1 $a_Information[$i][7] = $a_Information[$i][2] & StringReplace($a_Information[$i][3], ".", "") & $a_Information[$i][0] & $a_Information[$i][1] Next _ArraySort($a_Information, 1, 0, 0, 7) EndFunc ; Helper ; Startup Func _Startup() _Download_RSS() _Parse_Titles() _Parse_Quality() _Parse_Year() _Parse_Clean() _Parse_Images() _Parse_Rating() _Parse_Downloads() _Parse_Website() _Delete_Repeats() _GUI_Videos() EndFunc ; Error Func _Tray_Error($s_Tray_Error = "Unkown Error!") ToolTip("", 0, 0) TraySetState(1) TrayTip("Autoit Error", $s_Tray_Error, 10, 3) TraySetState(2) If FileExists($s_Sound) Then SoundPlay($s_Sound, 1) _Settings_Write("Videos", "$i_Quality", "all") _Settings_Write("Videos", "$i_Genre", "all") _Settings_Write("Videos", "$i_Rating", 0) _Settings_Write("Videos", "$i_Year", 0) Exit EndFunc ; On Exit Func _On_Exit() _File_Delete($s_Download_Path & "0.torrent") _File_Delete($s_Download_Path & "RSS.txt") If $i_Last_Position Then If $i_Maximized = $WS_MAXIMIZE Then _Settings_Write("Videos", "$i_Maximized", $WS_MAXIMIZE) Else _Settings_Write("Videos", "$i_Maximized", 0) EndIf _Toggle_GUI() $a_Win_Pos = WinGetPos($h_GUI[$i_Current_GUI]) If IsArray($a_Win_Pos) Then _Settings_Write("Videos", "$i_Top", $a_Win_Pos[1]) _Settings_Write("Videos", "$i_Left", $a_Win_Pos[0]) EndIf Else _Settings_Write("Videos", "$i_Top", -1) _Settings_Write("Videos", "$i_Left", -1) EndIf EndFunc ; General Func _Settings_Write($s_Section, $s_Key, $s_Value) If Not FileExists($s_Settings) Then _FileCreate($s_Settings) RunWait(@ComSpec & ' /c ' & 'attrib +h "' & $s_Settings & '"', @TempDir, @SW_HIDE) EndIf IniWrite($s_Settings, $s_Section, $s_Key, $s_Value) EndFunc Func _Settings_Read($s_Section, $s_Key, $s_Default = 0) Local $s_Read, $a_Read, $a_Read_1[1], $a_Split If Not FileExists($s_Settings) Then _FileCreate($s_Settings) RunWait(@ComSpec & ' /c ' & 'attrib +h "' & $s_Settings & '"', @TempDir, @SW_HIDE) EndIf $s_Read = IniRead($s_Settings, $s_Section, $s_Key, $s_Default) If $s_Read = $s_Default Then _Settings_Write($s_Section, $s_Key, $s_Default) If StringCompare(StringLeft($s_Key, 2), "$a") = 0 Then If StringInStr($s_Read, ",") Then $a_Read = StringSplit(StringStripWS($s_Read, 8), ",", 8) _ArrayDelete($a_Read, 0) Return $a_Read Else If StringIsDigit($s_Read) Then $a_Read_1[0] = Int($s_Read) Return $a_Read_1 Else $a_Read_1[0] = $s_Read Return $a_Read_1 EndIf EndIf EndIf If StringIsDigit($s_Read) Then $s_Read = Int($s_Read) Return $s_Read EndFunc Func _File_Delete($s_File, $i_Timer = 1000) If FileExists($s_File) Then Local $i_Timer_Diff, $i_Timer_Init = TimerInit() FileDelete($s_File) While FileExists($s_File) Sleep(20) $i_Timer_Diff = TimerDiff($i_Timer_Init) If $i_Timer_Diff > $i_Timer Then _Tray_Error("File Delete Failed: " & $s_File) Wend EndIf EndFunc Func _Toggle_GUI() If $i_Current_GUI Then $i_Current_GUI = 0 ElseIf Not $i_Current_GUI Then $i_Current_GUI = 1 EndIf EndFunc Func _InetGet($s_URL, $s_File_Name, $i_Timeout = 2000) Local $i_Timer_Diff, $i_Timer_Init = TimerInit(), $i_Download If $i_Failed > 3 Then _Tray_Error("Failed to Download: " & $s_URL) $i_Download = InetGet($s_URL, $s_File_Name, 16, 1) If @error Then _Tray_Error("Internet Connection Error.") While Not InetGetInfo($i_Download, 2) Sleep(20) $i_Timer_Diff = TimerDiff($i_Timer_Init) If $i_Timer_Diff > $i_Timeout Then $i_Failed = $i_Failed + 1 _InetGet($s_URL, $s_File_Name) EndIf Wend $i_Failed = 0 EndFunc ; Graphical User Interfaces Func _GUI_Videos() Local $i_Maximum_Width = 0, $i_Cols = 10, $i_Rows = UBound($a_Information), $i_Left_Margin = 0, $a_Win_Pos, $i_Top_Margin = 0, $h_User_DLL = DllOpen("user32.dll"), $a_Download_Buttons[UBound($a_Information)], $a_Pictures[UBound($a_Information)], $a_Color_Status[UBound($a_Information)], $i_Inner_GUI_Width, $i_GUI_Width = ($i_Font_Size * 25) + ($i_GUI_Padding * 2), $i_GUI_Inner_Height, $i_GUI_Height = ($i_GUI_Padding * 4) + ($i_Font_Size * 2), $i_Count = 0, $i_Block_Height = $i_Font_Size * 14, $i_Block_Width, $i_Block_Left_Padding = $i_GUI_Padding + ($i_Font_Size * 2), $i_Block_Top_Padding = Round($i_GUI_Padding / 2) + ($i_Font_Size * 9), $h_Open, $h_Connect, $a_File, $i_Website, $i_Longest = 0, $i_Gaps, $i_Height, $i_Found = 1, $s_Split, $h_Quality, $h_Year, $h_Rating, $h_Move_Title, $h_Videos, $h_Refresh, $h_Year_Input, $h_Quality_Combo, $h_Genre_Combo, $h_Rating_Combo, $i_GUI_Height_Extra = 0, $i_GUI_Width_Extra = 0, $i_Color = 0, $h_Search, $i_Center = 0, $s_Previous_Input, $i_Year_Default, $h_Switch, $h_Search_Input, $a_Color_Boxes[7][2], $s_String, $h_Empty, $s_Current_String, $i_Counter, $a_String_Size, $i_Max_String_Height = 1, $i_Image_Width = -$i_Font_Size, $i_Image_Width_Default = 221, $i_Image_Height = -$i_Font_Size, $i_Image_Height_Default = 345 If $i_Rows = 0 Then $i_GUI_Height_Extra = $i_GUI_Height_Extra + ($i_Font_Size * 7) + $i_GUI_Padding If $i_Maximized = $WS_MAXIMIZE Then $i_GUI_Width = @DesktopWidth - 4 $h_GUI[$i_Current_GUI] = GUICreate("", $i_GUI_Width + 4, $i_GUI_Height + $i_GUI_Height_Extra, $i_Left, $i_Top, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $i_Maximized) $i_Left = -1 $i_Top = -1 Else For $i = 0 To UBound($a_Information) - 1 If $i_Maximum_Width < StringLen($a_Information[$i][0]) Then $i_Maximum_Width = StringLen($a_Information[$i][0]) $i_Longest = $i EndIf Next If $i_Movie Then $i_Image_Height = $i_Image_Height_Default $i_Image_Width = $i_Image_Width_Default EndIf If $i_Maximized = $WS_MAXIMIZE Then $i_Max_Width = @DesktopWidth $i_Block_Width = $i_Font_Size * 19 $a_String_Size = StringSplit($a_Information[$i_Longest][0], " ", 1) While $i_Counter < UBound($a_String_Size) - 1 $i_Counter = $i_Counter + 1 $s_Current_String = $s_Current_String & $a_String_Size[$i_Counter] & " " If _String_Size($s_Current_String, "w", $i_Font_Size) > ($i_Block_Width - ($i_Font_Size * 6) - 4) Then $s_Current_String = "" $i_Max_String_Height = $i_Max_String_Height + 1 $i_Counter = $i_Counter - 1 EndIf Wend $i_Max_String_Height = Round($i_Max_String_Height * Round($i_Font_Size * 1.5)) + Round($i_Font_Size / 2) $i_Block_Height = $i_Block_Height + $i_Image_Height + $i_Max_String_Height If $i_Maximized = 0 Then $i_Cols = Ceiling(Sqrt($i_Rows)) If $i_Cols < $i_Min_Cols Then $i_Cols = $i_Min_Cols $i_GUI_Width = ($i_Block_Width * $i_Cols) + $i_GUI_Padding + $i_Block_Left_Padding While $i_GUI_Width > $i_Max_Width $i_Cols = $i_Cols - 1 $i_GUI_Width = ($i_Block_Width * $i_Cols) + $i_GUI_Padding + $i_Block_Left_Padding Wend $i_Rows = Ceiling($i_Rows / $i_Cols) $i_GUI_Height = (Ceiling(UBound($a_Information) / $i_Cols) * $i_Block_Height) + $i_Block_Top_Padding $i_GUI_Height_Extra = $i_GUI_Height_Extra + ($i_Font_Size * 8) + $i_GUI_Padding If ($i_Rows <= 2) And $i_TV Then $i_GUI_Height_Extra = $i_GUI_Height_Extra + ($i_Font_Size * 3) If $i_Maximized = $WS_MAXIMIZE Then $i_Hide_Scrollbar = 1 Else $i_Hide_Scrollbar = 0 EndIf $i_Height = $i_GUI_Height EndIf If ($i_GUI_Height + $i_GUI_Height_Extra) > $i_Max_Height Then $i_Height = $i_Max_Height - $i_GUI_Height_Extra If $i_Hide_Scrollbar Then $h_GUI[$i_Current_GUI] = GUICreate("", $i_GUI_Width + 4, $i_Height + $i_GUI_Height_Extra, $i_Left, $i_Top, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $i_Maximized) $i_Left = -1 $i_Top = -1 ElseIf Not $i_Hide_Scrollbar Then $h_GUI[$i_Current_GUI] = GUICreate("", $i_GUI_Width + 22, $i_Height + $i_GUI_Height_Extra, $i_Left, $i_Top, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $i_Maximized) $i_Left = -1 $i_Top = -1 EndIf _Scrollbar($h_GUI[$i_Current_GUI], 0, $i_GUI_Height + $i_GUI_Height_Extra, $i_Hide_Scrollbar) Else $h_GUI[$i_Current_GUI] = GUICreate("", $i_GUI_Width, $i_GUI_Height + $i_GUI_Height_Extra, $i_Left, $i_Top, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $i_Maximized) $i_Left = -1 $i_Top = -1 EndIf GUISetBkColor($i_Background_Color_1) GUICtrlSetDefColor($i_Font_Color) GUISetFont(Round($i_Font_Size * 1.5), 400, "", "Times New Roman") If $i_Movie Then $h_Videos = GUICtrlCreateGroup("", $i_GUI_Padding, Round($i_GUI_Padding / 2) + ($i_Font_Size * 2), $i_GUI_Width - ($i_GUI_Padding * 2) + $i_GUI_Width_Extra, $i_GUI_Height - $i_Font_Size - $i_GUI_Padding, $BS_CENTER) GUICtrlCreateLabel("Movies", $i_GUI_Padding + 2, Round($i_GUI_Padding / 2), $i_GUI_Width - ($i_GUI_Padding * 2) + $i_GUI_Width_Extra - 4, $i_Font_Size * 2, $SS_CENTER) ElseIf $i_TV Then $h_Videos = GUICtrlCreateGroup("", $i_GUI_Padding, Round($i_GUI_Padding / 2) + ($i_Font_Size * 2), $i_GUI_Width - ($i_GUI_Padding * 2) + $i_GUI_Width_Extra, $i_GUI_Height - $i_Font_Size - $i_GUI_Padding, $BS_CENTER) GUICtrlCreateLabel("Television", $i_GUI_Padding + 2, Round($i_GUI_Padding / 2), $i_GUI_Width - ($i_GUI_Padding * 2) + $i_GUI_Width_Extra - 4, $i_Font_Size * 2, $SS_CENTER) EndIf GUICtrlCreateGraphic($i_GUI_Padding, Round($i_GUI_Padding / 2) + ($i_Font_Size * 2) + Round($i_Font_Size * (4.5/4)), $i_GUI_Width - ($i_GUI_Padding * 2) + $i_GUI_Width_Extra, $i_GUI_Height - $i_Font_Size - $i_GUI_Padding - Round($i_Font_Size * (4.5/4)), $GUI_SS_DEFAULT_LABEL) GUICtrlSetBkColor(-1, $i_Background_Color_2) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Videos), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Move_Title, $i_Font_Color) If $i_Rows <> 0 Then GUISetFont(Round($i_Font_Size * 0.8), 400, "", "Times New Roman") For $i = 0 To UBound($a_Color_Boxes) - 1 $a_Color_Boxes[$i][0] = GUICtrlCreateGraphic(Round(($i_GUI_Width - ($i_GUI_Padding * 3) + $i_GUI_Width_Extra - (($i_Font_Size + Round($i_GUI_Padding / 5)) * 24)) / 2) + $i_GUI_Padding + ((($i_Font_Size + Round($i_GUI_Padding / 8)) * 4) * $i) + Round($i_Font_Size * (2.5/2)), ($i_Block_Top_Padding - Round($i_Font_Size * 5.5)) + Round($i_GUI_Padding / 2) + Round($i_Font_Size * (2.5/2)) + 7, Round($i_Font_Size * 1.5), Round($i_Font_Size * 1.5)) $a_Color_Boxes[$i][1] = GUICtrlCreateGroup("", Round(($i_GUI_Width - ($i_GUI_Padding * 3) + $i_GUI_Width_Extra - (($i_Font_Size + Round($i_GUI_Padding / 5)) * 24)) / 2) + $i_GUI_Padding + ((($i_Font_Size + Round($i_GUI_Padding / 8)) * 4) * $i), ($i_Block_Top_Padding - Round($i_Font_Size * 5.5)) + Round($i_GUI_Padding / 2), ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) GUICtrlSetBkColor(-1, $i_Background_Color_2) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($a_Color_Boxes[$i][1]), "wstr", 0, "wstr", 0) GUICtrlSetColor($a_Color_Boxes[$i][1], $i_Font_Color) Switch $i_Color Case 6 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0xA52FE8) GUICtrlSetData($a_Color_Boxes[6][1], "3D") Case 5 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0x3A6EFF) GUICtrlSetData($a_Color_Boxes[5][1], "1080p") Case 4 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0x29E8CB) GUICtrlSetData($a_Color_Boxes[4][1], "720p") Case 3 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0x46FF2D) GUICtrlSetData($a_Color_Boxes[3][1], "BRRip") Case 2 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0xD2E82B) GUICtrlSetData($a_Color_Boxes[2][1], "HDRip") Case 1 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0xE87941) GUICtrlSetData($a_Color_Boxes[1][1], "Cam") Case 0 GUICtrlSetBkColor($a_Color_Boxes[$i][0], 0xFF2D2D) GUICtrlSetData($a_Color_Boxes[0][1], "DNE") EndSwitch $i_Color = $i_Color + 1 Next If $i_Movie Then For $i = 0 To UBound($a_Information) - 1 $s_Split = StringSplit($a_Information[$i][4], "/", 1) $s_Split = StringSplit($s_Split[UBound($s_Split) - 1], ".", 1) _InetGet($a_Information[$i][4], $s_Download_Path & $i & "." & $s_Split[2]) Next EndIf For $j = 1 To $i_Rows For $i = 1 To $i_Cols If $i_Count < UBound($a_Information) Then GUISetFont($i_Font_Size, 400, "", "Times New Roman") GUICtrlCreateGroup("", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding, $i_Block_Width - ($i_Font_Size * 2), $i_Block_Height - ($i_Font_Size * 2), $BS_CENTER) GUICtrlCreateGraphic($i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + Round($i_Font_Size * (3 / 4)), $i_Block_Width - ($i_Font_Size * 2), $i_Block_Height - ($i_Font_Size * 2) - Round($i_Font_Size * (3/4)), $GUI_SS_DEFAULT_LABEL) GUICtrlSetBkColor(-1, $i_Background_Color_1) GUICtrlCreateLabel($a_Information[$i_Count][0], $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 2) + 2, ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2), $i_Block_Width - ($i_Font_Size * 6) - 4, $i_Max_String_Height, $SS_CENTER) GUICtrlSetBkColor(-1, $i_Background_Color_1) GUISetFont(Round($i_Font_Size * 0.8), 400, "", "Times New Roman") $h_Quality = GUICtrlCreateGroup("Quality", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + $i_Font_Size + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2) + $i_Max_String_Height, ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) GUICtrlSetBkColor(-1, $i_Background_Color_1) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Quality), "wstr", 0, "wstr", 0) $a_Color_Status[$i_Count] = GUICtrlCreateGraphic($i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + Round($i_Font_Size * 2.3) + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + Round($i_Font_Size * 3.6) + $i_Max_String_Height, Round($i_Font_Size * 1.5), Round($i_Font_Size * 1.5)) Switch $a_Information[$i_Count][1] Case 6 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0xA52FE8) Case 5 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0x3A6EFF) Case 4 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0x29E8CB) Case 3 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0x46FF2D) Case 2 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0xD2E82B) Case 1 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0xE87941) Case 0 GUICtrlSetBkColor($a_Color_Status[$i_Count], 0xFF2D2D) EndSwitch If $i_Movie Then $h_Year = GUICtrlCreateGroup("Year", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 6) + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2) + $i_Max_String_Height, ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) ElseIf $i_TV Then $h_Year = GUICtrlCreateGroup("Season", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 6) + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2) + $i_Max_String_Height, ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) EndIf GUICtrlSetBkColor(-1, $i_Background_Color_1) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Year), "wstr", 0, "wstr", 0) GUICtrlCreateLabel($a_Information[$i_Count][2], $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 6) + 2 + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + Round($i_Font_Size * 3.3) + $i_Max_String_Height, ($i_Font_Size * 4) - 4, ($i_Font_Size * 2), BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $i_Background_Color_1) GUICtrlCreateGroup("", -99, -99, 1, 1) If $i_Movie Then $h_Rating = GUICtrlCreateGroup("Rating", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 11) + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2) + $i_Max_String_Height, ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) ElseIf $i_TV Then $h_Rating = GUICtrlCreateGroup("Episode", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 11) + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 2) + $i_Max_String_Height, ($i_Font_Size * 4), ($i_Font_Size * 4), $BS_CENTER) EndIf GUICtrlSetBkColor(-1, $i_Background_Color_1) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Rating), "wstr", 0, "wstr", 0) GUICtrlCreateLabel($a_Information[$i_Count][3], $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + ($i_Font_Size * 11) + 2 + Round(($i_Block_Width - ($i_Font_Size * 18)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + Round($i_Font_Size * 3.3) + $i_Max_String_Height, ($i_Font_Size * 4) - 4, Round($i_Font_Size * 2), BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $i_Background_Color_1) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetColor($h_Move_Title, $i_Font_Color) GUICtrlSetColor($h_Quality, $i_Font_Color) GUICtrlSetColor($h_Year, $i_Font_Color) GUICtrlSetColor($h_Rating, $i_Font_Color) If $i_Movie Then $s_Split = StringSplit($a_Information[$i_Count][4], "/", 1) $s_Split = StringSplit($s_Split[UBound($s_Split) - 1], ".", 1) GUICtrlCreateGroup("", $i_Center - 1 + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + Round((($i_Block_Width - ($i_Font_Size + 15)) - $i_Image_Width) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 7) + $i_Max_String_Height - Round($i_Font_Size * (3/4)) + 2, $i_Image_Width + 2, $i_Image_Height + Round($i_Font_Size * (3/4))) $a_Pictures[$i_Count] = GUICtrlCreatePic($s_Download_Path & $i_Count & "." & $s_Split[2], $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + Round((($i_Block_Width - ($i_Font_Size + 15)) - $i_Image_Width) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + ($i_Font_Size * 7) + $i_Max_String_Height, $i_Image_Width, $i_Image_Height) GUICtrlSetCursor(-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) If FileExists($s_Download_Path & $i_Count & "." & $s_Split[2]) Then FileDelete($s_Download_Path & $i_Count & "." & $s_Split[2]) EndIf $a_Download_Buttons[$i_Count] = GUICtrlCreateButton("Download", $i_Center + $i_Block_Left_Padding + ($i_Left_Margin * $i_Block_Width) + Round(($i_Block_Width - ($i_Font_Size * 10)) / 2), ($i_Block_Height * $i_Top_Margin) + $i_Block_Top_Padding + $i_Block_Height - Round($i_Font_Size * 5.5), ($i_Font_Size * 8), ($i_Font_Size * 2)) GUICtrlSetCursor(-1, 0) GUICtrlSetColor($a_Download_Buttons[$i_Count], $i_Background_Color_1) EndIf $i_Count = $i_Count + 1 $i_Left_Margin = $i_Left_Margin + 1 Next $i_Left_Margin = 0 $i_Top_Margin = $i_Top_Margin + 1 Next GUICtrlCreateGroup("", -99, -99, 1, 1) EndIf If $i_Movie Then If $i_Rows <> 0 Then $h_Quality_Group = GUICtrlCreateGroup("Quality", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2), $i_GUI_Height + $i_Font_Size, ($i_Font_Size * 7), $i_Font_Size * 4, $BS_CENTER) $h_Quality_Combo = GUICtrlCreateCombo(" All", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + $i_Font_Size, $i_GUI_Height + Round($i_Font_Size / 2) + ($i_Font_Size * 2), ($i_Font_Size * 5), $i_Font_Size, $CBS_DROPDOWNLIST) GUICtrlSetCursor(-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetData($h_Quality_Combo, " 720p| 1080p| 3D", " " & $i_Quality) $h_Genre_Group = GUICtrlCreateGroup("Genre", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + Round($i_GUI_Padding / 2) + ($i_Font_Size * 7), $i_GUI_Height + $i_Font_Size, ($i_Font_Size * 10), $i_Font_Size * 4, $BS_CENTER) $h_Genre_Combo = GUICtrlCreateCombo(" All", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + Round($i_GUI_Padding / 2) + ($i_Font_Size * 8), $i_GUI_Height + Round($i_Font_Size / 2) + ($i_Font_Size * 2), ($i_Font_Size * 8), $i_Font_Size, $CBS_DROPDOWNLIST) GUICtrlSetCursor(-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetData($h_Genre_Combo, " Action| Adventure| Animation| Biography| Comedy| Crime| Documentary| Drama| Family| Fantasy| Film-Noir| Game-Show| History| Horror| Music| Musical| Mystery| News| Reality-TV| Romance| Sci-Fi| Sport| Talk-Show| Thriller| War| Western", " " & $i_Genre) $h_Rating_Group = GUICtrlCreateGroup("Rating", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + $i_GUI_Padding + ($i_Font_Size * 17), $i_GUI_Height + $i_Font_Size, ($i_Font_Size * 6), $i_Font_Size * 4, $BS_CENTER) $h_Rating_Combo = GUICtrlCreateCombo(" All", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + $i_GUI_Padding + ($i_Font_Size * 18), $i_GUI_Height + Round($i_Font_Size / 2) + ($i_Font_Size * 2), ($i_Font_Size * 4), $i_Font_Size, $CBS_DROPDOWNLIST) GUICtrlSetCursor(-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetData($h_Rating_Combo, " 9+| 8+| 7+| 6+| 5+| 4+| 3+| 2+| 1+", " " & $i_Rating & "+") If $i_Year = 0 Then $i_Year_Default = "All" Else $i_Year_Default = $i_Year EndIf $h_Year_Group = GUICtrlCreateGroup("Year", Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 23), $i_GUI_Height + $i_Font_Size, ($i_Font_Size * 7), $i_Font_Size * 4, $BS_CENTER) $h_Year_Input = GUICtrlCreateInput($i_Year_Default, Round(($i_GUI_Width - (Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 29))) / 2) + Round($i_GUI_Padding * 1.5) + ($i_Font_Size * 24), $i_GUI_Height + Round($i_Font_Size / 2) + ($i_Font_Size * 2), ($i_Font_Size * 5), Round($i_Font_Size * 1.5) + 3) GUICtrlCreateGroup("", -99, -99, 1, 1) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Quality_Group), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Quality_Combo), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Genre_Group), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Genre_Combo), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Rating_Group), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Rating_Combo), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Year_Group), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Year_Input), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Rating), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Quality_Group, $i_Font_Color) GUICtrlSetColor($h_Quality_Combo, $i_Background_Color_1) GUICtrlSetColor($h_Genre_Group, $i_Font_Color) GUICtrlSetColor($h_Genre_Combo, $i_Background_Color_1) GUICtrlSetColor($h_Rating_Group, $i_Font_Color) GUICtrlSetColor($h_Rating_Combo, $i_Background_Color_1) GUICtrlSetColor($h_Year_Group, $i_Font_Color) GUICtrlSetColor($h_Year_Input, $i_Background_Color_1) EndIf If $i_Rows = 0 Then GUISetFont(Round($i_Font_Size * 1.5), 400, "", "Times New Roman") $h_Empty = GUICtrlCreateLabel("No Movies Found!", Round(($i_GUI_Width - ($i_Font_Size * 15)) / 2), $i_GUI_Padding * 3, $i_Font_Size * 15, $i_Font_Size * 2, $SS_CENTER) GUICtrlSetBkColor(-1, $i_Background_Color_2) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Empty), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Empty, 0xB50000) $h_Refresh = GUICtrlCreateButton("Default", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) - ($i_Font_Size * 5) - Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 2), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Refresh), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) GUICtrlSetState(-1, $GUI_FOCUS) $h_Switch = GUICtrlCreateButton("Television", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) + ($i_Font_Size * 5) + Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 2), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Switch), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Switch, $i_Background_Color_1) Else GUISetFont(Round($i_Font_Size * 1.5), 400, "", "Times New Roman") $h_Refresh = GUICtrlCreateButton("Refresh", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) - ($i_Font_Size * 5) - Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 6), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Refresh), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) GUICtrlSetState(-1, $GUI_FOCUS) $h_Switch = GUICtrlCreateButton("Television", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) + ($i_Font_Size * 5) + Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 6), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Switch), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Switch, $i_Background_Color_1) EndIf ElseIf $i_TV Then If $i_Rows = 0 Then GUISetFont(Round($i_Font_Size * 1.5), 400, "", "Times New Roman") $h_Empty = GUICtrlCreateLabel("No Shows Found!", Round(($i_GUI_Width - ($i_Font_Size * 15)) / 2), $i_GUI_Padding * 3, $i_Font_Size * 15, $i_Font_Size * 2, $SS_CENTER) GUICtrlSetBkColor(-1, $i_Background_Color_2) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Empty), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Empty, 0xB50000) $h_Search = GUICtrlCreateButton("Default", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) - ($i_Font_Size * 5) - Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 2), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Search), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) GUICtrlSetState(-1, $GUI_FOCUS) $h_Switch = GUICtrlCreateButton("Videos", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) + ($i_Font_Size * 5) + Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 2), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Switch), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) Else GUISetFont(Round($i_Font_Size * 1.5), 400, "", "Times New Roman") If StringCompare($i_Search, "0") = 0 Then $s_String = "" Else $s_String = $i_Search $s_String = StringReplace($s_String, "+", " ") EndIf $h_Search_Input = GUICtrlCreateInput($s_String, Round(($i_GUI_Width - ($i_Font_Size * 14)) / 2), $i_GUI_Height + Round($i_Font_Size * 1.5), ($i_Font_Size * 14), ($i_Font_Size * 3)) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Search_Input), "wstr", 0, "wstr", 0) GUICtrlSetColor($h_Search_Input, $i_Background_Color_1) $h_Search = GUICtrlCreateButton("Search", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) - ($i_Font_Size * 5) - Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 6), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Search), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) GUICtrlSetState(-1, $GUI_FOCUS) $h_Switch = GUICtrlCreateButton("Movies", Round(($i_GUI_Width - ($i_Font_Size * 10)) / 2) + ($i_Font_Size * 5) + Round($i_GUI_Padding / 2), $i_GUI_Height + ($i_Font_Size * 6), ($i_Font_Size * 10), ($i_Font_Size * 3), $BS_DEFPUSHBUTTON) GUICtrlSetCursor(-1, 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($h_Switch), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, $i_Background_Color_1) EndIf EndIf _Toggle_GUI() GUISetState(@SW_SHOW) If ($h_GUI[$i_Current_GUI] <> "") Then GUIDelete($h_GUI[$i_Current_GUI]) While 1 Sleep(20) $s_GUI_Message = GUIGetMsg() If $i_Rows <> 0 Then For $i = 0 To UBound($a_Information) - 1 If $s_GUI_Message = $a_Download_Buttons[$i] Then GUICtrlSetState($a_Download_Buttons[$i], $GUI_DISABLE) GUICtrlSetData($a_Download_Buttons[$i], "Downloading") _InetGet($a_Information[$i][5], $s_Download_Path & "0.torrent") ShellExecute($s_Download_Path & "0.torrent") Sleep(1000) GUICtrlSetData($a_Download_Buttons[$i], "Download") GUICtrlSetState($a_Download_Buttons[$i], $GUI_ENABLE) ExitLoop ElseIf ($s_GUI_Message = $a_Pictures[$i]) And ($i_Movie) Then ShellExecuteWait($a_Information[$i][6]) ExitLoop EndIf Next EndIf If $s_GUI_Message = $GUI_EVENT_CLOSE Then Exit If $s_GUI_Message = $GUI_EVENT_MAXIMIZE Then $i_Maximized = $WS_MAXIMIZE $i_Max_Width = @DesktopWidth Redim $a_Information[0][0] _Startup() EndIf If $s_GUI_Message = $GUI_EVENT_RESTORE Then $i_Maximized = 0 $i_Max_Width = $i_Max_Width_Default Redim $a_Information[0][0] _Startup() EndIf If $s_GUI_Message = $h_Switch Then GUICtrlSetState($h_Switch, $GUI_DISABLE) If $i_Movie Then $i_Movie = 0 $i_TV = 1 ElseIf $i_TV Then $i_TV = 0 $i_Movie = 1 EndIf _Settings_Write("Videos", "$i_Movie", $i_Movie) _Settings_Write("Videos", "$i_TV", $i_TV) GUICtrlSetData($h_Switch, "Loading") Redim $a_Information[0][0] _Startup() EndIf If ($s_GUI_Message = $h_Search) And ($i_TV) Then GUICtrlSetState($h_Search, $GUI_DISABLE) If StringInStr(GUICtrlRead($h_Search_Input), " ") Then $i_Search = StringReplace(GUICtrlRead($h_Search_Input), " ", "+") Else $i_Search = GUICtrlRead($h_Search_Input) EndIf If $i_Search = "" Then $i_Search = 0 If StringCompare($i_Search, "0") = 0 Then $s_RSS_TV[0] = _HexToString($a_TV[0]) Else $s_RSS_TV[0] = _HexToString($a_TV[1]) & $i_Search EndIf _Settings_Write("Videos", "$i_Search", $i_Search) GUICtrlSetData($h_Search, "Loading") Redim $a_Information[0][0] _Startup() EndIf If ($s_GUI_Message = $h_Refresh) And ($i_Movie) Then GUICtrlSetState($h_Refresh, $GUI_DISABLE) $i_Quality = StringLower(StringStripWS(GUICtrlRead($h_Quality_Combo), 8)) $i_Genre = StringLower(StringStripWS(GUICtrlRead($h_Genre_Combo), 8)) $i_Rating = StringLower(StringReplace(StringStripWS(GUICtrlRead($h_Rating_Combo), 8), "+", "")) $i_Year = StringStripWS(GUICtrlRead($h_Year_Input), 8) If StringCompare($i_Rating, "all") = 0 Then $i_Rating = 0 If StringCompare($i_Year, "all") = 0 Then $i_Year = 0 _Settings_Write("Videos", "$i_Quality", $i_Quality) _Settings_Write("Videos", "$i_Genre", $i_Genre) _Settings_Write("Videos", "$i_Rating", $i_Rating) _Settings_Write("Videos", "$i_Year", $i_Year) $s_RSS_Movie[0] = _HexToString($a_Movie[1]) & $i_Quality & "/" & $i_Genre & "/" & $i_Rating GUICtrlSetData($h_Refresh, "Loading") Redim $a_Information[0][0] _Startup() EndIf WEnd GUIDelete($h_GUI[$i_Current_GUI]) EndFunc ; Inlcudes ; String Size Func _String_Size($sText, $sWH, $iSize = 8.5, $iWeight = 400, $iAttrib = 0, $sName = "Times New Roman", $iMaxWidth = 0, $h_Window = 0) If $iSize = Default Then $iSize = 8.5 If $iWeight = Default Then $iWeight = 400 If $iAttrib = Default Then $iAttrib = 0 If $sName = "" Then $sName = _String_Size_DefaultFontName() If Not IsString($sText) Then Return SetError(1, 1, 0) If Not IsNumber($iSize) Then Return SetError(1, 2, 0) If Not IsInt($iWeight) Then Return SetError(1, 3, 0) If Not IsInt($iAttrib) Then Return SetError(1, 4, 0) If Not IsString($sName) Then Return SetError(1, 5, 0) If Not IsNumber($iMaxWidth) Then Return SetError(1, 6, 0) If Not IsHwnd($h_Window) And $h_Window <> 0 Then Return SetError(1, 7, 0) Local $aRet, $hDC, $hFont, $hLabel = 0, $hLabel_Handle Local $iExpTab = BitAnd($iAttrib, 1) $iAttrib = BitAnd($iAttrib, BitNot(1)) If IsHWnd($h_Window) Then $hLabel = GUICtrlCreateLabel("", -10, -10, 10, 10) $hLabel_Handle = GUICtrlGetHandle(-1) GUICtrlSetFont(-1, $iSize, $iWeight, $iAttrib, $sName) $aRet = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hLabel_Handle) If @error Or $aRet[0] = 0 Then GUICtrlDelete($hLabel) Return SetError(2, 1, 0) EndIf $hDC = $aRet[0] $aRet = DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hLabel_Handle, "int", 0x0031, "wparam", 0, "lparam", 0) ; $WM_GetFont If @error Or $aRet[0] = 0 Then GUICtrlDelete($hLabel) Return SetError(2, _String_Size_Error_Close(2, $hDC), 0) EndIf $hFont = $aRet[0] Else $aRet = DllCall("user32.dll", "handle", "GetDC", "hwnd", $h_Window) If @error Or $aRet[0] = 0 Then Return SetError(2, 1, 0) $hDC = $aRet[0] $aRet = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hDC, "int", 90) ; $LOGPIXELSY If @error Or $aRet[0] = 0 Then Return SetError(2, _String_Size_Error_Close(3, $hDC), 0) Local $iInfo = $aRet[0] $aRet = DllCall("gdi32.dll", "handle", "CreateFontW", "int", -$iInfo * $iSize / 72, "int", 0, "int", 0, "int", 0, _ "int", $iWeight, "dword", BitAND($iAttrib, 2), "dword", BitAND($iAttrib, 3), "dword", BitAND($iAttrib, 8), "dword", 0, "dword", 0, _ "dword", 0, "dword", 5, "dword", 0, "wstr", $sName) If @error Or $aRet[0] = 0 Then Return SetError(2, _String_Size_Error_Close(4, $hDC), 0) $hFont = $aRet[0] EndIf $aRet = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hFont) If @error Or $aRet[0] = 0 Then Return SetError(2, _String_Size_Error_Close(5, $hDC, $hFont, $hLabel), 0) Local $hPrevFont = $aRet[0] Local $avSize_Info[4], $iLine_Length, $iLine_Height = 0, $iLine_Count = 0, $iLine_Width = 0, $iWrap_Count, $iLast_Word, $sTest_Line Local $tSize = DllStructCreate("int X;int Y") DllStructSetData($tSize, "X", 0) DllStructSetData($tSize, "Y", 0) $sText = StringRegExpReplace($sText, "((?<!\x0d)\x0a|\x0d(?!\x0a))", @CRLF) Local $asLines = StringSplit($sText, @CRLF, 1) For $i = 1 To $asLines[0] If $iExpTab Then $asLines[$i] = StringReplace($asLines[$i], @TAB, " XXXXXXXX") EndIf $iLine_Length = StringLen($asLines[$i]) DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", $asLines[$i], "int", $iLine_Length, "ptr", DllStructGetPtr($tSize)) If @error Then Return SetError(2, _String_Size_Error_Close(6, $hDC, $hFont, $hLabel), 0) If DllStructGetData($tSize, "X") > $iLine_Width Then $iLine_Width = DllStructGetData($tSize, "X") If DllStructGetData($tSize, "Y") > $iLine_Height Then $iLine_Height = DllStructGetData($tSize, "Y") Next If $iMaxWidth <> 0 And $iLine_Width > $iMaxWidth Then For $j = 1 To $asLines[0] $iLine_Length = StringLen($asLines[$j]) DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", $asLines[$j], "int", $iLine_Length, "ptr", DllStructGetPtr($tSize)) If @error Then Return SetError(2, _String_Size_Error_Close(6, $hDC, $hFont, $hLabel), 0) If DllStructGetData($tSize, "X") < $iMaxWidth - 4 Then $iLine_Count += 1 $avSize_Info[0] &= $asLines[$j] & @CRLF Else $iWrap_Count = 0 While 1 $iLine_Width = 0 $iLast_Word = 0 For $i = 1 To StringLen($asLines[$j]) If StringMid($asLines[$j], $i, 1) = " " Then $iLast_Word = $i - 1 $sTest_Line = StringMid($asLines[$j], 1, $i) $iLine_Length = StringLen($sTest_Line) DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", $sTest_Line, "int", $iLine_Length, "ptr", DllStructGetPtr($tSize)) If @error Then Return SetError(2, _String_Size_Error_Close(6, $hDC, $hFont, $hLabel), 0) $iLine_Width = DllStructGetData($tSize, "X") If $iLine_Width >= $iMaxWidth - 4 Then ExitLoop Next If $i > StringLen($asLines[$j]) Then $iWrap_Count += 1 $avSize_Info[0] &= $sTest_Line & @CRLF ExitLoop Else $iWrap_Count += 1 If $iLast_Word = 0 Then Return SetError(3, _String_Size_Error_Close(0, $hDC, $hFont, $hLabel), 0) $avSize_Info[0] &= StringLeft($sTest_Line, $iLast_Word) & @CRLF $asLines[$j] = StringTrimLeft($asLines[$j], $iLast_Word) $asLines[$j] = StringStripWS($asLines[$j], 1) EndIf WEnd $iLine_Count += $iWrap_Count EndIf Next If $iExpTab Then $avSize_Info[0] = StringRegExpReplace($avSize_Info[0], "\x20?XXXXXXXX", @TAB) EndIf $avSize_Info[1] = $iLine_Height $avSize_Info[2] = $iMaxWidth $avSize_Info[3] = ($iLine_Count * $iLine_Height) + 4 Else Local $avSize_Info[4] = [$sText, $iLine_Height, $iLine_Width, ($asLines[0] * $iLine_Height) + 4] EndIf DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hPrevFont) DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hFont) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $hDC) If $hLabel Then GUICtrlDelete($hLabel) If StringCompare($sWH, "w") = 0 Then Return $avSize_Info[2] ElseIf StringCompare($sWH, "h") = 0 Then Return $avSize_Info[3] EndIf EndFunc Func _String_Size_Error_Close($iExtCode, $hDC = 0, $hFont = 0, $hLabel = 0) If $hFont <> 0 Then DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hFont) If $hDC <> 0 Then DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $hDC) If $hLabel Then GUICtrlDelete($hLabel) Return $iExtCode EndFunc Func _String_Size_DefaultFontName() Local $tNONCLIENTMETRICS = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]") DLLStructSetData($tNONCLIENTMETRICS, 1, DllStructGetSize($tNONCLIENTMETRICS)) DLLCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($tNONCLIENTMETRICS), "ptr", DllStructGetPtr($tNONCLIENTMETRICS), "int", 0) Local $tLOGFONT = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DLLStructGetPtr($tNONCLIENTMETRICS, 13)) If IsString(DllStructGetData($tLOGFONT, 14)) Then Return DllStructGetData($tLOGFONT, 14) Else Return "Tahoma" EndIf EndFunc ; Scrollbar Func _Scrollbar($h_Window, $i_Horizontal_Scroll = 0, $i_Vertical_Scroll = 0, $i_Hide = 0, $i_Horizontal_Tight = 0, $i_Vertical_Tight = 0, $b_Before = False, $i_Repeat = 0, $b_Register_Message = True) Local $iIndex If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) For $iIndex = 1 To $a_Scrollbar_Info[0][0] If $h_Window = $a_Scrollbar_Info[$iIndex][0] Then ExitLoop EndIf Next If $iIndex > $a_Scrollbar_Info[0][0] Then $a_Scrollbar_Info[0][0] += 1 ReDim $a_Scrollbar_Info[$iIndex + 1][UBound($a_Scrollbar_Info, 2)] ReDim $a_Scrollbar_Info_Extra[$iIndex + 1][UBound($a_Scrollbar_Info_Extra, 2)] EndIf If $i_Horizontal_Scroll = 0 And $i_Vertical_Scroll = 0 Then Return SetError(2, 0, 0) If $i_Horizontal_Tight <> 0 Then $i_Horizontal_Tight = 1 If $i_Vertical_Tight <> 0 Then $i_Vertical_Tight = 1 If Not IsInt($i_Repeat) Then $i_Repeat = 0 Local $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC) Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO) DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO)) Local $iError, $iExtended $a_Scrollbar_Info[$iIndex][0] = $h_Window Local $hDC = DllCall("user32.dll", "handle", "GetDC", "hwnd", $h_Window) If Not @error Then $hDC = $hDC[0] DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hDC, "ptr", DllStructGetPtr($tTEXTMETRIC)) If @error Then $iError = @error $iExtended = @extended DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $h_Window, "handle", $hDC) Return SetError($iError, $iExtended, -2) EndIf DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $h_Window, "handle", $hDC) Else Return SetError(@error, @extended, -1) EndIf $a_Scrollbar_Info[$iIndex][2] = DllStructGetData($tTEXTMETRIC, "tmAveCharWidth") $a_Scrollbar_Info[$iIndex][3] = DllStructGetData($tTEXTMETRIC, "tmHeight") + DllStructGetData($tTEXTMETRIC, "tmExternalLeading") Local $aClientSize = WinGetClientSize($h_Window) Local $iX_Client_Full = $aClientSize[0] Local $iY_Client_Full = $aClientSize[1] $a_Scrollbar_Info[$iIndex][4] = $iX_Client_Full $a_Scrollbar_Info[$iIndex][5] = $iY_Client_Full If $iX_Client_Full > $i_Horizontal_Scroll Then $i_Horizontal_Scroll = 0 If $iY_Client_Full > $i_Vertical_Scroll Then $i_Vertical_Scroll = 0 _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, False) If $i_Horizontal_Scroll Then _GUIScrollBars_ShowScrollBar($h_Window, $SB_HORZ) If $b_Register_Message Then GUIRegisterMsg($WM_HSCROLL, "_Scrollbars_WM_HSCROLL") GUIRegisterMsg($WM_MOUSEHWHEEL, '_Scrollbars_WM_MOUSEHWHEEL') EndIf EndIf If $i_Vertical_Scroll Then _GUIScrollBars_ShowScrollBar($h_Window, $SB_VERT) If $b_Register_Message Then GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL") GUIRegisterMsg($WM_MOUSEWHEEL, "_Scrollbars_WM_MOUSEWHEEL") EndIf EndIf If $i_Repeat And $b_Register_Message Then GUIRegisterMsg($WM_KEYUP, "_Scrollbars_WM_KEYUP") EndIf $aClientSize = WinGetClientSize($h_Window) Local $iX_Client_Bar = $aClientSize[0] Local $iY_Client_Bar = $aClientSize[1] Local $iH_FullPage If $i_Horizontal_Scroll Then If $b_Before Then $a_Scrollbar_Info[$iIndex][4] = $iX_Client_Bar $iH_FullPage = Floor($a_Scrollbar_Info[$iIndex][4] / $a_Scrollbar_Info[$iIndex][2]) $a_Scrollbar_Info[$iIndex][6] = Floor($i_Horizontal_Scroll / $a_Scrollbar_Info[$iIndex][2]) - $i_Horizontal_Tight Else If $i_Vertical_Scroll Then $a_Scrollbar_Info[$iIndex][4] = $iX_Client_Bar $iH_FullPage = Floor($a_Scrollbar_Info[$iIndex][4] / $a_Scrollbar_Info[$iIndex][2]) $a_Scrollbar_Info[$iIndex][6] = Floor($i_Horizontal_Scroll / $a_Scrollbar_Info[$iIndex][2] * $a_Scrollbar_Info[$iIndex][4] / $iX_Client_Full) - $i_Horizontal_Tight EndIf Else $a_Scrollbar_Info[$iIndex][6] = 0 EndIf Local $iV_FullPage If $i_Vertical_Scroll Then If $b_Before Then $a_Scrollbar_Info[$iIndex][5] = $iY_Client_Bar $iV_FullPage = Floor($a_Scrollbar_Info[$iIndex][5] / $a_Scrollbar_Info[$iIndex][3]) $a_Scrollbar_Info[$iIndex][7] = Floor($i_Vertical_Scroll / $a_Scrollbar_Info[$iIndex][3]) - $i_Vertical_Tight Else If $i_Horizontal_Scroll Then $a_Scrollbar_Info[$iIndex][5] = $iY_Client_Bar $iV_FullPage = Floor($a_Scrollbar_Info[$iIndex][5] / $a_Scrollbar_Info[$iIndex][3]) $a_Scrollbar_Info[$iIndex][7] = Floor($i_Vertical_Scroll / $a_Scrollbar_Info[$iIndex][3] * $a_Scrollbar_Info[$iIndex][5] / $iY_Client_Full) - $i_Vertical_Tight EndIf Else $a_Scrollbar_Info[$iIndex][7] = 0 EndIf Local $aRet[4] If $i_Vertical_Scroll Then $aRet[0] = $iX_Client_Bar Else $aRet[0] = $iX_Client_Full EndIf If $i_Horizontal_Scroll Then $aRet[1] = $iY_Client_Bar Else $aRet[1] = $iY_Client_Full EndIf $aRet[2] = $iX_Client_Bar / $iX_Client_Full $aRet[3] = $iY_Client_Bar / $iY_Client_Full $a_Scrollbar_Info_Extra[$iIndex][0] = $i_Horizontal_Scroll $a_Scrollbar_Info_Extra[$iIndex][1] = $i_Vertical_Scroll $a_Scrollbar_Info_Extra[$iIndex][2] = $aRet[2] $a_Scrollbar_Info_Extra[$iIndex][3] = $aRet[3] $a_Scrollbar_Info_Extra[$iIndex][4] = $b_Before $a_Scrollbar_Info_Extra[$iIndex][5] = $i_Repeat $a_Scrollbar_Info_Extra[$iIndex][6] = (($i_Repeat) ? ($i_Repeat) : (7)) ; Set default 7 for mousewheel if no keys registered Local $fSuccess = True If _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, False) = False Then $fSuccess = False If $i_Horizontal_Scroll Then If _GUIScrollBars_SetScrollInfoMax($h_Window, $SB_HORZ, $a_Scrollbar_Info[$iIndex][6]) = False Then $fSuccess = False _GUIScrollBars_SetScrollInfoPage($h_Window, $SB_HORZ, $iH_FullPage) If @error Then $fSuccess = False If _GUIScrollBars_ShowScrollBar($h_Window, $SB_HORZ, True) = False Then $fSuccess = False Else If _GUIScrollBars_ShowScrollBar($h_Window, $SB_HORZ, False) = False Then $fSuccess = False EndIf If $i_Vertical_Scroll Then If _GUIScrollBars_SetScrollInfoMax($h_Window, $SB_VERT, $a_Scrollbar_Info[$iIndex][7]) = False Then $fSuccess = False _GUIScrollBars_SetScrollInfoPage($h_Window, $SB_VERT, $iV_FullPage) If @error Then $fSuccess = False If _GUIScrollBars_ShowScrollBar($h_Window, $SB_VERT, True) = False Then $fSuccess = False Else If _GUIScrollBars_ShowScrollBar($h_Window, $SB_VERT, False) = False Then $fSuccess = False EndIf If $i_Hide Then _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, False) If $fSuccess Then Return $aRet Return SetError(3, 0, 0) EndFunc Func _GUIScrollbars_ReSizer($h_Window, $iH_Max, $iV_Max, $bFullClient = False, $b_Register_Message = True) If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) For $iIndex = 1 To $a_Scrollbar_Info[0][0] If $h_Window = $a_Scrollbar_Info[$iIndex][0] Then ExitLoop EndIf Next If $iIndex > $a_Scrollbar_Info[0][0] Then Return SetError(2, 0, 0) If Not BitAND(_WinAPI_GetWindowLong($h_Window, $GWL_STYLE), 0x00040000) Then Return SetError(3, 0, 0) $a_Scrollbar_Info_Extra[$iIndex][7] = $iH_Max $a_Scrollbar_Info_Extra[$iIndex][8] = $iV_Max Local $aPos = WinGetPos($h_Window) _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, False) Local $aClientSize = WinGetClientSize($h_Window) Local $aMaxSize[2] = [$aPos[2] + $a_Scrollbar_Info_Extra[$iIndex][7] - $aClientSize[0], $aPos[3] + $a_Scrollbar_Info_Extra[$iIndex][8] - $aClientSize[1]] WinMove($h_Window, "", Default, Default, $aMaxSize[0], $aMaxSize[1]) If Not $bFullClient Then $a_Scrollbar_Info[0][1] = 0 $a_Scrollbar_Info[0][2] = 0 WinMove($h_Window, "", Default, Default, $aPos[2], $aPos[3]) $a_Scrollbar_Info[0][3] = $h_Window $a_Scrollbar_Info[0][4] = $iIndex _Scrollbars_WM_EXITSIZEMOVE($h_Window, 0, 0, 0) EndIf If $b_Register_Message Then GUIRegisterMsg($WM_EXITSIZEMOVE, "_Scrollbars_WM_EXITSIZEMOVE") GUIRegisterMsg($WM_ENTERSIZEMOVE, "_Scrollbars_WM_ENTERSIZEMOVE") EndIf Return $aMaxSize EndFunc Func _GUIScrollbars_Locate_Ctrl($h_Window, $iX, $iY) If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex = -1 Then Return SetError(3, 0, 0) If $iX < 0 Or $iX > $a_Scrollbar_Info_Extra[$iIndex][0] Then Return SetError(2, 0, 0) If $iY < 0 Or $iY > $a_Scrollbar_Info_Extra[$iIndex][1] Then Return SetError(2, 0, 0) If Not $a_Scrollbar_Info_Extra[$iIndex][4] Then $iX *= $a_Scrollbar_Info_Extra[$iIndex][2] $iY *= $a_Scrollbar_Info_Extra[$iIndex][3] EndIf $iX -= _GUIScrollBars_GetScrollInfoPos($h_Window, $SB_HORZ) * $a_Scrollbar_Info[$iIndex][2] $iY -= _GUIScrollBars_GetScrollInfoPos($h_Window, $SB_VERT) * $a_Scrollbar_Info[$iIndex][3] Local $aRet[2] = [$iX, $iY] Return $aRet EndFunc Func _GUIScrollbars_Scroll_Page($h_Window, $i_Horizontal_Scroll_Pos = 0, $i_Vertical_Scroll_Pos = 0) Local $iPos If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) If Not (IsInt($i_Horizontal_Scroll_Pos) And IsInt($i_Vertical_Scroll_Pos)) Then Return SetError(3, 0, 0) Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex = -1 Then Return SetError(2, 0, 0) Local $iH_Page = Floor($a_Scrollbar_Info[$iIndex][4] / $a_Scrollbar_Info[$iIndex][2]) Local $iV_Page = Floor($a_Scrollbar_Info[$iIndex][5] / $a_Scrollbar_Info[$iIndex][3]) If $i_Horizontal_Scroll_Pos > 0 Then $iPos = ($i_Horizontal_Scroll_Pos - 1) * $iH_Page If $iPos > $a_Scrollbar_Info[$iIndex][6] Then $iPos = $a_Scrollbar_Info[$iIndex][6] _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, $iPos) EndIf If $i_Vertical_Scroll_Pos > 0 Then $iPos = ($i_Vertical_Scroll_Pos - 1) * $iV_Page If $iPos > $a_Scrollbar_Info[$iIndex][7] Then $iPos = $a_Scrollbar_Info[$iIndex][7] _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, $iPos) EndIf EndFunc Func _GUIScrollbars_Minimize($h_Window) If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex = -1 Then Return SetError(1, 0, 0) _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, True) $a_Scrollbar_Info[$iIndex][8] = _GUIScrollBars_GetScrollPos($h_Window, $SB_VERT) _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, 0) $a_Scrollbar_Info[$iIndex][9] = _GUIScrollBars_GetScrollPos($h_Window, $SB_HORZ) _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, 0) EndFunc Func _GUIScrollbars_Restore($h_Window, $fVert = True, $fHorz = True) If Not IsHWnd($h_Window) Then Return SetError(1, 0, 0) Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex = -1 Then Return SetError(2, 0, 0) If Not $fVert Then _GUIScrollBars_ShowScrollBar($h_Window, $SB_VERT, False) EndIf If Not $fHorz Then _GUIScrollBars_ShowScrollBar($h_Window, $SB_HORZ, False) EndIf If $fVert Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, $a_Scrollbar_Info[$iIndex][8]) EndIf If $fHorz Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, $a_Scrollbar_Info[$iIndex][9]) EndIf EndFunc Func _Scrollbars_WM_VSCROLL($h_Window, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $iIndex = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($a_Scrollbar_Info) - 1 If $a_Scrollbar_Info[$x][0] = $h_Window Then $iIndex = $x $yChar = $a_Scrollbar_Info[$iIndex][3] ExitLoop EndIf Next If $iIndex = -1 Then Return 0 Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($h_Window, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_TOP DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINEDOWN DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGEUP DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($h_Window, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($h_Window, $SB_VERT, $tSCROLLINFO) $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($h_Window, 0, $yChar * ($yPos - $Pos)) $yPos = $Pos EndIf Return $GUI_RUNDEFMSG EndFunc Func _Scrollbars_WM_HSCROLL($h_Window, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $iIndex = -1, $xChar, $xPos Local $Page, $Pos, $TrackPos For $x = 0 To UBound($a_Scrollbar_Info) - 1 If $a_Scrollbar_Info[$x][0] = $h_Window Then $iIndex = $x $xChar = $a_Scrollbar_Info[$iIndex][2] ExitLoop EndIf Next If $iIndex = -1 Then Return 0 Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($h_Window, $SB_HORZ) $Page = DllStructGetData($tSCROLLINFO, "nPage") $xPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $xPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_LINELEFT DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINERIGHT DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGELEFT DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGERIGHT DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($h_Window, $SB_HORZ, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($h_Window, $SB_HORZ, $tSCROLLINFO) $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($h_Window, $xChar * ($xPos - $Pos), 0) Return $GUI_RUNDEFMSG EndFunc Func _Scrollbars_WM_MOUSEWHEEL($h_Window, $iMsg, $wParam, $lParam) #forceref $h_Window, $iMsg, $lParam Local $iDirn, $iDelta = BitShift($wParam, 16) Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex <> -1 Then If BitAND($wParam, 0x0000FFFF) Then $iDirn = $SB_LINERIGHT If $iDelta > 0 Then $iDirn = $SB_LINELEFT For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][6] _SendMessage($h_Window, $WM_HSCROLL, $iDirn) Next Else $iDirn = $SB_LINEDOWN If $iDelta > 0 Then $iDirn = $SB_LINEUP For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][6] _SendMessage($h_Window, $WM_VSCROLL, $iDirn) Next EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func _Scrollbars_WM_MOUSEHWHEEL($h_Window, $iMsg, $wParam, $lParam) #forceref $h_Window, $iMsg, $lParam Local $iDirn = $SB_LINERIGHT If BitShift($wParam, 16) > 0 Then $iDirn = $SB_LINELEFT Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex <> -1 Then For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][5] _SendMessage($h_Window, $WM_HSCROLL, $iDirn) Next EndIf Return $GUI_RUNDEFMSG EndFunc Func _Scrollbars_WM_KEYUP($h_Window, $iMsg, $wParam, $lParam) #forceref $h_Window, $iMsg, $lParam Local $aRet_Ctrl Local $iIndex = -1 For $i = 0 To UBound($a_Scrollbar_Info) - 1 If $h_Window = $a_Scrollbar_Info[$i][0] Then $iIndex = $i Next If $iIndex <> -1 Then Local $bCtrl = False $aRet_Ctrl = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", "0x11") If $aRet_Ctrl[0] Then $bCtrl = True Switch $wParam Case 0x21 If $bCtrl Then _SendMessage($h_Window, $WM_HSCROLL, $SB_PAGELEFT) Else _SendMessage($h_Window, $WM_VSCROLL, $SB_PAGEUP) EndIf Case 0x22 If $bCtrl Then _SendMessage($h_Window, $WM_HSCROLL, $SB_PAGERIGHT) Else _SendMessage($h_Window, $WM_VSCROLL, $SB_PAGEDOWN) EndIf Case 0x23 If $bCtrl Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, $a_Scrollbar_Info[$iIndex][6]) Else _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, $a_Scrollbar_Info[$iIndex][7]) EndIf Case 0x24 If $bCtrl Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, 0) Else _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, 0) EndIf Case 0x25 For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][5] _SendMessage($h_Window, $WM_HSCROLL, $SB_LINELEFT) Next Case 0x26 For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][5] _SendMessage($h_Window, $WM_VSCROLL, $SB_LINEUP) Next Case 0x27 For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][5] _SendMessage($h_Window, $WM_HSCROLL, $SB_LINERIGHT) Next Case 0x28 For $i = 1 To $a_Scrollbar_Info_Extra[$iIndex][5] _SendMessage($h_Window, $WM_VSCROLL, $SB_LINEDOWN) Next EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Func _Scrollbars_WM_ENTERSIZEMOVE($h_Window, $iMsg, $wParam, $lParam) #forceref $h_Window, $iMsg, $wParam, $lParam For $iIndex = 1 To $a_Scrollbar_Info[0][0] If $h_Window = $a_Scrollbar_Info[$iIndex][0] Then $a_Scrollbar_Info[0][1] = _GUIScrollBars_GetScrollInfoPos($h_Window, $SB_HORZ) $a_Scrollbar_Info[0][2] = _GUIScrollBars_GetScrollInfoPos($h_Window, $SB_VERT) _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, 0) _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, 0) _GUIScrollBars_ShowScrollBar($h_Window, $SB_BOTH, False) $a_Scrollbar_Info[0][3] = $h_Window $a_Scrollbar_Info[0][4] = $iIndex ExitLoop EndIf Next EndFunc Func _Scrollbars_WM_EXITSIZEMOVE($h_Window, $iMsg, $wParam, $lParam) #forceref $h_Window, $iMsg, $wParam, $lParam If $h_Window = $a_Scrollbar_Info[0][3] And $a_Scrollbar_Info[0][4] <> -1 Then Local $iIndex = $a_Scrollbar_Info[0][4] Local $aClientSize = WinGetClientSize($h_Window) Local $iH_Aperture = 0, $iV_Aperture = 0, $iH_Reduction = 0, $iV_Reduction = 0 For $i = 1 To 2 If $aClientSize[0] < $a_Scrollbar_Info_Extra[$iIndex][7] + $iH_Reduction Then $iH_Aperture = $a_Scrollbar_Info_Extra[$iIndex][7] + $iH_Reduction $iV_Reduction = 17 EndIf If $aClientSize[1] < $a_Scrollbar_Info_Extra[$iIndex][8] + $iV_Reduction Then $iV_Aperture = $a_Scrollbar_Info_Extra[$iIndex][8] + $iV_Reduction $iH_Reduction = 17 EndIf Next _Scrollbar($h_Window, $iH_Aperture, $iV_Aperture) If $iH_Aperture Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_HORZ, $a_Scrollbar_Info[0][1]) If $iV_Aperture Then _GUIScrollBars_SetScrollInfoPos($h_Window, $SB_VERT, $a_Scrollbar_Info[0][2]) $a_Scrollbar_Info[0][1] = 0 $a_Scrollbar_Info[0][4] = -1 EndIf EndFunc