Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Why does oScript.LogEvent not like 9

Reply
 
Old 10-03-2008   #1 (permalink)
OldDog


 
 

Why does oScript.LogEvent not like 9

I need some fresh eyes on a problem with creating an Error Log entry.
If I use 1 for my entry it works.

Here is a part of my code;

transfermade = False
Set oScript = Wscript.CreateObject("WSCRIPT.SHELL")
if instr(1,transferstatus,"226 Transfer complete") Then
logf.writeline "Status: Successful"
logf.writeline "Attempts: " & cstr(transferattempts)
transfermade=True
Else
logf.writeline "Status: Failed"
logf.writeline "Attempts: " & cstr(transferattempts)
end If
logf.writeline ""
Loop

if not transfermade Then
logf.writeline "TRANSFER FAILED for " & f1.name
'Wscript.Echo "Send e-mail here - Line 158"
logf.writeline "Sending error message"

If transfermade then
oScript.LogEvent 4, "226 Transfer complete for: " & Cust & vbTab &
ftp_filename
Else
oScript.LogEvent 9, "TRANSFER FAILED for xferftpfiles"
end If

If the FTP transfer fails, I get this error;

Microsoft VBScript runtime error: Invalid procedure call or argument
and it points to this line
oScript.LogEvent 9, "TRANSFER FAILED for xferftpfiles"


My System SpecsSystem Spec
Old 10-03-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Why does oScript.LogEvent not like 9


"OldDog" <mikef2691@xxxxxx> wrote in message
news:07ee8799-d5b7-4feb-ae34-42bdc1f4216d@xxxxxx
Quote:

>I need some fresh eyes on a problem with creating an Error Log entry.
> If I use 1 for my entry it works.
>
> Here is a part of my code;
>
> transfermade = False
> Set oScript = Wscript.CreateObject("WSCRIPT.SHELL")
> if instr(1,transferstatus,"226 Transfer complete") Then
> logf.writeline "Status: Successful"
> logf.writeline "Attempts: " & cstr(transferattempts)
> transfermade=True
> Else
> logf.writeline "Status: Failed"
> logf.writeline "Attempts: " & cstr(transferattempts)
> end If
> logf.writeline ""
> Loop
>
> if not transfermade Then
> logf.writeline "TRANSFER FAILED for " & f1.name
> 'Wscript.Echo "Send e-mail here - Line 158"
> logf.writeline "Sending error message"
>
> If transfermade then
> oScript.LogEvent 4, "226 Transfer complete for: " & Cust & vbTab &
> ftp_filename
> Else
> oScript.LogEvent 9, "TRANSFER FAILED for xferftpfiles"
> end If
>
> If the FTP transfer fails, I get this error;
>
> Microsoft VBScript runtime error: Invalid procedure call or argument
> and it points to this line
> oScript.LogEvent 9, "TRANSFER FAILED for xferftpfiles"
Hard to say. Your code snippet appears to lack a few essential things:
- It has a "loop" statement without a matching "do" statement.
- It has and "if" statement without a matching "end if" statement.
- We don't know what value the variable "transferstatus" has and what type
it is.
- We don't know what you refer to when you say "if I use 1 for my entry".
- We know nothing about the nature of the logf object.


My System SpecsSystem Spec
Reply

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46