• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Same function runs on one machine, run time error on another

I have two PCs set up at the same time (maybe four years ago), both with Vista-32.  Let's call them PC1 and PC2.  Both run 24/7 remotely, running a suite of VB scripts.  No problems for years.  But I took PC2 off to have it do different tasks for a while.  When done,  copied the suite of VB scripts from PC1 over to PC2 and launched.  PC2 now throws some run time errors that PC1 does not.  For example:

                  If objFile.Size > 50 then

gets an error "Object doesn't support this property or method"

Runs fine on PC1, run time error on PC2.  Might there be some difference in whatever software interprets the VBScripts?  I'm totally unfamiliar with that aspect.
0
Mike Caldwell
Asked:
Mike Caldwell
  • 5
  • 4
1 Solution
 
Kent DyerCommented:
I would go back a re-confirm the scripts with something like WinMerge/Araxis Merge to be sure that you have the dependencies in place.

It does also appear that you need to do some additional checking..

If fso.fileexists(objFile.Path) And objFile.Size > 50 Then

Open in new window

This way, you are assured that you have a file in place to check..

Another thing you could do is put a sleep right before this so that if you are using a function that needs to close first..

Like..
Wscript.Sleep 300
If fso.fileexists(objFile.Path) and objFile.Size > 50 Then

Open in new window


Note: The 300 is milliseconds..

HTH,

Kent
0
 
Mike CaldwellDirector of Business Development, AnaquaAuthor Commented:
I understand the somewhat more robust checking, however I don't understand the need to check the dependencies in that this identical script runs fine on PC1.

I will add in some appropriate Waits, in that one machine might be slighly slower than the other.
0
 
Mike CaldwellDirector of Business Development, AnaquaAuthor Commented:
No difference with additional Waits
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
RobSampsonCommented:
Does the file that objFile is bound to actually exist?  Can you output objFile.Path?
0
 
Mike CaldwellDirector of Business Development, AnaquaAuthor Commented:
Yes; tested with an "if not exist" before this.
0
 
RobSampsonCommented:
For the file in question, can you isolate the operation out to a single test script?  For example, can you just run a separate VBS with this:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\Temp\FileInQuestion.txt")
WScript.Echo objFile.Path
WScript.Echo objFile.Size

Open in new window


Rob.
0
 
Mike CaldwellDirector of Business Development, AnaquaAuthor Commented:
I emphasize that both machines are doing the same processes with the same scripts, operating on the same sort of files.  They process about 10K files per day each, have for four years.  I doubt there is a program issue; too many years of no-problem operation not to have encountered a script problem.  I believe there is something at the OS level, not application, that is different.  Vista processes these VB Scripts, so I'm thinking there is a difference between revs of the script processing software (shell??).  I don't know enough about that to suggest more, but I really doubt a script error per se.
0
 
RobSampsonCommented:
Is the second machine Vista as well?

On the first, open a command prompt, and type
cscript /?

On the second, do the same.

The first line of the output should be something like
Microsoft (R) Windows Script Host Version 5.8

Is it the same on both machines?

In any case, re-download the version on the failing machine, and re-install it.

Regards,

Rob.
0
 
Mike CaldwellDirector of Business Development, AnaquaAuthor Commented:
Both are the same (5.7).

What exactly should I down load, where would I get it, and how would I install it?
0
 
RobSampsonCommented:
I think for Vista you can reregister the components by using this:
http://www.brighthub.com/computing/windows-platform/articles/126218.aspx

Rob.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now