Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 10-02-2008, 10:36 AM   #1 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 4
OS: WINDOWS VISTA


Cry vbscript-- parameters help!! PLEASE?????

Can anyone help me create the following script?? I am new to VBScripting and need help. Need this for an assignment, can someone please help??


1. Your script must contains an opening comment that includes your name.
2. The script should have an associated configuration file that will terminate the script after 30 seconds.
3. This little script should display the message “I Require Parameters” if it is started without any command line parameters.
4. If there are parameters, generate the following message:

Greetings, human. I found ? command line parameters.
bforns is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 10-02-2008, 01:41 PM   #2 (permalink)
Manager
 
shuuhen's Avatar
 
Join Date: Sep 2004
Location: Colorado
Posts: 986
OS: Mac OS 9.1, Mac OS X 10.5.8, WinXP Pro, FreeBSD 6.0, Gentoo Linux

My System

Re: vbscript-- parameters help!! PLEASE?????

We don't do homework - see the rules. If you have specific problems/questions related to that program someone might be able to answer them. We also generally like to see the source code, since it's hard to figure out a problem without seeing the source code.
__________________


Has it been a few days since I replied to your thread? Don't panic! I'm a busy college student and may forget a post if I'm extra busy (or it might just take me a while to be able to do a decent reply). If you still need help and are awaiting my reply after a few days, PM me about it.

When posting what errors you get, please give the full message. It makes helping you much easier.

Last edited by shuuhen; 10-02-2008 at 01:42 PM.
shuuhen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-02-2008, 04:04 PM   #3 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros


Re: vbscript-- parameters help!! PLEASE?????

Hey, as shuuhen says we don't give direct h/w etc.

You can find the VBScript User guide(from MSDN) here:
http://msdn.microsoft.com/en-us/libr...7y(VS.85).aspx

The fundementals section would help you through this assignment. If you have code you need help with then post it and we can help =](take a good stab at it first)

Cheers,
Jamey
__________________

Myspace

Last edited by jamiemac2005; 10-02-2008 at 04:05 PM.
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-03-2008, 10:55 AM   #4 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 4
OS: WINDOWS VISTA


Re: vbscript-- parameters help!! PLEASE?????

This is what i have come up with so far...

> 'Brian Fournier Assignment 1
> Dim WshShl
> Set WshShl = WScript.CreateObject("WScript.Shell")
> WshShl.Popup "I require Parameters"
>
> I don't know how to create a message that allows the user to
> create parameters?
> Can you possibly help?
>
>
> The original assignment again was
>
> 1. Your script must contains an opening comment that includes
> your name.
> 2. The script should have an associated configuration file
> that will
> terminate the script after 30 seconds.
> 3. This little script should display the message “I Require
> Parameters” if it
> is started without any command line parameters.
> 4. If there are parameters, generate the following message:
> Greetings, human. I found ? command line parameters.
bforns is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-03-2008, 12:12 PM   #5 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros


Re: vbscript-- parameters help!! PLEASE?????

Hey, by parameters it means command-line parameters... here's an article on using them in VBScript: http://www.devguru.com/Technologies/...Arguments.html

I think the idea of your origional assignment is if the count attribute of the Arguments collection(explained in the article above) is 0 then output the first message else output the second...

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-04-2008, 05:26 PM   #6 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 4
OS: WINDOWS VISTA


Red Faced Re: vbscript-- parameters help!! PLEASE?????

'Brian Fournier --User command line parameters

Set objArgs = WScript.Arguments
WScript.Echo WScript.Arguments.Count
For Each strArg in objArgs
WScript.Echo strArg
if args.length= 0 then
wscript.echo("I Require Parameters")
else
Wscript.echo("Greetings, human. I found " objArgs " command line parameters.")
end if
end if


here is what i have so far and i cannot get the code to execute properly can anyone help.. please??? Thank you...
This is for the 1st comment listed
bforns is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-04-2008, 08:51 PM   #7 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros


Re: vbscript-- parameters help!! PLEASE?????

Hey, i cleaned up your code =] it now works, run it from a command prompt with arguments and it works fine...

Code:
'Brian Fournier --User command line parameters

Set objArgs = WScript.Arguments
WScript.Echo objArgs.Count
For Each strArg in objArgs
WScript.Echo strArg
next
if objArgs.length= 0 then
wscript.echo("I Require Parameters")
else
Wscript.echo("Greetings, human. I found " & objArgs.Count & " command line parameters.")
end if
Heres an explanation of the problems:
- line 5: the for statement has to be closed with a "Next" statement to make it only do the commands specified within the code bracket.
- line 7: you used args rather than objArgs(simple wrong name)
- line 10: when inserting a variable into a string you have to contagnate it(add it) with "&"s and i'm pretty sure you ment to write objArgs.Count there so i added it...
- the last line had an extra end if statement that didn't need to be there(so it errored)
Other notes:
- you still had Wscript.arguments laying around after having defined objArgs, the script would still work fine as it was but it's better practice to use objArgs after that...

As it is it was a Very good go at the assignment =], you just need to work on your syntax and you'll be fine.... cleaning it was nice and easy(because the logic was perfect behind it)...

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-05-2008, 09:49 AM   #8 (permalink)
Registered User
 
Join Date: Oct 2008
Posts: 4
OS: WINDOWS VISTA


Grin Re: vbscript-- parameters help!! PLEASE?????

Thank you SOO Much!! I can't express how much help you where to me!!!
bforns is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-05-2008, 09:59 AM   #9 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros


Re: vbscript-- parameters help!! PLEASE?????

haha, that's what i'm here for, glad to be of help. You had the logic behind it perfect =]

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 11:36 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85