Avatar of elwayisgod
elwayisgodFlag for United States of America

asked on 

VBS Modification Needed

OK.  When I launch the 'splice_years.vbs' form the command prompt in the 'scripts' direcotry, I get the below error.  I had to copy the 'actfisc.txt' file into the 'scripts' directory from the 'data' directory.  It processed the 'actfisc.txt' file ok, but when it tried the next file it errored out.  Why can't it look in the 'data' directory for the data files and process them there while the script remains in the 'script' directory?


D:\AppFiles\SDS\SDS_Retail_R3\Scripts>cscript splice_years.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

start - 1/7/2013 11:25:52 AM
file actfisc.txt - 1/7/2013 11:25:52 AM
D:\AppFiles\SDS\SDS_Retail_R3\Scripts\splice_years.vbs(26, 2) Microsoft VBScript
 runtime error: File not found


D:\AppFiles\SDS\SDS_Retail_R3\Scripts>cscript splice_years.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

start - 1/7/2013 11:26:31 AM
file actfisc.txt - 1/7/2013 11:26:31 AM
file actppln.txt - 1/7/2013 11:26:55 AM
D:\AppFiles\SDS\SDS_Retail_R3\Scripts\splice_years.vbs(26, 2) Microsoft VBScript
 runtime error: File not found
splice-years.vbs
VB ScriptVisual Basic ClassicWindows Batch

Avatar of undefined
Last Comment
elwayisgod
Avatar of sirbounty
sirbounty
Flag of United States of America image

Because C_DATA_DIR is pointing to the current directory (scripts).
Change that line back and it should work:
Const C_DATA_DIR = "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

Open in new window

Avatar of elwayisgod
elwayisgod
Flag of United States of America image

ASKER

My first two lines of the 'splice_years.vbs' is:

Option Explicit

Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"
Avatar of elwayisgod
elwayisgod
Flag of United States of America image

ASKER

OK. I'm an idiot as I forgot about trigger file.  So it's executing now.  However it's still requiring my data files to be in the 'scripts' directory not the 'data' directory.  The second line of the 'splice_years.vbs' is:  Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

thus very confused here.....
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of elwayisgod
elwayisgod
Flag of United States of America image

ASKER

Thanks.  Missed that.  Works great.
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo