2013年8月12日 星期一

利用vbs 實現網頁自動開啟的效果

利用vbs 實現網頁自動開啟的效果



剛才逛同事的部落格,發現的這有趣的程式,趕快來(c/p)一下,歡迎有興趣的(c/p)同好一起來測試 ^^。


呼叫(執行)的bat









cscript.exe 123.vbs



被呼叫的vbs


 









Dim WebPage(8)


WebPage(0) = "url address"


WebPage(1) = "url address"


WebPage(2) = "url address"


WebPage(3) = "url address"


WebPage(4) = "url address"


WebPage(5) = "url address"


WebPage(6) = "url address"


WebPage(7) = "url address"


 


 


waitTime= 10000 'wait period in milliseconds


 


' ------------------------------------------------------------------------------ '


' Start Main loop'


i = 0


Do Until i=8


 


        'do


                ' Initialize IE'


                Set objExplorer = CreateObject("InternetExplorer.Application")


                'objExplorer.AddressBar = 1


                'objExplorer.Toolbar = 1


                'objExplorer.StatusBar = 1


                objExplorer.Width = 800


                objExplorer.Height = 600


                objExplorer.Left = 0


                objExplorer.Top = 0


 


                ' load next page


                objExplorer.Navigate WebPage(i)


 


                ' wait while loading


                Do Until (objExplorer.readyState = 4)


                        wscript.sleep 1000


                Loop 'Until (objExplorer.readyState = 4)


 


                ' Show finnaly


                objExplorer.Visible = 1


 


                ' wait period'


                wscript.sleep waitTime


 


 


                ' close IE


                objExplorer.Quit


 


                ' check our loop


                i = i + 1


                'if i = 40 then


                        'i = 0


                'end if


        'loop


Loop'Until i=8



 


 


 


沒有留言:

張貼留言