' ===============================================
' getSerialNumber functions
' ===============================================
'Option Explicit

'--------Set constants------
MyTitle = "Get Internet Download Manager Volume Serial Number "
'----debug---
'Set DebugFile = fso.CreateTextFile("debug.txt", True)
'Set DebugFileA = fso.CreateTextFile("debugA.txt", True)
'Set DebugFileB = fso.CreateTextFile("debugB.txt", True)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ws
Set ws = CreateObject("WScript.Shell")

Dim PathMyDocuments
Dim PathMySystem
Dim PathDriveDoc
Dim PathDriveSys
Dim answer

PathMyDocuments = ws.SpecialFolders("MyDocuments")
'MsgBox Left(PathMyDocuments, 2), 0+64, MyTitle
Set PathDriveDoc = fso.getdrive(fso.GetDriveName(Left(PathMyDocuments, 2)))

PathMySystem = fso.GetSpecialFolder(0)
Set PathDriveSys = fso.getdrive(fso.GetDriveName(Left(PathMySystem, 2)))

' 
Text = "Documents Volume Serial Number(文档盘符卷序列号): " & VbCrlf _
& Hex(PathDriveDoc.SerialNumber) & " " & vbNewLine _
& "System Volume Serial Number(系统盘符卷序列号): " & VbCrlf _
& Hex(PathDriveSys.SerialNumber) & " " & vbNewLine _
& " Plz Ctrl+V(粘贴您的信息). " & Now & " Powered by B.S. "

' 
SetClipboardText(Text)
' 
answer = MsgBox(Text, vbOKOnly + vbInformation + vbMsgBoxRight + VbMsgBoxSetForeground, MyTitle)


'0 Windows 文件夹，包含 Windows 操作系统安装的文件。
'1 System 文件夹，包含库、字体和设备驱动程序文件。
'2 Temp 文件夹，用于保存临时文件。可以在 TMP 环境变量中找到该文件夹的路径。
' PathMySystem = fso.GetSpecialFolder(0)
' Set PathDriveSys = fso.getdrive(fso.GetDriveName(Left(PathMySystem, 2)))
' MsgBox "System Volume Serial Number(系统盘符卷序列号): " _
' & VbCrlf & Hex(PathDriveSys.SerialNumber) & VbCrlf & VbCrlf & "Plz Ctrl+C. " & Now, 0+64, MyTitle

' ws.AppActivate("")
' ws.SendKeys "Documents Volume Serial Number(文档盘符卷序列号): " _
' & VbCrlf & Hex(PathDriveDoc.SerialNumber) & VbCrlf & VbCrlf _
' & "System Volume Serial Number(系统盘符卷序列号): " _
' & VbCrlf & Hex(PathDriveSys.SerialNumber) 



' ' Ctrl + C Copy data
' ws.SendKeys "^c"

Sub SetClipboardText(Text)   '写入信息到剪切板
    Set wsShell = CreateObject("WScript.Shell")
    wsShell.Run "mshta vbscript:ClipboardData.SetData(""text""," & Chr(34) & Text & Chr(34) & ")(close)", 0, True
End Sub

Function GetClipboardText()   '剪切读取板信息
    Set objHTML=CreateObject("htmlfile") 'xmlfile、mhtmlfile也可以
    GetClipboardText = objHTML.ParentWindow.ClipboardData.GetData("text")
End Function
