B
benazir
Hi,
In Windows scripting we can pause the code during running.
For Example: We can use the following piece of code in windows
scripting, which can pause the code during running:
Wscript.sleep 15000
Like in Windows Scripting, How should we pause the code during running
in VB Scripting.
Following code I am using in order to perform some operation via
Excel.
Could someone please inform me what piece of code I add in order to
pause the code for 10 seconds in VBS scripting?
Your suggestion will be appreciated.
Regards
Benazir
Code
Sub ArchivelogChk
'This module checks you are in archivelog mode, and aborts the entire
thing
'if not. No point in trying to perform a hot backup unless you are.
strFileOut="archive.sql"
strBp="set trimspool on" & chr(10) & "set heading off" & chr(10)
&"set feedback off" & chr(10) & "set echo off" & chr(10) & "spool
arcchk.txt"
set objFS=CreateObject("Scripting.FileSystemObject")
set objOutFile=objFS.OpenTextFile(strFileOut,2,1)
strOutput=strBp & chr(10) & "select log_mode from v$database;" &
chr(10) & "spool off" & chr(10) & "exit"
objOutFile.WriteLine strOutput
Set WshShell=CreateObject("WScript.Shell")
WshShell.Run "sqlplus system/manager @archive.sql"
strArchive="arcchk.txt"
set objArchive=objFS.OpenTextFile(strArchive,1,0)
While Not objArchive.AtEndOfStream
strInput=objArchive.ReadLine
if strInput="" then
else
If strInput="NOARCHIVELOG" Then
title = "Fatal Error!"
possible! Aborting!"
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
set objFS=CreateObject("Scripting.FileSystemObject")
objFS.DeleteFile "arcchk.txt"
objFS.DeleteFile "archive.sql"
End If
End If
wend
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
End Sub
In Windows scripting we can pause the code during running.
For Example: We can use the following piece of code in windows
scripting, which can pause the code during running:
Wscript.sleep 15000
Like in Windows Scripting, How should we pause the code during running
in VB Scripting.
Following code I am using in order to perform some operation via
Excel.
Could someone please inform me what piece of code I add in order to
pause the code for 10 seconds in VBS scripting?
Your suggestion will be appreciated.
Regards
Benazir
Code
Sub ArchivelogChk
'This module checks you are in archivelog mode, and aborts the entire
thing
'if not. No point in trying to perform a hot backup unless you are.
strFileOut="archive.sql"
strBp="set trimspool on" & chr(10) & "set heading off" & chr(10)
&"set feedback off" & chr(10) & "set echo off" & chr(10) & "spool
arcchk.txt"
set objFS=CreateObject("Scripting.FileSystemObject")
set objOutFile=objFS.OpenTextFile(strFileOut,2,1)
strOutput=strBp & chr(10) & "select log_mode from v$database;" &
chr(10) & "spool off" & chr(10) & "exit"
objOutFile.WriteLine strOutput
Set WshShell=CreateObject("WScript.Shell")
WshShell.Run "sqlplus system/manager @archive.sql"
strArchive="arcchk.txt"
set objArchive=objFS.OpenTextFile(strArchive,1,0)
While Not objArchive.AtEndOfStream
strInput=objArchive.ReadLine
if strInput="" then
else
If strInput="NOARCHIVELOG" Then
title = "Fatal Error!"
possible! Aborting!"
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
set objFS=CreateObject("Scripting.FileSystemObject")
objFS.DeleteFile "arcchk.txt"
objFS.DeleteFile "archive.sql"
End If
End If
wend
set objFile=Nothing
set objOutFile=Nothing
set objArchive=Nothing
End Sub