-
Jan 4th, 2010, 07:32 PM
#1
Thread Starter
New Member
Passing Arguments
Hi there
I need help passing extra arguments to one of the function in my script. The code below is one of the functionality of the script and it creates Log Folder
Code:
function CreateNewLogSubDir(){
var strSubdirName='';
strSubdirName=WScript.Arguments.Named.Item('New');
if('string'!=typeof(strSubdirName)||0==strSubdirName.length){
var strDate = new Date();
var iMonth =Number(strDate.getMonth()+1);
var sMonthPrefix = '';
if(Number(iMonth)<10){sMonthPrefix='0';}
strSubdirName=strDate.getFullYear()+'-';
strSubdirName+=sMonthPrefix+iMonth
+'-'
+(strDate.getDate() < 10 ? '0':'')
+(strDate.getDate());
I need to pass 4 arguments to the above script. These arguments are values to input to the name of the newly created log folder and these are the information passed from SourceSafe Change Mgt Sys
Arguments to pass are : 1) Enter Build
2)Enter Transaction Number
3)Enter Short Log Description
Ex: If i enter Build = 49834 and Transaction = 238113 and Short Description = TestingSample, then the newly created Folder should have the following name i.e.
2009-02-23-B-49834-T-238113-TestingSample
Is it possible to do this?. Please guide me
regards
-
Jan 5th, 2010, 07:15 PM
#2
Hyperactive Member
Re: Passing Arguments
your function with arguments Code:
function CreateNewLogSubDir(pBuild,pTransNumber,pDescription){
var strSubdirName='';
strSubdirName=WScript.Arguments.Named.Item('New');
if('string'!=typeof(strSubdirName)||0==strSubdirName.length){
var strDate = new Date();
var iMonth =Number(strDate.getMonth()+1);
var sMonthPrefix = '';
if(Number(iMonth)<10){sMonthPrefix='0';}
strSubdirName=strDate.getFullYear()+'-';
strSubdirName+=sMonthPrefix+iMonth
+'-'
+(strDate.getDate() < 10 ? '0':'')
+(strDate.getDate());
+'-B-' + pBuild + '-T-' + pTransNumber + '-' + pDescription
Truly, you have a dizzying intellect.
-
Jan 7th, 2010, 06:24 AM
#3
Thread Starter
New Member
Re: Passing Arguments
Hi gtilles
i now seem to have the following issue
Code:
function CreateNewLogSubDir(pBuildID,pLogID,pDescription)
{ var strSubdirName='';
strSubdirName=WScript.Arguments.Named.Item'New');
if('string'!=typeof(strSubdirName)||0==strSubdirName.length)
{ var strDate = new Date();
var iMonth =Number(strDate.getMonth()+1);
var sMonthPrefix = '';
if(Number(iMonth)<10)sMonthPrefix='0';}
strSubdirName=strDate.getFullYear()+'-';
strSubdirName+=sMonthPrefix+iMonth +'-'+
(strDate.getDate() < 10 ? '0':'')+(strDate.getDate());
strSubdirName+='-B-' + pBuildID + '-L-' + pLogID+ '-' + pDescription;
The problem is this creates a log folder as follows
2010-01-05-B-undefined-L-undefined-undefined
The script doesn't prompt or ask me for entering B which is Build ID
or L which is LogID or does it ask for entering the issue
description
When i run that file, all i have is
2010-01-05-B-undefined-L-undefined-undefined
While actually the script should be asking me Build ID and then
passing whatever argument i'm passing onto Name of the Log Folder
For Ex: I run the script and then the script should ask enter the
value of B, i then enter B= 105475
and then script should ask to enter the value of L, i then enter L=
165487
and then the script should ask to enter a short description and then
i
should enter testlog
and then the script should create a new log folder as follows:
2010-01-05-B-105475-L-165487-testlog
Please help
-
Jan 7th, 2010, 02:08 PM
#4
Hyperactive Member
Re: Passing Arguments
If your asp script requires user input you will have to have a form and a submit button.
Here is some partial code
if your using vbscript check out this link for using the inputbox
http://wsh2.uw.hu/ch08b.html
Last edited by gtilles; Jan 7th, 2010 at 02:44 PM.
Truly, you have a dizzying intellect.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|