ºÜ¶à×ÜÊÇÎÊÓÃÈí¼þÔõô×Ô¶¯°ÑÁбíµÄÄÚÈÝÉú³ÉÒ»¸öÒ»¸ö¼Çʱ¾£¬½ñÌì°Ñ½Å±¾Ä£¿é·ÅÔÚÕâÀ﹩´ó¼Ò·½±ãÏÂÔØ£º
Õâ¸öÑ¡Ôñ±£´æ·¾¶Òª×¢Òâ½áÊøÓ¦¸ÃÓÐÒ»ÌõÏߵġ£ÕâÀïÕâô¶àÁÐ±í£¬¡¼✔Äú☑¡½Èç¹ûÏë×ö½áºÏ¾Í·Ö±ðµ¼Èë½øÈ¥£¬Èç¹ûÖ»ÏëÒ»¸ö±êÌâºÍ¸öÄÚÈÝ£¬ÄǾÍ˳Ðòµ¼Èëij¸ö¾Í¿ÉÒÔÁË¡£
Õâ¶Î´úÂëÊÇÒ»¸öÔËÐÐVBS´úÂëµÄÄ£¿é£¬Í¨¹ýÉèÖÃVBS±äÁ¿¡¢¸³ÖµºÍ±àдVBS½Å±¾ÊµÏÖ½«±äÁ¿ÖеÄÐÅϢдÈëµ½Ö¸¶¨µÄÎı¾ÎļþÖС£ ¾ßÌåÀ´Ëµ£¬´úÂë¿éÖаüº¬¶à¸ö¹¦Äܲ¿·Ö£º
1. <VBS±äÁ¿>vbs</VBS±äÁ¿>£ºÓÃÀ´ÉèÖÃVBS½Å±¾ÖÐÐèÒª´«µÝµÄ±äÁ¿£¬ÔÚ±¾ÀýÖУ¬ÊDZäÁ¿±êÌâ(strTitle)ºÍ±äÁ¿ÄÚÈÝ(strContent)¡£ 2. <¸³Öµ></¸³Öµ>£ºÓÃÓÚÏò±äÁ¿Öд«µÝÖµ£¬ÔÚ±¾ÀýÖУ¬±äÁ¿±êÌâºÍ±äÁ¿ÄÚÈݵÄÖµ½«´ÓÆäËûÄ£¿éÖлñÈ¡¡£ 3. <VBS´úÂë>µ½</VBS´úÂë>£ºÕâÊÇ°ü¹üVBS½Å±¾µÄ´úÂë¿é£¬ÔÚÕâÀﶨÒåÁËVBS½Å±¾µÄ¾ßÌåÄÚÈÝ£¬°üÀ¨Èçϼ¸¸ö²¿·Ö£º 3. '¶¨ÒåÎı¾Ãû³ÆºÍÄÚÈݱäÁ¿£ºÓÃÓÚ¶¨ÒåVBS½Å±¾ÖÐÐèҪʹÓõÄÎı¾Ãû³Æ±äÁ¿(strFileName)ºÍÎı¾ÄÚÈݱäÁ¿(strContent)¡£ 3. strFileName="[±äÁ¿±êÌâ].txt"£º¶¨ÒåÁËÎı¾¼Ç¼µÄÎļþÃû³Æ£¬ÆäÖбäÁ¿±êÌâ»á¸ù¾ÝÉÏÃæÉèÖõıäÁ¿½øÐÐÌæ»»¡£ 3. strFileName=Replace(strFileName,"","_")£º½«ÎļþÃû³ÆÖеĿոñºÍÆäËûÎÞЧ×Ö·ûÌ滻ΪÏ»®Ïß¡£ 3. strFileName=Replace(strFileName,vbCr,"")ºÍstrFileName=Replace(strFileName,vbLf,"")£º½«Îı¾ÖеĻسµºÍ»»Ðзû£¨vbCrºÍvbLf£©É¾³ý¡£ 3. strTitle="[±äÁ¿±êÌâ]"ºÍstrContent="[±äÁ¿ÄÚÈÝ]"£º·Ö±ð¶¨ÒåÁËÎı¾ÎļþÖеıêÌâºÍÄÚÈÝ£¬ÆäÖбäÁ¿±êÌâºÍ±äÁ¿ÄÚÈÝ»á¸ù¾ÝÉÏÃæÉèÖõıäÁ¿½øÐÐÌæ»»¡£ 3. strPath="[Îı¾¿ò:±£´æµÄÎļþ¼ÐÑ¡Ôñ]"£º¶¨ÒåÁËÎı¾ÎļþµÄ´æ·Å·¾¶£¬ÆäÖÐ[Îı¾¿ò:±£´æµÄÎļþ¼ÐÑ¡Ôñ]±íʾÐèҪͨ¹ý½çÃæÑ¡Ôñ¡£ 3. Set objFSO = CreateObject("Scripting.FileSystemObject")£º´´½¨Ò»¸öFileSystemObject¶ÔÏó£¬ÓÃÓÚ²Ù×÷Îļþϵͳ¡£ 3. Set objFile = objFSO.CreateTextFile(strPath & strFileName)£ºÍ¨¹ýFileSystemObject¶ÔÏó´´½¨Îı¾Îļþ£¬²¢´ò¿ªÎļþ¡£ 3. objFile.WriteLine strTitleºÍobjFile.WriteLine ""ºÍobjFile.WriteLine strContent£º·Ö±ð½«Îı¾ÎļþÖеıêÌâ¡¢¿ÕÐкÍÄÚÈÝдÈëµ½ÎļþÖС£ 3. objFile.Close£º¹Ø±ÕÎļþ¡£
×îºó£¬{/ÔËÐÐVBS}%>ÖеĴúÂ붨λµ½¡°ÔËÐÐVBS´úÂ롱ģ¿é£¬²¢ÇÒÔÚ´úÂë¿éÖлáµ÷ÓÃVBS½Å±¾ÊµÏÖÌض¨µÄ¹¦ÄÜ¡£
»¹ÓеÄÈËÀÏÊÇÎÊͼƬ»òÊÇÏÂÔؼþÔõôֱ½ÓÏÂÔص½Èí¼þÀ»¹¿ÉÒÔʵÏÖ¶àỊ̈߳¬ÕâÑù¾Í¿ÉÒÔË¢ÏÂÔØÁ¿£¬»òÊÇ͵±ðÈËÍøÕ¾µÄͼƬʲôµÄ£¬Ò²°ÑÔ´Âë·ÅÔÚÕâÀ﹩´ó¼ÒÏÂÔØ£º
Õâ¶Î´úÂëʵÏÖÁË´ÓÍøÒ³»ñÈ¡ÏÂÔصØÖ·£¬²¢½«ÏÂÔصÄÎļþ±£´æµ½Ö¸¶¨µÄÎļþ¼ÐÖУ¬ÎļþÃûÊÇËæ»úÉú³ÉµÄ15¸ö×Öĸ¼ÓÉÏ.mp4ºó׺Ãû¡£
´úÂë¿éÖеÄ<VBS´úÂë>ºÍ</VBS´úÂë>°ü¹üÁËVBS½Å±¾£¬ÓÃÓÚʵÏÖ¾ßÌåµÄÏÂÔغͱ£´æ²Ù×÷¡£ÏÂÃæÊǽű¾µÄ¾ßÌ幦ÄÜ£º
1. strUrl = "{»ñÈ¡ÁбíÖµ}ÏÂÔصØÖ·|ÍøÖ·|×Ô¶¯{/»ñÈ¡ÁбíÖµ}"£º´ÓÍøÒ³ÖлñÈ¡ÏÂÔصØÖ·£¬²¢½«Æä±£´æµ½strUrl±äÁ¿ÖС£
2. strFile = "[Îı¾¿ò:ÏÂÔØÎļþ¼Ð]\[Ëæ»ú×Öĸ15λ].mp4"£ºÉèÖÃÏÂÔغ󱣴æµÄÎļþÃû£¬ÆäÖÐ[Îı¾¿ò:ÏÂÔØÎļþ¼Ð]±íʾÐèÒªÔÚ½çÃæÖÐÑ¡ÔñÏÂÔØÎļþµÄ·¾¶£¬[Ëæ»ú×Öĸ15λ]Ôò±íʾËæ»úÉú³ÉµÄ15¸ö×Öĸ¡£
3. Set objXMLHttp = CreateObject("MSXML2.XMLHTTP")£º´´½¨Ò»¸öXMLHttpRequest¶ÔÏó£¬ÓÃÓÚÏò·þÎñÆ÷·¢ËÍHTTPÇëÇó»ñÈ¡ÏÂÔØÄÚÈÝ¡£
4. objXMLHttp.open "GET", strUrl, false£º·¢ËÍHTTP GETÇëÇ󣬲¢½«ÏÂÔصØÖ·±£´æµ½strUrl±äÁ¿ÖС£
5. objXMLHttp.send()£º·¢ËÍHTTPÇëÇóµ½·þÎñÆ÷£¬»ñÈ¡ÏÂÔØÄÚÈÝ¡£
6. If objXMLHttp.Status = 200 Then£ºÈç¹ûHTTPÇëÇó³É¹¦£¬Ôò¼ÌÐøÖ´ÐÐÏÂÃæµÄ´úÂë¡£
7. set objADOStream=CreateObject("ADODB.Stream")£º´´½¨Ò»¸öADODB.Stream¶ÔÏó£¬ÓÃÓÚ½«ÏÂÔØÄÚÈݱ£´æµ½±¾µØÎļþÖС£
8. objADOStream.Open objADOStream.Type = 1 'adTypeBinary£º´ò¿ªADODB.Stream¶ÔÏ󣬲¢ÉèÖÃÀàÐÍΪ¶þ½øÖÆ£¨adTypeBinary£©¡£
9. objADOStream.Write objXMLHttp.ResponseBody£º½«´Ó·þÎñÆ÷»ñÈ¡µÄ¶þ½øÖÆÊý¾ÝдÈëµ½ADOStream¶ÔÏóÖС£
10. objADOStream.Position = 0£º½«Á÷µÄλÖÃÉèÖÃΪ¿ªÊ¼Î»Öá£
11. Set objFSO = Createobject("Scripting.FileSystemObject")£º´´½¨Ò»¸öFileSystemObject¶ÔÏó£¬ÓÃÓÚ²Ù×÷Îļþϵͳ¡£
12. if objFSO.Fileexists(strFile) then£ºÈç¹ûÎļþÒѾ´æÔÚ£¬Ôòɾ³ýÎļþ¡£
13. objADOStream.SaveToFile strFile£º½«ADOStream¶ÔÏóÖеÄÊý¾Ý±£´æµ½Ö¸¶¨µÄÎļþÖС£
14. objADOStream.Close set objADOStream = nothing£º¹Ø±Õ²¢Çå³ýADOStream¶ÔÏó¡£
15. set objXMLHttp = nothing£ºÇå³ýXMLHttpRequest¶ÔÏó¡£
×îºóµÄ {/ÔËÐÐVBS}%> ¶¨Î»µ½¡°ÔËÐÐVBS´úÂ롱ģ¿é£¬²¢ÔÚ´úÂë¿éÖе÷ÓÃVBS½Å±¾Ö´ÐÐÏÂÔغͱ£´æ²Ù×÷¡£
|