溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

vbs如何實(shí)現(xiàn)百度小助手

發(fā)布時(shí)間:2021-10-12 10:34:22 來(lái)源:億速云 閱讀:127 作者:小新 欄目:開(kāi)發(fā)技術(shù)

這篇文章主要為大家展示了“vbs如何實(shí)現(xiàn)百度小助手”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“vbs如何實(shí)現(xiàn)百度小助手”這篇文章吧。

運(yùn)行它直接選擇:
1.我要回答;2.歌曲搜索;3,新聞搜索;4.網(wǎng)頁(yè)搜索;5.貼吧搜索;6.知道搜索;7.圖片搜索;8.視頻搜索;9;百科搜索;
然后輸入需要搜索的內(nèi)容即可直接自動(dòng)打開(kāi)轉(zhuǎn)到指定網(wǎng)址自動(dòng)進(jìn)行搜索.

代碼如下:


xz=InputBox("1.我要回答;2.歌曲搜索;3,新聞搜索;" & Chr(13) & "4.網(wǎng)頁(yè)搜索;5.貼吧搜索;6.知道搜索;" & Chr(13) & "7.圖片搜索;8.視頻搜索;9;百科搜索;","百度小助手 [Null_vbt]","")
If Len(xz)=0 Then
MsgBox "沒(méi)有選擇,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
Select Case xz
Case 1
x=Urlcode(InputBox("請(qǐng)輸入要回答的問(wèn)題","百度我要回答",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://zhidao.baidu.com/q?word=" & x & "&ct=17&pn=0&tn=ikaslist&rn=10&lm=65536&fr=answersearch_0"
End if
Case 2
x=Urlcode(InputBox("請(qǐng)輸入要搜索的歌曲名","百度歌曲搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
Else
strurl="http://mp3.baidu.com/m?f=ms&tn=baidump3&ct=134217728&lf=&rn=&word=" & x & "&lm=-1"
End if
Case 3
x=Urlcode(InputBox("請(qǐng)輸入要搜索的新聞標(biāo)題","百度新聞搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=" & x & "&t=1"
End if
Case 4
x=Urlcode(InputBox("請(qǐng)輸入要搜索的內(nèi)容","百度網(wǎng)頁(yè)搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://www.baidu.com/s?cl=3&wd=" & x
End if
Case 5
x=Urlcode(InputBox("請(qǐng)輸入要搜索的貼子標(biāo)題","百度貼吧搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://tieba.baidu.com/f?kw=" & x
End if
Case 6
x=InputBox("請(qǐng)輸入要搜索的知道標(biāo)題","百度知道搜索","")
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=" & x
End if
Case 7
x=Urlcode(InputBox("請(qǐng)輸入要搜索的圖片標(biāo)題","百度圖片搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word=" & x & "&t=3"
End if
Case 8
x=Urlcode(InputBox("請(qǐng)輸入要搜索的視頻標(biāo)題","百度視頻搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=7&word=" & x
End if
Case 9
x=Urlcode(InputBox("請(qǐng)輸入要搜索的百科標(biāo)題","百度百科搜索",""))
If Len(x)=0 Then
MsgBox "沒(méi)有檢測(cè)到內(nèi)容,腳本退出!",64,"錯(cuò)誤"
WScript.Quit
else
strurl="http://baike.baidu.com/w?ct=17&lm=0&tn=baiduWikiSearch&pn=0&rn=10&word=" & x
End if
End Select
End if
Set objIe = CreateObject("InternetExplorer.Application")
objie.visible=true
objIe.Navigate strUrl
function Urlcode(InpStr)
Dim InpAsc,I
For I = 1 To Len(InpStr)
InpAsc = Asc(Mid(InpStr, I, 1))
If ((InpAsc < 58) And (InpAsc > 47)) Or ((InpAsc < 91) And (InpAsc > 64)) Or ((InpAsc < 123) And (InpAsc > 96)) Then
Urlcode = Urlcode & Chr(InpAsc)
Else
Urlcode = Urlcode & "%" & mid(Trim(Hex(InpAsc)),1,2) & "%" & mid(Trim(Hex(InpAsc)),3,2)
End If
Next
end Function

以上是“vbs如何實(shí)現(xiàn)百度小助手”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

vbs
AI