Solved

VBS Modification Needed

Posted on 2013-01-07
5
439 Views
Last Modified: 2013-01-07
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
0
Comment
Question by:elwayisgod
  • 3
  • 2
5 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 38752381
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

0
 

Author Comment

by:elwayisgod
ID: 38752405
My first two lines of the 'splice_years.vbs' is:

Option Explicit

Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"
0
 

Author Comment

by:elwayisgod
ID: 38752813
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.....
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 38752857
Right, but you have the data folder commented out...

Change it to read
Const C_DATA_DIR = "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

Open in new window


What you have above simple sets it to ".\" which means 'present directory'
0
 

Author Closing Comment

by:elwayisgod
ID: 38752894
Thanks.  Missed that.  Works great.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now