wisem2540 Posted July 11, 2013 Author Share Posted July 11, 2013 Brewman, I have been looking over your code and comparing it to my original. Can you tell me whats happening on line 220? Where is 'Download" defined? How does the script know what to do? thanks Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2013 Share Posted July 11, 2013 I have no idea what you have on line 220 in your script, the script I posted has this on line 220. $ext = StringTrimLeft($Selected, StringInStr($Selected, ".", Default, -1)); finds last "." and returns only the ext If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
wisem2540 Posted July 11, 2013 Author Share Posted July 11, 2013 (edited) Func _DownloadFiles() Local $Indices, $sSelected Switch @GUI_CtrlId Case $All $AllDownloading = 1 Allclick() Case $Get, $idTrailer ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Trailer = ' & $Trailer & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $Indices = _GUICtrlListView_GetSelectedIndices($ListView1) + 1; returns line number that user has selected (add 1 because index starts at 0) $sSelected = _GUICtrlListView_GetItemText($ListView1, $Indices - 1, 2); item text of selected line Download($sSelected) EndSwitch EndFunc ;==>_DownloadFiles Func Allclick() Local $Selected Local Static $z = 1 ;~ $start = 0 Local $Allmovies[1] _FileReadToArray("TL.txt", $Allmovies) ;~ For $z = 1 To $Allmovies[0]; For all movies $Selected = $Allmovies[$z] Download($Selected) $z += 1 If $z > $Allmovies[0] Then Exit ;~ Next ;~ Exit EndFunc ;==>Allclick Download($Selected) is used a few times in here. Is it being used in place of Inetget? I dont ever see it defined in the script as to how it should function Edited July 11, 2013 by wisem2540 Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2013 Share Posted July 11, 2013 It's a function called Download that's being referenced. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
wisem2540 Posted July 11, 2013 Author Share Posted July 11, 2013 First of all, let me point out that so far, the script seems to work as I expect it to. However, I am still confused by the download function. I dont actually see a download function defined in the scipt, so I can only assume that its built into autoit?? Can you clarify where the download function instructions/ arguments are? thanks Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2013 Share Posted July 11, 2013 The download function is in the script I posted. Func Download($Selected) ;Will download user selected trailer when pressing "GET" button Global $Filename = StringTrimLeft($Selected, StringInStr($Selected, "/", Default, -1)); finds last "\" and trims only the file name $ext = StringTrimLeft($Selected, StringInStr($Selected, ".", Default, -1)); finds last "." and returns only the ext $Append = IniRead("Settings.ini", "Settings", "Append_Text", "") If IniRead("Settings.ini", "Settings", "Append_FileName", "Error") = 1 Then; if append is enabled $Filename = StringTrimRight($Filename, 4); trim file ext $Filename = $Filename & $Append & "." & $ext; add append text and file ext for new filename EndIf If StringInStr($Selected, "Apple") = 0 Then; if download link is not from apple, do not change UserAgent HttpSetUserAgent("AutoIt") Else; if it is from apple, change user string to Quicktime. As of creation of this script, apple only allows quicktime to download trailers. This will spoof that HttpSetUserAgent("QuickTime") EndIf ;Start progress bar code If FileExists($Save & "\" & $Filename) Then MsgBox(4096, "Info", $Save & "\" & $Filename & " Already Downloaded"); If file exists, warn. ELSE download Else $url = $Selected ;Set URL $folder = $Save ;Set folder $hInet = InetGet($url, $Save & "\" & $Filename, 1, 1) ;Forces a reload from the remote site and return immediately and download in the background Global $FileSize = InetGetSize($url) ;Get file size AdlibRegister("Prog", 1000); updates progress bar every second EndIf EndFunc ;==>Download If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
wisem2540 Posted July 15, 2013 Author Share Posted July 15, 2013 (edited) Bewman, Im sorry to be a pest, but im really having a hard time wrapping my head around why this code works. I have redesigned this GUI and tried to adapt what you did to this GUI and I cannot get it to work at all. In the new code, there is an array called $Trailer now. If I could just loop through that, id be happy. But I get GUI freezing, and high CPU usage in the ALLCLICK function. Can you take another look at it and explain why I am so dense... Edited July 16, 2013 by wisem2540 Link to comment Share on other sites More sharing options...
BrewManNH Posted July 15, 2013 Share Posted July 15, 2013 You're not using the code I posted, why should I even try to give you a working example if you're not even going to attempt to use it? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
wisem2540 Posted July 15, 2013 Author Share Posted July 15, 2013 As I said, in the time you and I were working on this, I redeisgned the GUI. When I tried to adapt your example to my code, I could not get it to work. What I posted was what I have currently semi working. Link to comment Share on other sites More sharing options...
wisem2540 Posted July 15, 2013 Author Share Posted July 15, 2013 (edited) Brewman, I have been playing around more with the code you posted. It seems with the new GUI, the app crashes at the end of ALLCLICK, when it tries to add 1 to $Z - Though it does work with the old GUI. That is what is puzzling Func Allclick() Local $Selected Local Static $z = 1 ;~ $start = 0 Local $Allmovies[1] _FileReadToArray("TL.txt", $Allmovies) ;~ For $z = 1 To $Allmovies[0]; For all movies $Selected = $Allmovies[$z] Download($Selected) $z += 1 If $z > $Allmovies[0] Then Exit ;~ Next ;~ Exit Can you explain how the script knows to go back and loop through the array, since I do not see a FOR command? I tried dropping a msgbox in place of the download call, hoping it would loop through, and it does not Edited July 15, 2013 by wisem2540 Link to comment Share on other sites More sharing options...
wisem2540 Posted July 16, 2013 Author Share Posted July 16, 2013 I finally added If $AllDownloading = 1 Then Call ("allclick") to the end of the progressbar check, so would recall the Function. I am sure this is not the cleanest way, but it seems to work....for now. Still testing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now