Elishac Posted August 8, 2009 Share Posted August 8, 2009 Hi, I'd like to make a script that opens internet explorer and searches automatically the list of the episode names of a given tv series. The 2 arguments of the function would be the name of the tv series and the number of the season. Do you have any idea as to how to do that ? Any help would be very much appreciated. Regards. Link to comment Share on other sites More sharing options...
water Posted August 8, 2009 Share Posted August 8, 2009 To work with the Internet Explorer you should have a look at the IE UDF. Autoit help file -> User Defined Functions -> IE Management. _IE_Example gives you a lot to test. Which function you need to use depends on the way the information is presented on the site you connect to. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Elishac Posted August 8, 2009 Author Share Posted August 8, 2009 Yeah, I know it depends on the site, and that's why it is so difficult. I mean, I can read the IE UDF, (I already did), but it's hard to remember them all, and thus it's hard for me to figure out how I can extract the information. Let's take this page for instance : http://en.wikipedia.org/wiki/List_of_Lost_episodes (or this one : http://en.wikipedia.org/wiki/List_of_24_episodes) What functions do you think I could use to extract the list of the episode names of the season 2 ? The functions need to be quite unspecific, so that the idea could be used into another webpage of the same style, and that's why it's so difficult and that's why I need your help. Link to comment Share on other sites More sharing options...
Elishac Posted August 8, 2009 Author Share Posted August 8, 2009 ok thanks. Can you help me a little bit more please ? Like, let's say the show is called $name and the season I'm looking for is $number. How do I get the list of episodes ? Do I need to use ctrl+ F in the IE window ? By the way, is there a way to use the informations on Internet without having to open a IE window (if it's hidden or if the page is downloaded completely or something like that?) Link to comment Share on other sites More sharing options...
GEOSoft Posted August 8, 2009 Share Posted August 8, 2009 Just off the top there are a couple of options to look at. It appears to be all tables so if you are using the IE UDF then see _IETableGetCollection() _IETableWriteToArray() It may be better to read the HTML source with _InetGetSource() or InetRead() [beta only] and then use StringRegExp() to get what you want. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Elishac Posted August 8, 2009 Author Share Posted August 8, 2009 Ok, so let's say I have the source. How do I extract the episode list (and put it in an array) from the source ? I never used StringRegExp() before and I don't understand the help file very much. Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 When I adapt your code to my script, I get this error : Local $aEpisodeList = StringRegExp($sSeasonInfo[0], "(?s)(?i)<Title>(.*?)</Title>", 3) Info^ ERROR error: Subscript used with non-Array variable. Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 (edited) yes, i chose season 1. This is what I wrote : Func _AutoSearch($inpName,$inpNumber) If $inpName= "" Then MsgBox(16, "AutoSearch Error", "You didn't enter the name of the show") Local $iShowID = _GetShowID($inpName) Local $sURL = "http://services.tvrage.com/feeds/episode_list.php?sid=" & $iShowID Local $sSource = _INetGetSource($sURL) If $inpNumber="" Then MsgBox(16, "AutoSearch Error", "You didn't enter the season number") Local $sStart = '<Season no="' & $inpNumber & '">' Local $sEnd = "</Season>" Local $sSeasonInfo = _StringBetween($sSource, $sStart, $sEnd) Local $aEpisodeList = StringRegExp($sSeasonInfo[0], "(?s)(?i)<Title>(.*?)</Title>", 3) $aEpisodeList EndFunc ;==>_AutoSearch Func _GetShowID($inpNumber) Local $sURL = "http://services.tvrage.com/tools/quickinfo.php?show=" & $inpNumber Local $sSource = _INetGetSource($sURL) Local $aSource = StringSplit($sSource, @CRLF, 2) $aSource = StringSplit($aSource[0], "@", 2) Local $iShowID = $aSource[1] Return $aSource[1] EndFunc ;==>_GetShowID Edited August 9, 2009 by Elishac Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 The part you wrote works for me too, but as soon as I insert it in my script, it doesn't work anymore. I use it this way : $EpisodeList=_AutoSearch($inpName,$inpNumber) For $x = 1 To $Array[0] "..." & $EpisodeList[$x-1] & "..." and it displays the error I wrote earlier. Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 (edited) What is $Array[0]?It's hard to say in a few words. I'll just give you the whole script. $Array[0] is the length of $Array, which contains all the .avi files in the script folder. The labels are in French, but I'm sure you can use wordreference or something like that, it doesn't matter much anyway. Just put the script in a directory that contains .avi files, and check the checkbox in the right. Then write "lost" (for instance) instead of "nom" (the name of the series) and press "voir les modifications" (see the changes). The idea of this whole script is to change all the names of the files of a show season at once. I want it to have the form : "Smallville - [01x02] - Vo - Metamorphosis.avi" where "smallville" is the name of the show, "01" is the season number, "02" is the episode number, and "metamorphosis" is the name of that episode. Look closely at line 275,398 and the last lines of the script. expandcollapse popup#Include <File.au3> #include <GUIConstants.au3> #include <Misc.au3> #include <string.au3> #include <Array.au3> #include <INet.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #NoTrayIcon opt("WinTitleMatchMode", 2) Opt("TrayIconHide", 1) Opt("GUIOnEventMode", 1) _Singleton ("N'utiliser qu'un seul Correcteur de Noms de Fichiers à la fois.") #Region Global Delcarations Global $version = "1.0 Beta" Global $paste Global $file Global $inpTrimFileread Global $inpSpecialTrimread Global $inpReplace1read Global $inpReplace2read Global $chkAdd Global $chkTrim Global $chkStripChars Global $inpAdd Global $inpTrimFile Global $inpSpecialTrim Global $chkRegExp Global $chkReplace Global $inpReplace1 Global $inpReplace2 Global $inpRegExp Global $chkSeries Global $inpName Global $inpNumber Global $chkradio1 Global $chkradio2 Global $chkradio3 Global $chkradio4 Global $chkradio5 Global $inpAutre Global $editChanged Global $chkStripTrackNumber Global $btnMakeChanges Global $editCurrent Global $chkUnderscores Global $chkFixDashes Global $EpisodeList #EndRegion _CreateGUI() _FilleditCurrent() GUISetState(@SW_SHOW) While 1 Sleep (100) WEnd Func _CreateGUI() GUICreate("Correcteur de Noms de Fichiers " & $version, 706, 580) GUISetOnEvent ($GUI_EVENT_CLOSE, "_GUI_EVENT_CLOSE") $editCurrent = GUICtrlCreateEdit("", 16, 10, 321, 281, -1, $WS_EX_CLIENTEDGE) $editChanged = GUICtrlCreateEdit("", 368, 10, 321, 281, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("Modifications usuelles", 120, 302, 110, 20, -1, $SS_GRAYRECT) $chkAdd = GUICtrlCreateCheckbox("Ajouter", 16, 339, 50, 20) GUICtrlSetOnEvent (-1, "_chkAdd") $inpAdd = GUICtrlCreateInput("test", 75, 339, 100, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("au début du nom des fichiers", 185, 341, 150, 20) $chkTrim = GUICtrlCreateCheckbox("Supprimer", 16, 371, 70, 17) GUICtrlSetOnEvent (-1, "_chkTrim") $inpTrimFile = GUICtrlCreateInput("", 100, 371, 25, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("caractères au début du nom des fichiers", 137, 373, 190, 20) $chkStripChars = GUICtrlCreateCheckbox("Supprimer", 16, 403, 70, 20) GUICtrlSetOnEvent (-1, "_chkStripChars") $inpSpecialTrim = GUICtrlCreateInput("", 100, 403, 89, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("du nom des fichiers", 200, 405, 148, 20) ;$chkStripTrackNumber = GUICtrlCreateCheckbox("Remove Track numbers from filenames", 16, 412, 305, 20) $chkReplace = GUICtrlCreateCheckbox("Remplacer", 16, 435, 70, 20) GUICtrlSetOnEvent (-1, "_chkReplace") $inpReplace1 = GUICtrlCreateInput("", 100, 435, 89, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("par", 200, 437, 32, 20) $inpReplace2 = GUICtrlCreateInput("", 225, 435, 89, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) ;$chkRegExp = GUICtrlCreateCheckbox("Strip Out Regular Expression", 16, 481, 155, 20) ;GUICtrlSetOnEvent (-1, "_chkRegExp") ;$inpRegExp = GUICtrlCreateInput ("", 180, 481, 410, 20) ;GUICtrlSetState(-1, $GUI_Disable) $chkUnderscores = GUICtrlCreateCheckbox('Remplacer les underscores "_" par des espaces', 16, 467, 250, 20) $chkFixDashes = GUICtrlCreateCheckbox('Remplacer "-" par " - " (ajouter des espaces)', 16, 499, 250, 20) GUICtrlCreateLabel("Modifications spécifiques aux séries TV", 430, 302, 193, 20, -1, $SS_GRAYRECT) $chkSeries = GUICtrlCreateCheckbox("Utiliser les modifications spécifiques aux séries TV", 368, 339, 280, 20) GUICtrlSetOnEvent (-1, "_chkSeries") GUICtrlCreateLabel("Nom de la série", 388, 373, 100, 20) $inpName = GUICtrlCreateInput("Nom", 500, 371, 100, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("Numéro de la saison", 388, 405, 100, 20) $inpNumber = GUICtrlCreateInput("1", 500, 403, 25, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("Langues et sous-titres", 388, 437, 120, 20) $chkradio1 = GUICtrlCreateRadio("Vo", 410, 465, 35, 20) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetOnEvent (-1, "_chkradio5") $chkradio2 = GUICtrlCreateRadio("Vf", 447, 465, 35, 20) GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetOnEvent (-1, "_chkradio5") $chkradio3 = GUICtrlCreateRadio("Vostfr", 484, 465, 49, 20) GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetOnEvent (-1, "_chkradio5") $chkradio4 = GUICtrlCreateRadio("Vosten", 539, 465, 49, 20) GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetOnEvent (-1, "_chkradio5") $chkradio5 = GUICtrlCreateRadio("Autre", 599, 465, 44, 20) GUICtrlSetState(-1, $GUI_Disable) GUICtrlSetOnEvent (-1, "_chkradio5") $inpAutre = GUICtrlCreateInput("", 645, 463, 40, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_Disable) ;~ GUICtrlCreateLabel("Nom des épisodes", 388, 501, 80, 20) ;~ $btnAutoSearch = GUICtrlCreateButton("Recherche automatique", 470, 501) ;~ GUICtrlSetOnEvent (-1, "_btnManualSearch") $btnShowMe = GUICtrlCreateButton("Voir les modifications", 230, 550) GUICtrlSetOnEvent (-1, "_btnShowMe") GUICtrlSetState (-1, $GUI_DEFBUTTON) $btnMakeChanges = GUICtrlCreateButton("Appliquer les modifications", 345, 550) GUICtrlSetOnEvent (-1, "_btnMakeChanges") GUICtrlSetState(-1, $GUI_Disable) ControlFocus ( "Correcteur de noms de fichiers", "", $btnShowMe ) EndFunc #Region GUI Functions Func _btnShowMe() ShowMeMakeChanges("Show") EndFunc Func _btnMakeChanges() ShowMeMakeChanges("Change") EndFunc Func _chkAdd() If GUICtrlRead($chkAdd) = $GUI_CHECKED Then GUICtrlSetState($inpAdd, $GUI_Enable) ElseIf GUICtrlRead($chkAdd) = $GUI_UNCHECKED Then GUICtrlSetState($inpAdd, $GUI_Disable) EndIf EndFunc Func _chkTrim() If GUICtrlRead($chkTrim) = $GUI_CHECKED Then GUICtrlSetState($inpTrimFile, $GUI_Enable) ElseIf GUICtrlRead($chkTrim) = $GUI_UNCHECKED Then GUICtrlSetState($inpTrimFile, $GUI_Disable) EndIf EndFunc Func _chkStripChars() If GUICtrlRead($chkStripChars) = $GUI_CHECKED Then GUICtrlSetState($inpSpecialTrim, $GUI_Enable) ElseIf GUICtrlRead($chkStripChars) = $GUI_UNCHECKED Then GUICtrlSetState($inpSpecialTrim, $GUI_Disable) EndIf EndFunc Func _chkReplace() If GUICtrlRead($chkReplace) = $GUI_CHECKED Then GUICtrlSetState($inpReplace1, $GUI_Enable) GUICtrlSetState($inpReplace2, $GUI_Enable) ElseIf GUICtrlRead($chkReplace) = $GUI_UNCHECKED Then GUICtrlSetState($inpReplace1, $GUI_Disable) GUICtrlSetState($inpReplace2, $GUI_Disable) EndIf EndFunc Func _chkRegExp() If GUICtrlRead($chkRegExp) = $GUI_CHECKED Then GUICtrlSetState($inpRegExp, $GUI_Enable) ElseIf GUICtrlRead($chkRegExp) = $GUI_UNCHECKED Then GUICtrlSetState($inpRegExp, $GUI_Disable) EndIf EndFunc Func _chkSeries() If GUICtrlRead($chkSeries) = $GUI_CHECKED Then GUICtrlSetState($inpName, $GUI_Enable) GUICtrlSetState($inpNumber, $GUI_Enable) GUICtrlSetState($chkradio1, $GUI_Enable) GUICtrlSetState($chkradio2, $GUI_Enable) GUICtrlSetState($chkradio3, $GUI_Enable) GUICtrlSetState($chkradio4, $GUI_Enable) GUICtrlSetState($chkradio5, $GUI_Enable) ElseIf GUICtrlRead($chkSeries) = $GUI_UNCHECKED Then GUICtrlSetState($inpName, $GUI_Disable) GUICtrlSetState($inpNumber, $GUI_Disable) GUICtrlSetState($chkradio1, $GUI_Disable) GUICtrlSetState($chkradio2, $GUI_Disable) GUICtrlSetState($chkradio3, $GUI_Disable) GUICtrlSetState($chkradio4, $GUI_Disable) GUICtrlSetState($chkradio5, $GUI_Disable) EndIf EndFunc Func _chkradio5() If GUICtrlRead($chkradio5) = $GUI_CHECKED Then GUICtrlSetState($inpAutre, $GUI_Enable) ElseIf GUICtrlRead($chkradio5) = $GUI_UNCHECKED Then GUICtrlSetState($inpAutre, $GUI_Disable) EndIf EndFunc Func _GUI_EVENT_CLOSE() Exit EndFunc #EndRegion Func _FilleditCurrent() $FileList = _FileListToArray (@ScriptDir, "*.avi", 1) If @error Then MsgBox ( 0, "Pas de fichiers .avi dans ce dossier", "Il n'y a pas de fichiers .avi dans ce dossier. Mettre le Correcteur de Noms de Fichiers dans un dossier contenant des fichiers .avi et réessayer" ) Exit EndIf Dim $munge For $x = 1 to $FileList[0] $munge &= $FileList[$x] & @CRLF Next GUICtrlSetData($editCurrent, $munge) EndFunc Func ShowMeMakeChanges($ActionRequired) If $ActionRequired = "Show" Then Dim $munge = "" GUICtrlSetData($editChanged, "") $Array = _FileListToArray (@ScriptDir, "*.avi", 1) If @error Then Exit If GUICtrlRead($chkSeries) = $GUI_CHECKED Then $EpisodeList=_AutoSearch(GUICtrlRead($inpName),GUICtrlRead($inpNumber)) EndIf For $x = 1 To $Array[0] $munge &= Rename($Array[$x],$x) & @CRLF Next GUICtrlSetData($editChanged, $munge) GUICtrlSetState($btnMakeChanges, $GUI_Enable) GUICtrlSetState($btnMakeChanges, $GUI_DEFBUTTON) ElseIf $ActionRequired = "Change" Then $Array = _FileListToArray (@ScriptDir, "*.avi", 1) If @error Then Exit If GUICtrlRead($chkSeries) = $GUI_CHECKED Then $EpisodeList=_AutoSearch(GUICtrlRead($inpName),GUICtrlRead($inpNumber)) EndIf For $x = 1 To $Array[0] FileMove($Array[$x], Rename($Array[$x],$x), 1) Next MsgBox(0, "Résultat", "Modifications effectuées !", 3) GUICtrlSetData ($editChanged, "") GUICtrlSetData ($editCurrent, "") GUICtrlSetState($btnMakeChanges, $GUI_Disable) _FilleditCurrent() GUICtrlSetState ($chkAdd, $GUI_UNCHECKED) GUICtrlSetState ($chkTrim, $GUI_UNCHECKED) GUICtrlSetState ($chkStripChars, $GUI_UNCHECKED) GUICtrlSetState ($chkStripTrackNumber, $GUI_UNCHECKED) GUICtrlSetState ($chkReplace, $GUI_UNCHECKED) GUICtrlSetState ($chkRegExp, $GUI_UNCHECKED) GUICtrlSetState ($chkUnderscores, $GUI_UNCHECKED) GUICtrlSetState ($chkFixDashes, $GUI_UNCHECKED) GUICtrlSetData ($inpAdd, "") GUICtrlSetData ($inpTrimFile, "") GUICtrlSetData ($inpSpecialTrim, "") GUICtrlSetData ($inpReplace1, "") GUICtrlSetData ($inpReplace2, "") GUICtrlSetData ($inpRegExp, "") GuiCtrlSetState ($inpAdd, $GUI_Disable) GuiCtrlSetState ($inpTrimFile, $GUI_Disable) GuiCtrlSetState ($inpSpecialTrim, $GUI_Disable) GuiCtrlSetState ($inpReplace1, $GUI_Disable) GuiCtrlSetState ($inpReplace2, $GUI_Disable) GuiCtrlSetState ($inpRegExp, $GUI_Disable) EndIf EndFunc ;==>MakeChanges Func Rename($file,$x) If GUICtrlRead($chkAdd) = $GUI_CHECKED Then $file = GUICtrlRead($inpAdd) & $file EndIf If GUICtrlRead($chkTrim) = $GUI_CHECKED Then If GUICtrlRead($inpTrimFile) = "" Then $inpTrimFileread = 0 $file = StringTrimLeft($file, GUICtrlRead($inpTrimFile)) EndIf If GUICtrlRead($chkStripChars) = $GUI_CHECKED Then If GUICtrlRead($inpSpecialTrim) <> "" Then $file = StringReplace($file, GUICtrlRead($inpSpecialTrim), "", 0, 1) EndIf EndIf If GUICtrlRead($chkStripTrackNumber) = $GUI_CHECKED Then $file = StringRegExpReplace($file, "(?:\s|\A)([0-9]{1,3})(?:\s|\z)", "") EndIf If GUICtrlRead($chkReplace) = $GUI_CHECKED Then $inpReplace1read = GUICtrlRead($inpReplace1) $inpReplace2read = GUICtrlRead($inpReplace2) $file = StringReplace($file, $inpReplace1read, $inpReplace2read) EndIf If GUICtrlRead($chkRegExp) = $GUI_CHECKED Then If StringRegExp ($file, GUICtrlRead ($inpRegExp), 0) Then $RegExp = StringRegExp ($file, GUICtrlRead ($inpRegExp), 1) $file = StringReplace($file, $RegExp[0], "") EndIf EndIf If GUICtrlRead($chkUnderscores) = $GUI_CHECKED Then $file = StringReplace ($file, "_", " ") EndIf If GUICtrlRead($chkFixDashes) = $GUI_CHECKED Then $file = StringReplace ($file, "-", " - ", 1) EndIf $file = _StringProper($file) If GUICtrlRead($chkSeries) = $GUI_CHECKED Then Local $tmp_inpNumber If Number(GUICtrlRead($inpNumber)) < 10 Then $tmp_inpNumber="0" & String(Number(GUICtrlRead($inpNumber))) Else $tmp_inpNumber=String(Number(GUICtrlRead($inpNumber))) EndIf Local $y If $x<10 Then $y="0" & String($x) Else $y=String($x) EndIf Local $language If GUICtrlRead($chkradio1) = $GUI_CHECKED Then $language="Vo" ElseIf GUICtrlRead($chkradio2) = $GUI_CHECKED Then $language="Vf" ElseIf GUICtrlRead($chkradio3) = $GUI_CHECKED Then $language="Vostfr" ElseIf GUICtrlRead($chkradio4) = $GUI_CHECKED Then $language="Vosten" ElseIf GUICtrlRead($chkradio5) = $GUI_CHECKED Then $language=GUICtrlRead($inpAutre) EndIf $file = _StringProper(GUICtrlRead($inpName)) & " - [" & $tmp_inpNumber & "x" & $y & "] - " & _StringProper($language) & " - " & $EpisodeList[$x-1] & ".avi" EndIf $file = StringReplace($file, "Id ", "I'd ", 0, 1) $file = StringReplace($file, "Nobodys ", "Nobody's ", 0, 1) $file = StringReplace($file, "Aint ", "Ain't ", 0, 1) $file = StringReplace($file, "Youre ", "You're ", 0, 1) $file = StringReplace($file, "Ol ", "Ol' ", 0, 1) $file = StringReplace($file, "Im ", "I'm ", 0, 1) $file = StringReplace($file, "Ill ", "I'll ", 0, 1) $file = StringReplace($file, "Cant ", "Can't ", 0, 1) $file = StringReplace($file, "Dont ", "Don't ", 0, 1) $file = StringReplace($file, ".Mp3", ".mp3", 0, 1) $file = StringReplace($file, ".AVI", ".avi", 0, 1) $file = StringReplace($file, ".AVI", ".avi", 0, 1) If StringRegExp($file, "[[:word:]]'[[:upper:]]", 0) Then $RegExp = StringRegExp($file, "(?:[[:word:]]')([[:upper:]])", 4) For $i = 0 To UBound($RegExp) - 1 $match = $RegExp[$i] $file = StringReplace ($file, "'" & $match[1], "'" & StringLower($match[1]), 0, 1) Next EndIf If StringRegExp ($file, "'[[:upper:]]", 0) Then $RegExp = StringRegExp ($file, "'[[:upper:]]", 3) For $x = 1 to UBound($RegExp)-1 $file = StringReplace ($file, $RegExp[$x], StringLower($RegExp[$x])) Next EndIf If StringRegExp ($file, "\s'[[:lower:]]", 0) Then $RegExp = StringRegExp ($file, "\s'[[:lower:]]", 3) For $x = 1 to UBound($RegExp)-1 $file = StringReplace ($file, $RegExp[$x], StringUpper($RegExp[$x])) Next EndIf $file = StringReplace($file, ".Avi", ".avi", 0, 1) $file = StringStripWS ( $file, 5 ) Return $file EndFunc ;==>Rename Func _AutoSearch($inpName,$inpNumber) If $inpName= "" Then MsgBox(16, "AutoSearch Error", "You didn't enter the name of the show") Local $iShowID = _GetShowID($inpName) Local $sURL = "http://services.tvrage.com/feeds/episode_list.php?sid=" & $iShowID Local $sSource = _INetGetSource($sURL) If $inpNumber="" Then MsgBox(16, "AutoSearch Error", "You didn't enter the season number") Local $sStart = '<Season no="' & $inpNumber & '">' Local $sEnd = "</Season>" Local $sSeasonInfo = _StringBetween($sSource, $sStart, $sEnd) Local $aEpisodeList = StringRegExp($sSeasonInfo[0], "(?s)(?i)<Title>(.*?)</Title>", 3) Return $aEpisodeList EndFunc ;==>_AutoSearch Func _GetShowID($inpName) Local $sURL = "http://services.tvrage.com/tools/quickinfo.php?show=" & $inpName Local $sSource = _INetGetSource($sURL) Local $aSource = StringSplit($sSource, @CRLF, 2) $aSource = StringSplit($aSource[0], "@", 2) Local $iShowID = $aSource[1] Return $aSource[1] EndFunc ;==>_GetShowID Edited August 9, 2009 by Elishac Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 Ok, I've edited and corrected the mistake you pointed out. It works better now. The result isn't right though, and I know why : when the script makes the list of .avi files available, the list is made alphabetically. But sometimes people write "Lost - s1e1", "Lost - s1e2" and "Lost - s1e10", and therefore the second file in the list isn't "Lost - s1e2" but "Lost - s1e10". Do you have any idea how I could fix that ? Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 ok, let's try to do that until we find a better solution. how would we do it, and where would we insert it? Link to comment Share on other sites More sharing options...
GEOSoft Posted August 9, 2009 Share Posted August 9, 2009 ok, let's try to do that until we find a better solution. how would we do it, and where would we insert it? I haven't gone through all of your code yet so this is off the top and modified from one I used before. Loop through the array with this before sorting it ; For $i = 0 To Ubound($array) -1 $array[$i] = StringRegExpReplace($array[$i],"(?i)(.*\de)(\d{1})\z", "${1}0$2") Next ; George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Elishac Posted August 9, 2009 Author Share Posted August 9, 2009 (edited) errrr... where exactly do I put it? in the _FilleditCurrent() function ? (besides, isn't array <> Array ?) Also, can't that sorting not modify the name of the files ? It would be best if it was just used in intern to sort the files correctly, without modifying them. Edited August 9, 2009 by Elishac Link to comment Share on other sites More sharing options...
Elishac Posted August 10, 2009 Author Share Posted August 10, 2009 help Link to comment Share on other sites More sharing options...
Elishac Posted August 12, 2009 Author Share Posted August 12, 2009 >_ Link to comment Share on other sites More sharing options...
Elishac Posted August 15, 2009 Author Share Posted August 15, 2009 Can anybody please help me to finish my little script ? Link to comment Share on other sites More sharing options...
GEOSoft Posted August 15, 2009 Share Posted August 15, 2009 Can anybody please help me to finish my little script ?I certainly won't be helping until you learn to stop bumping posts. You were warned before. Your little script is only important to you and other people have code of their own to work at and their own lives to get on with. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Elishac Posted August 16, 2009 Author Share Posted August 16, 2009 As far as I know I was never warned before !? I happen to have seen your signature and I did wait 24hours before adding a new response (you can check it), if that's what you call bumping. I'm following your rules so I don't see why you get upset like that. If I don't "bump" it, how are you supposed to know I'm still needing help and that I haven't managed to get around it on my own ? If I don't add an answer, the post will be forgotten in the mass of the new posts and I'm sure you'll never ever add a new comment here. I don't mean to be a smartass it's just that I don't understand why you say that when I'm following your rules. Anyway, that's just my opinion. There's no need to answer to this particular reply (it's completely off topic), I know you have better things to do and I'd rather you helped me with my script instead. I hope someone will be able to tell me how to get around the sorting issue where in "test1,test2,test10", i get instead "test1,test10,test2". Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2009 Developers Share Posted August 16, 2009 I hope someone will be able to tell me how to get around the sorting issue where in "test1,test2,test10", i get instead "test1,test10,test2".The sorting you shown is correct. You will have to split the String portion from the numeric portion to be able to sort numerically or convert it to "test01,test02,test10" to be able to sort Alphanumerically. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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