#include #include #include #include #Include #include $NotFoundLogFile = "NotFound.txt" ; use date functions here... $notfoundlogfile = FileOpen($NotFoundLogFile, 1) $FoundLogFile = "Found.txt" ; use date functions here... $foundlogfile = FileOpen($FoundLogFile, 1) ; Check if file opened for writing OK If $notfoundlogfile = -1 Then MsgBox(0, "Error", "Unable to open file: " & $NotFoundLogFile) Exit EndIf FileWrite($notfoundlogfile, "Starting NDS." & @CRLF) ; Check if file opened for writing OK If $foundlogfile = -1 Then MsgBox(0, "Error", "Unable to open file: " & $FoundLogFile) Exit EndIf FileWrite($foundlogfile, "Starting NDS." & @CRLF) ; loop Games.txt file ; strip title out of line ; ; File Format: ; 0002 - Need For Speed - Underground 2 (U)(Trashman)(C37AB273).zip ; 0003 - Yoshi Touch & Go (U)(Trashman)(03D56334).zip ; 0004 - Feel the Magic - XY-XX (U)(Trashman)(662D929F).zip ; $line = "0003 - Yoshi Touch & Go (U)(Trashman)(03D56334).zip" ; $days = StringSplit("Sun,Mon,Tue,Wed,Thu,Fri,Sat", ",") ; $days[1] contains "Sun" ... $days[7] contains "Sat" ; String Replace ; $text = StringReplace("this is a line of text", " ", "-") ; $result = StringTrimLeft("I am a string", 3) ; MsgBox(0, "String without leftmost 3 characters is:", $result) $oIE = _IECreate("http://www.gamespot.com") _IELoadWait ($oIE) $file = FileOpen("AllGames.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file cms_batch.txt") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ; MsgBox(0, "Line read:", $line) ; ClipPut ($line) ConsoleWrite("FULL LINE IS " & $line & @CR) $fullNameSplit = StringSplit($line, "(") $FullGameName = StringStripWS($fullNameSplit[1], 2) DirCreate($FullGameName) $GameLogFile = $FullGameName & "\" & $FullGameName & ".txt" ; use date functions here... $gamelogfile = FileOpen($GameLogFile, 9) ; Check if file opened for writing OK If $gamelogfile = -1 Then MsgBox(0, "Error", "Unable to open file GameLogFile: " & $gamelogfile & "at path: " & $GameLogFile) Exit EndIf FileWrite($gamelogfile, "Info for " & $FullGameName & ":" & @CRLF) $StripFront = StringTrimLeft($line, 7) $Replace = StringReplace($StripFront, " - ", " ") $Split = StringSplit($Replace, "(") $GameName = $Split[1] $GameName = StringTrimRight($GameName, 1) ; MsgBox(0, "String without leftmost 3 characters is:", $GameName) ; http://www.gamespot.com/search.html?qs=Knights+in+the+Nightmare+%28DS%29 ; http://www.gamespot.com/search.html?qs= game+name +%28DS%29 Global $GameURL = StringReplace($GameName, " ", "+") $GameFound = 0 ; loop through file regex for file name to search _IENavigate($oIE, "http://www.gamespot.com/search.html?qs=" & $GameURL & "+%28DS%29") _IELoadWait ($oIE) ConsoleWrite("Starting a new search looking for the games link" & @CR) $splitGame = StringSplit($GameName, ' ', 1) $firstWord = $splitGame[1] $lastWord = $splitGame[$splitGame[0]] ConsoleWrite ("Last Word: " & $lastWord & @CR) $sMyString = $GameName & " (DS)" $sMyLastString = $lastWord & " (DS)" ; $sMyFirstThreeString = $firstWord & " " & $secondWord & " " & $thirdWord ConsoleWrite ("Last Word / STRING : " & $sMyLastString & @CR) $oDiv = _IEGetObjById ($oIE, "content") $oLinks = _IELinkGetCollection($oDiv) For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then ConsoleWrite("There are OUT OF LOOP") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND " & $sMyString & @CR) EndIf If StringInStr($sLinkText, "(DS)") Then ConsoleWrite("There are OUT OF LOOP") $oDiv = _IEGetObjById ($oIE, "results") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink FileWrite($notfoundlogfile, "WARNING: No Direct Match for: " & $sMyString & @CRLF) FileWrite($notfoundlogfile, "WARNING: Manually Verify this is the correct link: " & $oLink & @CRLF) _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND (DS)" & @CR) EndIf Next if $GameFound = 0 Then ; TRY AGAIN _IENavigate($oIE, "http://www.gamespot.com/search.html?qs=" & $GameURL & "+%28DS%29") _IELoadWait ($oIE) ConsoleWrite("Starting a new search looking for the games link" & @CR) $splitGame = StringSplit($GameName, ' ', 1) $firstWord = $splitGame[1] $lastWord = $splitGame[$splitGame[0]] ConsoleWrite ("Last Word: " & $lastWord & @CR) $sMyString = $GameName & " (DS)" $sMyLastString = $lastWord & " (DS)" ; $sMyFirstThreeString = $firstWord & " " & $secondWord & " " & $thirdWord ConsoleWrite ("Last Word / STRING : " & $sMyLastString & @CR) $oDiv = _IEGetObjById ($oIE, "results") $oLinks = _IELinkGetCollection($oDiv) For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then ConsoleWrite("There are OUT OF LOOP") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND " & $sMyString & @CR) EndIf If StringInStr($sLinkText, "(DS)") Then ConsoleWrite("There are OUT OF LOOP") $oDiv = _IEGetObjById ($oIE, "results") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink FileWrite($notfoundlogfile, "WARNING: No Direct Match for: " & $sMyString & @CRLF) FileWrite($notfoundlogfile, "WARNING: Manually Verify this is the correct link: " & $oLink & @CRLF) _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND (DS)" & @CR) EndIf Next ; TRY AGAIN _IENavigate($oIE, "http://www.gamespot.com/search.html?qs=" & $GameURL & "+%28DS%29") _IELoadWait ($oIE) ConsoleWrite("Starting a new search looking for the games link" & @CR) $splitGame = StringSplit($GameName, ' ', 1) $firstWord = $splitGame[1] $lastWord = $splitGame[$splitGame[0]] ConsoleWrite ("Last Word: " & $lastWord & @CR) $sMyString = $GameName & " (DS)" $sMyLastString = $lastWord & " (DS)" ; $sMyFirstThreeString = $firstWord & " " & $secondWord & " " & $thirdWord ConsoleWrite ("Last Word / STRING : " & $sMyLastString & @CR) $oDiv = _IEGetObjById ($oIE, "results") $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then ConsoleWrite("There are OUT OF LOOP") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND " & $sMyString & @CR) EndIf If StringInStr($sLinkText, "(DS)") Then ConsoleWrite("There are OUT OF LOOP") $oDiv = _IEGetObjById ($oIE, "results") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $GameFound = 1 GameFound() $MainPageURL = $oLink FileWrite($notfoundlogfile, "WARNING: No Direct Match for: " & $sMyString & @CRLF) FileWrite($notfoundlogfile, "WARNING: Manually Verify this is the correct link: " & $oLink & @CRLF) _IEAction($oLink, "click") _IELoadWait ($oIE) ExitLoop Else ConsoleWrite ($sLinkText & "NOT FOUND (DS)" & @CR) EndIf Next EndIf if $GameFound = 0 Then MsgBox(2,"WARNING", "Skipping GAME NOT FOUND: " & $GameName) FileWrite($notfoundlogfile, "No link found for Game: " & $GameName & @CRLF) FileWrite($notfoundlogfile, "No link found for URL : " & $GameURL & @CRLF) EndIf #cs $sMyString = "boxshot" $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") ; ConsoleWrite("LINK FOUND: " & $oLink & @CR) If StringInStr($sLinkText, $sMyString) Then ; _IEAction($oLink, "click") ConsoleWrite("LINK MATCH CLICKING: " & $sLinkText & " - " & $sMyString & @CR) ExitLoop Else ConsoleWrite("LINK NO MATCH: " & $sLinkText & " - " & $sMyString & @CR) EndIf Next #ce ; src: http://image.com.com/gamespot/images/2003/all/boxshots2/924890.jpg if $GameFound = 1 Then _IELoadWait ($oIE) _IELoadWait ($oIE) ; now try to grab the background img banner and save url for game shots $oDiv = _IEGetObjByID ($oIE, "summary_module") $GameReviewScoreRawRaw = _IEPropertyGet($oDiv, "innerhtml") $GameReviewScoreRaw = StringSplit($GameReviewScoreRawRaw, '