Post by Roland Hall: Maybe something like...
: On Error Resume Next
: Set go_log_chan = go_fso.OpenTextFile( gs_log_spec, ci_for_appending,
: True )
: Select Case Err.Number
: Case 0
: Case 70
: Call s_error( cs_fac & "Failed to open log file `" & gs_log_spec & "`
: for appending, another instance of this script is probably already
: running..." )
: Case Else
: Call s_error( cs_fac & "Failed to open log file `" & gs_log_spec & "`
: for appending..." )
: End Select
: On Error Goto 0
I'm wondering why you chose Error number 70, which is permission denied.
This will tell you the possibilities of errors for vbscript but I couldn't
find a 'File in use' explicitly. They don't seem to run past 32812. I
tested it out to a million.
On Error Resume Next
dim errnum, i
for i = 0 to 32812
errnum = i
Err.Raise errnum, "SomeObject"
if Err.Description <> "Unknown runtime error" and Err.Description <>
"Invalid procedure call or argument" then
wscript.echo "Error # " & CStr(Err.Number) & " " & Err.Description & "
"' & Err.Source
end if
Err.Clear ' Clear the error.
next
Error # 6 Overflow
Error # 7 Out of memory
Error # 9 Subscript out of range
Error # 10 This array is fixed or temporarily locked
Error # 11 Division by zero
Error # 13 Type mismatch
Error # 14 Out of string space
Error # 17 Can't perform requested operation
Error # 28 Out of stack space
Error # 35 Sub or Function not defined
Error # 48 Error in loading DLL
Error # 51 Internal error
Error # 52 Bad file name or number
Error # 53 File not found
Error # 54 Bad file mode
Error # 55 File already open
Error # 57 Device I/O error
Error # 58 File already exists
Error # 61 Disk full
Error # 62 Input past end of file
Error # 67 Too many files
Error # 68 Device unavailable
Error # 70 Permission denied
Error # 71 Disk not ready
Error # 74 Can't rename with different drive
Error # 75 Path/File access error
Error # 76 Path not found
Error # 91 Object variable not set
Error # 92 For loop not initialized
Error # 94 Invalid use of Null
Error # 322 Can't create necessary temporary file
Error # 424 Object required
Error # 429 ActiveX component can't create object
Error # 430 Class doesn't support Automation
Error # 432 File name or class name not found during Automation operation
Error # 438 Object doesn't support this property or method
Error # 440 Automation error
Error # 445 Object doesn't support this action
Error # 446 Object doesn't support named arguments
Error # 447 Object doesn't support current locale setting
Error # 448 Named argument not found
Error # 449 Argument not optional
Error # 450 Wrong number of arguments or invalid property assignment
Error # 451 Object not a collection
Error # 453 Specified DLL function not found
Error # 455 Code resource lock error
Error # 457 This key is already associated with an element of this
collection
Error # 458 Variable uses an Automation type not supported in VBScript
Error # 462 The remote server machine does not exist or is unavailable
Error # 481 Invalid picture
Error # 500 Variable is undefined
Error # 501 Illegal assignment
Error # 502 Object not safe for scripting
Error # 503 Object not safe for initializing
Error # 504 Object not safe for creating
Error # 505 Invalid or unqualified reference
Error # 506 Class not defined
Error # 507 An exception occurred
Error # 1001 Out of memory
Error # 1002 Syntax error
Error # 1003 Expected ':'
Error # 1005 Expected '('
Error # 1006 Expected ')'
Error # 1007 Expected ']'
Error # 1010 Expected identifier
Error # 1011 Expected '='
Error # 1012 Expected 'If'
Error # 1013 Expected 'To'
Error # 1014 Expected 'End'
Error # 1015 Expected 'Function'
Error # 1016 Expected 'Sub'
Error # 1017 Expected 'Then'
Error # 1018 Expected 'Wend'
Error # 1019 Expected 'Loop'
Error # 1020 Expected 'Next'
Error # 1021 Expected 'Case'
Error # 1022 Expected 'Select'
Error # 1023 Expected expression
Error # 1024 Expected statement
Error # 1025 Expected end of statement
Error # 1026 Expected integer constant
Error # 1027 Expected 'While' or 'Until'
Error # 1028 Expected 'While', 'Until' or end of statement
Error # 1029 Expected 'With'
Error # 1030 Identifier too long
Error # 1031 Invalid number
Error # 1032 Invalid character
Error # 1033 Unterminated string constant
Error # 1034 Unterminated comment
Error # 1037 Invalid use of 'Me' keyword
Error # 1038 'loop' without 'do'
Error # 1039 Invalid 'exit' statement
Error # 1040 Invalid 'for' loop control variable
Error # 1041 Name redefined
Error # 1042 Must be first statement on the line
Error # 1043 Cannot assign to non-ByVal argument
Error # 1044 Cannot use parentheses when calling a Sub
Error # 1045 Expected literal constant
Error # 1046 Expected 'In'
Error # 1047 Expected 'Class'
Error # 1048 Must be defined inside a Class
Error # 1049 Expected Let or Set or Get in property declaration
Error # 1050 Expected 'Property'
Error # 1051 Number of arguments must be consistent across properties
specification
Error # 1052 Cannot have multiple default property/method in a Class
Error # 1053 Class initialize or terminate do not have arguments
Error # 1054 Property set or let must have at least one argument
Error # 1055 Unexpected 'Next'
Error # 1056 'Default' can be specified only on 'Property' or 'Function' or
'Sub'
Error # 1057 'Default' specification must also specify 'Public'
Error # 1058 'Default' specification can only be on Property Get
Error # 4096 Microsoft VBScript compilation error
Error # 4097 Microsoft VBScript runtime error
Error # 5016 Regular Expression object expected
Error # 5017 Syntax error in regular expression
Error # 5018 Unexpected quantifier
Error # 5019 Expected ']' in regular expression
Error # 5020 Expected ')' in regular expression
Error # 5021 Invalid range in character set
Error # 30000 EN
Error # 32766 True
Error # 32767 False
Error # 32768 OK
Error # 32769 Cancel
Error # 32770 Help
Error # 32811 Element not found
Error # 32812 The specified date is not available in the current locale's
calendar
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
use and denies other apps access to it while it's open. I picked this up
don't have a link for that). I've used it (and suggested it here on this NG
open file. (Some apps completely bar access to a file in use, others let
settings).