Login | |
|
 |
RE: Sending E-Mails - 3/26/2007 12:58:06 AM
|
|
 |
|
| |
ginolard
Posts: 1044
Score: 21
Joined: 8/10/2005
Status: offline
|
Well that won't work because File.Size is an integer and you are asking it if it equals the string "1 bytes" To perform any sort of error checking you need On Error Resume Next (this essentially tells the script to continue running if it encounters an error). As mentioned in the other thread you "wrap" the potentially problem code in On Error Resume Next and On Error Goto 0 (this turns off On Error Resume Next). To use the example from the other thread.... On Error Resume Next Set oTS = oFS.OpenTextFile("c:\temp\test.txt" ) nErrNumber = Err.Number ' Copy the Err info (cleared by OEG0) to sErrDescription = Err.Description ' two simple variables On Error Goto 0 If nErrNumber <> 0 Then wscript.echo sErrDescription end if
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: Sending E-Mails - 3/26/2007 1:53:41 AM
|
|
 |
|
| |
ginolard
Posts: 1044
Score: 21
Joined: 8/10/2005
Status: offline
|
What do you want to do exactly? As it stands your code 1) Checks if the file exists 2) Opens it 3) Sees if there was an error Even if it were 0 bytes long, it would still open it so there will never be an error Now, if you wanted to check the filesize you need to use the GetFile method of FSO and check the Size property
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: Sending E-Mails - 3/26/2007 2:43:04 AM
|
|
 |
|
| |
dm_4ever
Posts: 2593
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Like ginolard said, this: If f.Size >= "1 Bytes" Then is trying to compare a number with a string so it should actually be more like this: If f.Size >= 1 Then
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|