Passing Arguments

C

capt edgar

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

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


Is there some sort of Prompt function to call within the Script which
can help achieve the above? Please help
 
D

David Mark


Ahoy, cap'n.
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

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

Is there some sort of Prompt function to call within the Script which
can help achieve the above? Please help

Yes. It's called prompt.

https://developer.mozilla.org/En/DOM/Window.prompt
 
T

Thomas 'PointedEars' Lahn

Tim said:
[David Mark wrote:]
[Tim Down wrote:]
Is there some sort of Prompt function to call within the Script which
can help achieve the above? Please help

Yes. It's called prompt.

https://developer.mozilla.org/En/DOM/Window.prompt

Sadly window.prompt fails in IE 7 (and 8, I imagine, though I haven't
tried it) in the default Internet security zone with default user
settings, meaning it's unusable on the web now.

That is very unlikely.

Please keep the attribution lines.


PointedEars
 
D

David Mark

Sadly window.prompt fails in IE 7 (and 8, I imagine, though I haven't
tried it) in the default Internet security zone with default user
settings, meaning it's unusable on the web now.

You are incorrect, though it has never been particularly usable on the
Web as it is often accompanied by warning signs. It is better to use
a DIV with a text INPUT and a couple of buttons, falling back to
window.prompt if the required DOM features are unavailable.

http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1DontWork
 
D

David Mark

Tim said:
[David Mark wrote:]
[Tim Down wrote:]
Is there some sort of Prompt function to call within the Script which
can help achieve the above? Please help
Yes.  It's called prompt.
https://developer.mozilla.org/En/DOM/Window.prompt
Sadly window.prompt fails in IE 7 (and 8, I imagine, though I haven't
tried it) in the default Internet security zone with default user
settings, meaning it's unusable on the web now.

That is very unlikely.

Please keep the attribution lines.

It's more than unlikely. ;)
 
T

Thomas 'PointedEars' Lahn

David said:
It's more than unlikely. ;)

What really happens is what I have tested now in IE 8 on Vista: In "Windows
Internet Explorer 7 and later. By default, this method is blocked by the
information bar in the Internet zone."

<http://msdn.microsoft.com/en-us/library/ms536673(VS.85).aspx>

Which means that the call does not simply fail but that it causes this
information bar to be displayed, with which the user temporarily can allow
display of the prompt dialog (in case the method is called again).

However, as you have pointed out correctly, an HTML form should be
preferred.


PointedEars
 
D

David Mark

What really happens is what I have tested now in IE 8 on Vista: In "Windows
Internet Explorer 7 and later. By default, this method is blocked by the
information bar in the Internet zone."

<http://msdn.microsoft.com/en-us/library/ms536673(VS.85).aspx>

Which means that the call does not simply fail but that it causes this
information bar to be displayed, with which the user temporarily can allow
display of the prompt dialog (in case the method is called again).

However, as you have pointed out correctly, an HTML form should be
preferred.

I'm sure "form" is a slip of the keyboard (a FIELDSET is a more
suitable candidate to contain the INPUT's). :)
 
T

Tim Down

You are incorrect, though it has never been particularly usable on the
Web as it is often accompanied by warning signs.  It is better to use
a DIV with a text INPUT and a couple of buttons, falling back to
window.prompt if the required DOM features are unavailable.

http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1DontWork

Fair enough. Lazy wording, I couldn't remember the precise nature of
how window.prompt changed in IE 7 and I didn't have time to try it
out. Sorry.

Tim
 
D

David Mark

Fair enough. Lazy wording, I couldn't remember the precise nature of
how window.prompt changed in IE 7 and I didn't have time to try it
out. Sorry.

No big deal. Just needed to clear up any confusion it might have
created (and remind everyone to explain failures).
 
T

Thomas 'PointedEars' Lahn

David said:
Thomas said:
[window.prompt()]
What really happens is what I have tested now in IE 8 on Vista: In
"Windows Internet Explorer 7 and later. By default, this method is
blocked by the information bar in the Internet zone."

<http://msdn.microsoft.com/en-us/library/ms536673(VS.85).aspx>

Which means that the call does not simply fail but that it causes this
information bar to be displayed, with which the user temporarily can
allow display of the prompt dialog (in case the method is called again).

However, as you have pointed out correctly, an HTML form should be
preferred.

I'm sure "form" is a slip of the keyboard (a FIELDSET is a more
suitable candidate to contain the INPUT's). :)

FIELDSET is an HTML form control, so no slip of the keyboard in any case.
However, a FORM element (containing a FIELDSET element, if necessary) is
indicated if this should work without client-side scripting, too.


PointedEars
 
D

David Mark

David said:
Thomas said:
[window.prompt()]
What really happens is what I have tested now in IE 8 on Vista: In
"Windows Internet Explorer 7 and later. By default, this method is
blocked by the information bar in the Internet zone."
<http://msdn.microsoft.com/en-us/library/ms536673(VS.85).aspx>
Which means that the call does not simply fail but that it causes this
information bar to be displayed, with which the user temporarily can
allow display of the prompt dialog (in case the method is called again).
However, as you have pointed out correctly, an HTML form should be
preferred.
I'm sure "form" is a slip of the keyboard (a FIELDSET is a more
suitable candidate to contain the INPUT's).  :)

FIELDSET is an HTML form control, so no slip of the keyboard in any case.

But it is perfectly valid without a FORM, of course. I can't imagine
I would use a FORM for a faux confirm.
However, a FORM element (containing a FIELDSET element, if necessary) is
indicated if this should work without client-side scripting, too.

A confirm action without client side scripting? Perhaps you mean
navigating to another page with a form, but that's getting off the
topic I think.
 
T

Thomas 'PointedEars' Lahn

David said:
But it is perfectly valid without a FORM, of course.

Perfectly Valid, but not perfectly accessible.
I can't imagine I would use a FORM for a faux confirm.


A confirm action without client side scripting?

This is about an alternative to window.prompt(), not window.confirm().
But yes, window.confirm() can be replaced with a form, too; that fixes the
OK/Cancel dilemma.
Perhaps you mean navigating to another page with a form,

Yes, as a fallback.
but that's getting off the topic I think.

I don't think so. We know virtually nothing of the circumstances of the
OP, and it doesn't hurt to speculate a bit about a general good solution.


PointedEars
 
D

David Mark

Perfectly Valid, but not perfectly accessible.



This is about an alternative to window.prompt(), not window.confirm().
But yes, window.confirm() can be replaced with a form, too; that fixes the
OK/Cancel dilemma.

Slip of the keyboard/brain. :)
Yes, as a fallback.

That makes sense (for some contexts).
I don't think so.  We know virtually nothing of the circumstances of the
OP, and it doesn't hurt to speculate a bit about a general good solution.

Fair enough.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top