Solved

VBS Modification Needed

Posted on 2013-01-07
5
442 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Macro Excel - Multiple If conditions 2 72
Extract field headers and values between quotes 12 51
VBScript Issues 8 32
Error with a code discussed on this page 5 13
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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