J!NX Forums
J!NX Forums
Home | Forum Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
This username differs from J!NX login...
Save Password
Forgot your Password?

 All Forums
 TechSpeak
 Newbies Here
 CMD - Choice Function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Toothpaste
Omega Member

United Kingdom
241 Posts

Posted - 05/07/2005 :  12:45:28 PM  Show Profile  Click to see Toothpaste's MSN Messenger address  Reply with Quote
I don't have the Choice function in CMD. -.- I searched Google for some answers and for a site where I could download the choice add on, but I found squat.

Can anybody tell me why I don't have it and where I might be able to get it from, please? Thanks in advance.

_________________________
The funny thing about this signiture is that once you have finished reading it, you realise what a waste of time it has been. Actually, now that I think about it.. Nah, it's not that funny. :s

Ozzy_98
Advanced Member

Toot toot!
7715 Posts

Posted - 05/07/2005 :  2:26:12 PM  Show Profile  Visit Ozzy_98's Homepage  Send Ozzy_98 a Yahoo! Message  Reply with Quote
It's been gone for a while now. Try this code:

@Echo off
Goto Main

:Choice
  If "%~1"=="" goto :EOF
  Set Choice.InnerCounter=0
  :Choice.InnerLoop
    Set /a Choice.InnerCounter += 1
    Echo %Choice.InnerCounter%. %~1
    shift
    If not "%~1"=="" goto Choice.InnerLoop
    
   :Choice.AnswerLoop
    Set /p Choice.Answer=Please Select A Choice: 
    If %Choice.Answer% LSS 1 (
      Echo Choice must be greater then 0
      Goto Choice.AnswerLoop
      )
    If %Choice.Answer% GTR %Choice.InnerCounter% (
      Echo Choice must be less then %Choice.InnerCounter%
      Goto Choice.AnswerLoop
      )
  Goto :EOF


:Main
  cls
  Call :Choice "Choice One" "Choice Two"
  If "%Choice.Answer%"=="1" Echo You Picked Choice Number 1!!!



If you did any programming, just think of choice as a procedure. To use it, you do Call :Choice <list of choices> and it sets %Choice.Answer% to whatever they answered. Just make sure you have somethign set up like that, where it goes to main, so it doesn't run the code once.

---------------------------------------
What do you mean, I hurt your feelings? I didn’t know you had any feelings.
What do you mean, I ain’t kind? I’m just not your kind.
Go to Top of Page

Toothpaste
Omega Member

United Kingdom
241 Posts

Posted - 05/07/2005 :  2:37:14 PM  Show Profile  Click to see Toothpaste's MSN Messenger address  Reply with Quote
This'll be really useful, thanks a bunch. ^^

_________________________
The funny thing about this signiture is that once you have finished reading it, you realise what a waste of time it has been. Actually, now that I think about it.. Nah, it's not that funny. :s
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
J!NX Forums © J!NX and Snitz Go To Top Of Page
Snitz Forums 2000