bookfind 通过ISBN序号获取图书连接的书名与作者的vbs代码_vbs

核心代码:

复制代码 代码如下:

If WScript.Arguments.UnNamed.Count <> 1 Then Syntax
If WScript.Arguments.Named.Count > 1 Then Syntax
blnTd = False
If WScript.Arguments.Named.Count = 1 Then
If UCase( WScript.Arguments.Named( 0 ) ) = "/TD" Then
blnTd = True
Else
Syntax
End If
End If
strISBN = WScript.Arguments.UnNamed( 0 )
strPgTitle = TitleFromHTML( "http://www.amazon.com/gp/product/" & strISBN & "/" )
strPattern = "Amazon.com: (.*): Books: (.*)$"
strTitle = RegExpVal( strPattern, strPgTitle, 0 )
strAuthor = RegExpVal( strPattern, strPgTitle, 1 )
If blnTd Then
strMsg = strISBN & vbTab & strTitle & vbTab & strAuthor & vbCrLf
Else
strMsg = vbCrLf & "Title : " & strTitle _
& vbCrLf & "Author : " & strAuthor _
& vbCrLf & "ISBN : " & strISBN
End If
WScript.Echo strMsg
Function RegExpVal( strPattern, strString, idx )
On Error Resume Next
Dim regEx, Match, Matches, RetStr
Set regEx = New RegExp
regEx.Pattern = strPattern
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute( strString )
RegExpVal = Matches( 0 ).SubMatches( idx )
End Function
Function TitleFromHTML( strURL )
Set ie = CreateObject( "InternetExplorer.Application" )
ie.Navigate strURL
Do Until ie.ReadyState = 4
WScript.Sleep 10
Loop
TitleFromHTML = ie.Document.Title
ie.Quit
End Function
Sub Syntax
strMsg = strMsg & vbCrLf & "BookFind.vbs, Version 1.11" & vbCrLf _
& "Display book title and author name for the specified ISBN number." & vbCrLf & vbCrLf _
& "Usage: CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]" & vbCrLf & vbCrLf _
& "Where: ""isbn"" is the ISBN (or ASIN) of the book to search for" & vbCrLf _
& " /TD changes the output format to tab delimited" & vbCrLf & vbCrLf _
& "Note: This script uses Amazon's web site to look up author and title." & vbCrLf _
& " To be precise, the data is extracted from the title of the page" & vbCrLf _
& " with URL http://www.amazon.com/gp/product/ followed by the ISBN." & vbCrLf _
& " That means this script will fail when Amazon changes the URLs." & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
Wscript.Echo( strMsg )
Wscript.Quit( 1 )
End Sub

使用方法:
CSCRIPT //NOLOGO BOOKFIND.VBS isbn [ /TD ]
Where: "isbn" is the ISBN (or ASIN) of the book to search for
/TD changes the output format to tab delimited
Note: This script uses Amazon's web site to look up author and title.
To be precise, the data is extracted from the title of the page
with URL http://www.amazon.com/gp/product/ followed by the ISBN.
That means this script will fail when Amazon changes the URLs.

时间: 2024-11-03 07:55:28

bookfind 通过ISBN序号获取图书连接的书名与作者的vbs代码_vbs的相关文章

获取屏幕分辨率的VBS代码_vbs

我想到的方法有两种. 一种是WMI中的Win32_DesktopMonitor类 复制代码 代码如下: strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Desktop

网络连接状态建立于断开的VBS脚本_vbs

断开连接提示 复制代码 代码如下: strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi") Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ ("Select * from MSNdis_StatusMediaDiscon

从XML文件中获取信息的vbs代码_vbs

复制代码 代码如下: '***************************************************************** '** Script: getxmlelement.vbs '** Version: 1.0 '** Created: 1/8/2009 10:58PM '** Author: Adriaan Westra '** E-mail: '** Purpose / Comments: '** Get an element from a xml fi

域内计算机和用户获取实现vbs代码_vbs

显示当前域内所有计算机名称及数目 复制代码 代码如下: Const ADS_SCOPE_SUBTREE = 2 Set objRootDSE = GetObject("LDAP://rootDSE") strDomain = ObjRootDSE.Get("defaultNamingContext") Set objConnection = CreateObject("ADODB.Connection") Set objCommand = Cre

获取远程机器共享目录的物理路径的代码_vbs

第一:依靠135端口,用wmi.像下边的脚本是得到共享目录ttt的物理目录. 复制代码 代码如下: strPath ="\\192.168.1.55\ttt" strPath = Replace(strPath, "\\", "") arrPath = Split(strPath, "\") strComputer = arrPath(0) strShare = arrPath(1) Set objSWbemLocator =

Hardware_Info.vbs 获取硬件信息的VBS代码_vbs

复制代码 代码如下: 'Hardware_Info.vbs v1.1 BY: fastslzOn Error Resume NextDim WMI,WS,FsoSet WMI = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")Set cOSs = WMI.ExecQuery("Select * from Win32_OperatingSystem")For Each oOS

thernet-android中如何获取获取以太网连接状态

问题描述 android中如何获取获取以太网连接状态 有什么方法可以获取当前以太网是否连接的状态,已知现在EthernetManager类无法在应用层直接调用,那么有没有其他方法可以获取以太网是否连接的状态 解决方案 // 当网络变化的时候系统会发出一个广播 Broadcast,只要在程序中注册一个广播接收器 BroadcastReceiver,并在 IntentFilter 中添加相应的过滤,这样一旦网络有变化,程序就能监听到public static final String CONNECT

java 断开从连接池中获取的连接,规范的操作是怎样的

问题描述 java断开从连接池中获取的连接,规范的操作是怎样的,ResultSet,PreparedStatement,Connection是否需要依次关闭,若需要,应该怎么做才是高效率,规范,而且不会发生内存泄露.涉及到很多try和catch,不知怎么处理. 解决方案 解决方案二:ResultSet,PreparedStatement,Connection是否需要依次关闭需要应该怎么做才是高效率写一个函数用来关闭,如放在的帮助类JdbcUtil里,如publicstaticvoidreleas

数据库连接-JDBC如何获取当前连接的ID

问题描述 JDBC如何获取当前连接的ID 通过jdbc连接db2,想在程序中获取当前数据库连接在数据库服务器中的标示信息.如图请大神指点!!! 解决方案 可否换个思路来解决问题,你要这个id的用途是做什么? 解决方案二: 可否换个思路来解决问题,你要这个id的用途是做什么?