Advertisement
3_2004-2005 Files #145624

TAPI

The code helps to Dial a phone number if a Voice modem is attached to the system. It waits for incomming calls and displays status of the calls. It uses TAPI API calls to intialize and open line and monitors the line for any event to take place. All the events like phone ringing, incomming call etc. are reported to the user

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Upload
Option Explicit
Dim fso
Dim folder
Dim logfile
Dim logLine
Dim newfile
Dim deletefile
Dim filecontents
Dim finalcontents
Dim objArgs
Dim filename
Dim folderpath
Dim searchstr
Dim replacestr
Dim CompareMethod
Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
If objArgs.count >= 3 and objArgs.count <=4 then
	filename 	= objArgs(0)
	searchstr 	= objArgs(1)
	replacestr 	= objArgs(2)
	If objArgs.count = 4 then
		CompareMethod = objArgs(3)
		If CompareMethod <> 0 and CompareMethod <> 1 Then
			Wscript.Echo "CompareMethod can only be 0 or 1"
			Wscript.Quit(1)		'To indicate error.
		End If
	Else
		CompareMethod = 0	' Default to vbBinaryCompare.
	End If		
Else
	wscript.echo "Usage: FindReplace.vbs [arguments..]" + vbcrlf + vbcrlf + "Arguments:" + vbcrlf + "File to be Searched" 		+ vbcrlf + "Searched string" + vbcrlf + "String to replace" + vbcrlf + "[Comparison Method]"
	 wscript.Quit (1)	'To indicate error.
End if                         

TextSearch(Filename)
 
Function TextSearch(Filename)
	Set logfile = fso.OpenTextFile(filename)
	If Err.Number <> 0 Then
		Wscript.echo Err.Description
		Wscript.Quit (Err.Number)
	End If

	filecontents = logfile.readall
	If CompareMethod = 0 Then
	 	finalcontents = Replace(filecontents, searchstr, replacestr, 1, -1, vbBinaryCompare) 
	Else
		finalcontents = Replace(filecontents, searchstr, replacestr, 1, -1, vbTextCompare) 
	End If
	logfile.Close
	Set deletefile = fso.getFile(filename)
	deletefile.delete  
	set newfile = fso.CreateTextFile(filename, true)
	newfile.write FinalContents
	newfile.close
	If Err.Number <> 0 Then
		Wscript.echo Err.Description
		Wscript.Quit (Err.Number)
	End If
	
	set logfile = nothing
	set deletefile	= nothing
	set newfile = nothing
End Function
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine