t11wright Posted June 13, 2015 Share Posted June 13, 2015 Func Start() while 1 $file = "youtube.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) $NewURL = ClipPut($line) $NewURL = ClipGet() Local $oIE = _IECreate($NewURL) _IELoadWait($oIE) Local $oDiv = _IEGetObjById($oIE, "eow-title") _IEQuit($oIE) $file = FileOpen("youtubetitles.txt", 1) FileWrite($file, $oDiv.innertext & @CRLF) FileClose($file) WEnd EndFuncyoutube.txt has 3 lines of youtube adresses.. With this script I can only find youtube title of first line. Want to find second and third title too. Can you please help me ? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 13, 2015 Developers Share Posted June 13, 2015 (edited) Your code is quite messy when it comes to the use of the variable $file. It is both used as the original input filename and the output filehandle!What is the ClipPut & Clipget for?This should be close but is untested!Func Start() $file = "youtube.txt" $fhi = FileOpen($file, 0) If @error Then Return 0 $fho = FileOpen("youtubetitles.txt", 1) While 1 $line = FileReadLine($fhi) If @error Then ExitLoop ; EOF encountered ;~ What is this for? ;~ $NewURL = ClipPut($line) ;~ $NewURL = ClipGet() Local $oIE = _IECreate($NewURL) _IELoadWait($oIE) Local $oDiv = _IEGetObjById($oIE, "eow-title") FileWrite($fho, $oDiv.innertext & @CRLF) _IEQuit($oIE) WEnd FileClose($fhi) FileClose($fho) return 1 EndFunc ;==>StartJos Edited June 13, 2015 by Jos RestrictedUser 1 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...
t11wright Posted June 13, 2015 Author Share Posted June 13, 2015 Thanks for your code!!I had to define $NewURL as Global and now it works!$NewURL = ClipPut($line) $NewURL = ClipGet()without these lines opens an empty IE page. 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