Jump to content

pollop

Active Members
  • Posts

    35
  • Joined

  • Last visited

Profile Information

  • Location
    Brussels, Belgium

pollop's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks a lot for the reply... I think i'm gonna continue using my solution Here it is (if someone needs something like that) Func HtmlBetween($sText, $sStart, $sEndTag = "</div>") Local $sCountUp Local $sCountDown Switch $sEndTag Case "</div>" $sCountUp = "<div" $sCountDown = "</div>" Case "</span>" $sCountUp = "<span" $sCountDown = "</span>" Case "</ul>" $sCountUp = "<ul" $sCountDown = "</ul>" Case "</li>" $sCountUp = "<li" $sCountDown = "</li>" Case "</a>" $sCountUp = "<a" $sCountDown = "</a>" Case Else LogError("Func HtmlBetween: Wrong type tag") Return False EndSwitch ; We begin by deleting what's before the start. Local $sStartPos = StringInStr($sText, $sStart) If $sStartPos == 0 Then LogError("Func HtmlBetween: Can't find the start") Return False EndIf $sText = StringTrimLeft($sText, $sStartPos + StringLen($sStart) - 1) ; We now search for the content Local $iNumberUp = 1 Local $iNumberDown = 0 Local $iUp Local $iDown While $iNumberDown <> $iNumberUp $iUp = StringInStr($sText, $sCountUp, 0, $iNumberUp) $iDown = StringInStr($sText, $sCountDown, 0, $iNumberDown + 1) If $iUp > 0 And $iUp < $iDown Then $iNumberUp += 1 ElseIf $iDown > 0 Then $iNumberDown += 1 Else LogError("Func HtmlBetween: Can't parse HTML, number of open tags != number of closing tags") Return False EndIf WEnd ; We get everything that's before the last closing tag Return StringLeft($sText, $iDown - 1) EndFunc
  2. Hi, I'm wondering if it's possible to use RegExp to "parse" html. Here's what I want to do: For example, i have the following text : " <div> Blabla <div> <div> Blabla </div> </div> Blabla </div> " I'm wondering if it's possible to get what's inside the higher div with a regexp. Something that would return : " Blabla <div> <div> Blabla </div> </div> Blabla " I wrote a function that count the number of opening <div> and closing </div> and continue to search until the two numbers are equal. But I think it would be much more efficient with a "simple" regexp. What do you think ? Thanks a lot for your help and sorry for my bad english Pollop.
  3. Why killing the old one and not the new one ?
  4. Can you tell me a little bit more about that ? Thanks. Haha ^.^ Thanks again anyway
  5. OMG ! Thank you so much ! Your code is so clean ^.^ It works perfectly Thanks to you i can now just be in my bed and the episodes of my favorite tv show are launched automaticly ! Here's my final Function : Func guessNextEpisodeFullPath($sFileFullPath = False) LogIt(" Trying to gess the next episode full path.") If Not $sFileFullPath Then $sFileFullPath = getFileRunningFullPath() EndIf If $sFileFullPath Then Local $szDrive, $szDir, $szFName, $szExt _PathSplit($sFileFullPath, $szDrive, $szDir, $szFName, $szExt) Local $episodeRegEx = StringRegExp($szFName, "(\d+)", 3) If @error Then Return False Local $lastDigit = $episodeRegEx[UBound($episodeRegEx) - 1] Local $sNextEpisodeFullPath = $szDrive & $szDir & StringReplace($szFName, $lastDigit, StringFormat('%0' & StringLen($lastDigit) & 'i', Number($episodeRegEx[UBound($episodeRegEx) - 1]) + 1)) & $szExt If FileExists($sNextEpisodeFullPath) Then Return $sNextEpisodeFullPath EndIf EndIf Return False EndFunc ;==> guessNextEpisodeFullPath Here is the log File of my script = It's seems that there is a new file playing. == File Name : CSI_Miami_7x01.avi == Full Path : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x01.avi == Total Runtime : 2497 == Credits appears at : 2341 == Next Episode Full Path (From INI) : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x02.avi = We are at the end of the Video. Closing the player. = Automatic launching of next episode : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x02.avi = It's seems that there is a new file playing. == File Name : CSI_Miami_7x02.avi == Full Path : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x02.avi == Total Runtime : 2491 == Credits appears at : 2341 == Next Episode Full Path (From INI) : False == [W] Can't find next episode path (in INI File). Will try to guess it... == Guessing of next episode path : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x03.avi = We are at the end of the Video. Closing the player. = Automatic launching of next episode : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x03.avi = It's seems that there is a new file playing. == File Name : CSI_Miami_7x03.avi == Full Path : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x03.avi == Total Runtime : 2462 == [W] Can't find when the credits appears (in INI File). Will use total runtime instead. == Credits appears at : 2462 == Next Episode Full Path (From INI) : False == [W] Can't find next episode path (in INI File). Will try to guess it... == Guessing of next episode path : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x04.avi = We are at the end of the Video. Closing the player. = Automatic launching of next episode : C:\NAS\Series\CSI Miami\Saison 7\CSI_Miami_7x04.avi Again, thanks a lot guys
  6. Yeah ! RegExp are so powerful Your script is amazing for almost every cases ! Thanks a lot ! There are just some cases not working but i'll try to fix that Test start with: myfile_7x055.mp4 Test expected: myfile_7x056.mp4 Test got: myfile_7x56.mp4 ! Test failed Test start with: someText456someText123SomeText.mp4 Test expected: someText456someText124SomeText.mp4 Test got: ! Test failed
  7. OMG ! It's so nice to see so much people helping me Thanks a lot guys ! I'll try all the code you posted and choose the one that's the best for me... I'll maybe need to change it a little bit 'cause there are many cases... Here are some exemples : "myfile_7x05.avi" => "myfile_7x06.avi" "myfile_7x09.avi" => "myfile_7x10.avi" "myfile_7x099.avi" => "myfile_7x100.avi" With extention : "myfile_7x04.mp4" => "myfile_7x05.mp4" (and not myfile_7x04.mp5) Generally : "someText837462someText2737someText.AnyExtention" => "someText837462someText2738someText.AnyExtention" It's not needed that "myfile_7x9.avi" => "myfile_7x10.avi" 'cause if i have more than 9 file i'll use the 09 notation It's not needed that "myfile_7x99.avi" => "myfile_7x100.avi" 'cause if i have more than 99 file i'll use the 099 notation Anyway, thanks a lot for your help guys ! If you still have a little time for me, it would be great. But it's already so nice to helped me so much. Thank you PS : Again, sorry for my english guys !
  8. Hi, I'm trying to make a function that raise the last digit found in a string. I think I have to use the RegExp but I'm not getting what I want :/ Exemple : The string is "CSI_Miami_7x04.avi" I would like the function to return "CSI_Miami_7x05.avi" I tried : $sFileName = StringRegExpReplace($sFileName, '(\d)', '$1+1') $sFileName = StringRegExpReplace($sFileName, '(\d)', '$1'+1) But none of them are working :/ Can you help me a little ? Thanks a lot ! ( Sorry for my poor english ^.^ I'm doing my best )
  9. Thanks a lot for your help ! How can i be sure that it's a @CRLF and not a @LF ou @CR :/ Will there be a problem if i use @CRLF and if it's a @LF ? Thanks
  10. Hi I'm trying to get some informations from a text but i have some problems doing it :/ Here's is the string contained in a variable : 10:59 / 41:37 Frame-rate 24.89 (1X) Sync Offset avg: 0 ms, dev: 5 ms Frames drawn: 384, dropped: 1 Jitter 3 ms Buffers [0]: 1153/4267 KB [1]: 1895/854 KB (p0) Bitrate [0]: 600/348 Kb/s [1]: 159/153 Kb/s (avg/cur) Shader Editor Shader Editor Delete Subresync Playlist Playlist Capture Settings Capture Settings ... What i'm trying to do is to extract the "10:59" and "41:37" into two variables... ( If the runtime is more than an hour, it's in three parts : "01:25:11") How can i extract the text until the carriage return ? Thanks. Pollop PS : Sry for my poor english, i'm doing my best
  11. Sry, i didn't understand :/
  12. Thanks And i can use it everywhere or only on my gui ?
  13. Hi, Is it possible to do something like this ? But personalised Thanks >_<
  14. Hey I'm using the last version of autoit and i have problems with my GUI ... I always got those message when i use Extended Variables Can you help me plz ? Thanks
  15. I found a tip to crack it Remove all your "removable devices". The soft lock the computer by using this loop For $i = 1 To Number_of_device If $i = Number_of_device Then lock() Endif Next So if you have no device connected, the program do not go into the loop and do not lock the computer. Sry for my english xD I'm working on a better version with a GUI
×
×
  • Create New...