How to start an external program in Lisp and Ruby?

How to start an external program in Lisp and Ruby?
I want to know how to run an external program with a Ruby and Lisp program. I know that ruby uses the system() function, but I’m new to Ruby and programming in general and am not quite sure of how to place my arguments, and I just plain don’t know in Lisp. They say Lisp is a great foundation for understanding how computers function and how programming languages are constructed, so I want to learn Lisp as well, but I hear Ruby is great, easy, and versatile, so I’d like to learn that as well.
I have created a ‘game starter’ in Python, which really is just a prompt asking for a raw value of a number, and an if statement with the ’subprocess.Popen()’ function for each item in the list.
It is (copied directly from the .py file):
import subprocess
print “”
print “XXXX’s Program Starter”
print “”
print “1: Spore”
print “2: Rosetta Stone”
print “3: Red Alert 3″
print “4: Mirror’s Edge”
print “5: WarCraft 3″
print “6: I Wanna Be the Guy”
print “7: Geneforge”
print “8: Guitar Hero III”
print “9: Hamachi”
print “10: Steam”
print “11: Emulators”
print “12: Anarchy Online”
print “13: Notepad++”
print “14: Fallout 3″
x = raw_input(”Choose an option: “)
if x == ‘1′:
subprocess.Popen(’explorer “C:\Program Files (x86)\Electronic Arts\SPORE\Sporebin”‘)
if x == ‘2′:
subprocess.Popen(’explorer “C:\Program Files (x86)\Rosetta Stone\Rosetta Stone V3″‘)
if x == ‘3′:
subprocess.Popen(’C:\Program Files (x86)\Electronic Arts\Red Alert 3\RA3.exe -window’)
if x == ‘4′:
subprocess.Popen(”C:\Program Files (x86)\EA Games\Mirror’s Edge\Binaries\MirrorsEdge.exe”)
if x == ‘5′:
subprocess.Popen(’explorer “C:\Program files (x86)\Warcraft III\”‘)
if x == ‘6′:
subprocess.Popen(’C:\Users\Nick\Desktop\I wanna be the guy\iwbtgbeta(fs).exe’)
if x == ‘7′:
subprocess.Popen(’C:\DeusEx\System\DeusEx.exe’)
if x == ‘8′:
subprocess.Popen(’C:\Program Files (x86)\Aspyr\Guitar Hero III\gh3.exe’)
if x == ‘9′:
subprocess.Popen(’C:\Program Files (x86)\Hamachi\hamachi.exe’)
if x == ‘10′:
subprocess.Popen(’C:\Program Files (x86)\Steam\Steam.exe’)
if x == ‘11′:
subprocess.Popen(’explorer “C:\Users\Nick\Desktop\Emulators\”‘)
if x == ‘12′:
subprocess.Popen(’explorer “C:\Program Files (x86)\Funcom\Anarchy Online”‘)
if x == ‘13′:
subprocess.Popen(’explorer “C:\Program Files (x86)\Notepad++\”‘)
if x == ‘14′:
subprocess.Popen(’explorer “C:\Program Files (x86)\Bethesda Softworks\Fallout 3\”‘)
For some reason a large amount of these programs will not open correctly if started directly from the program, so I get explorer to open a window and I just open them with double-clicks.
In short, I would like to know how to replicate that program in Ruby and Lisp, you don’t have to spell it out, just tell me the commands I need and where I can go to find out how to use them correctly, and if anyone would like, criticize/tell me how I can optimize that program, it’s amateur at best.
Best answer:
Answer by coolanswerer
If you want to run a command in Ruby, just surround it with `s.
Like:
`explorer “C:\Program Files (x86)\Bethesda Softworks\Fallout 3\”`
For LISP, if you’re using Common Lisp, you’re screwed.
Give your answer to this question below!
How To Make A Bamboo Fly Fishing Rod - Complete Guide
The French Best Seller ‘la Canne A Mouche” Translate In English. How To Build A Bamboo Fly Rod, A Practical Guide With Videos
How To Make A Bamboo Fly Fishing Rod - Complete Guide
Australian Shepherd Dog Art Print / Dog Pencil Drawing
| US $7.99 (0 Bid) End Date: Wednesday Feb-22-2012 16:29:57 PST Bid now | Add to watch list |
| US $49.00 End Date: Wednesday Feb-22-2012 16:30:08 PST Buy It Now for only: US $49.00 Buy it now | Add to watch list |
Related posts:
- PosterRevolution.com Announces Ground-Breaking Loyalty Program
- What are those sealed posters that you see on the walls of theaters called?
- Kudos if you can provide artist or artwork name by this description…?
- Q&A: Kudos if you can provide artist or artwork name by this description…?
- How do I draw ascii art in JAVA with nested for loops?