# Beginner needs help

**URL:** <https://www.ruby-forum.com/t/beginner-needs-help/120206>\
**Category:** Ruby\
**Created:** [November 14, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206 "2007-11-14T19:31:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 14, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/1 "2007-11-14T19:31:06Z")

</div>

Hey everyone!

I’ve recently got in touch with the Ruby programming language and  
thought it was very interesting and useful, way better than a ton of  
other languages.

Anyway, I need some help on a few things:

1. Is there a way to detect if a program was launched? If yes, can I  
block this launch and restart it when desired?
2. Can I make Ruby read \*.dat files and convert them into \*.txt?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 14, 2007, 7:50pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/2 "2007-11-14T19:50:15Z")

</div>

Caesar Salad wrote:

> Hey everyone!
> 
> I’ve recently got in touch with the Ruby programming language and  
> thought it was very interesting and useful, way better than a ton of  
> other languages.
> 
> Anyway, I need some help on a few things:
> 
> 1. Is there a way to detect if a program was launched? If yes, can I  
> block this launch and restart it when desired?  
> What’s the platform? Windows? I suspect the answer’s no, but there may  
> be hooks to do this that I don’t know about.

> 1. Can I make Ruby read \*.dat files and convert them into \*.txt?  
> The answer’s probably yes, but what type of .dat file are these? What  
> program produced them? There are many, many different file formats  
> going by the .dat extension 🙂

---

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 16, 2007, 4:41am UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/3 "2007-11-16T04:41:07Z")

</div>

> What’s the platform? Windows? I suspect the answer’s no, but there may  
> be hooks to do this that I don’t know about.  
> Yes, the platform is Windows XP, but I intend to make it available to  
> Linux as well. I’m working on an add-on for Age of Empires 2 that  
> enables the player to choose a modpack before starting the game.

> > 1. Can I make Ruby read \*.dat files and convert them into \*.txt?  
> > The file is empires2\_x1.dat, the data file from Age of Empires 2:  
> > Conquerors Expansion. There’s a program that does that already (for  
> > modpack production), but it works quite slowly (30 minutes to produce a  
> > modded data file from an edited txt).

---

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 16, 2007, 2:02pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/4 "2007-11-16T14:02:37Z")

</div>

Caesar Salad wrote:

> > What’s the platform? Windows? I suspect the answer’s no, but there may  
> > be hooks to do this that I don’t know about.  
> > Yes, the platform is Windows XP, but I intend to make it available to  
> > Linux as well. I’m working on an add-on for Age of Empires 2 that  
> > enables the player to choose a modpack before starting the game.  
> > Is offering a separate interface that launches the executable with the  
> > relevant modpack in place not an option?

> > > 1. Can I make Ruby read \*.dat files and convert them into \*.txt?  
> > > The file is empires2\_x1.dat, the data file from Age of Empires 2:  
> > > Conquerors Expansion. There’s a program that does that already (for  
> > > modpack production), but it works quite slowly (30 minutes to produce a  
> > > modded data file from an edited txt).  
> > > If you can see the source to that program, it’s probably worth taking a  
> > > look to see what the file format is. To implement a reader in Ruby,  
> > > take a look at the bitstruct library - it’s probably got everything  
> > > you’ll need.

---

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 16, 2007, 4:33pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/5 "2007-11-16T16:33:18Z")

</div>

Caesar Salad wrote:

> choose what modpack he/she would like to use (in a list or something).  
> Once that was done, the game would then be launched, with the modpack  
> loaded.  
> Also, there are AOE2 players that use Windows, and others that use Linux  
> (and a few who use Macs). So we intended to make this program available  
> for both OS.  
> In that case, you’re probably going to want to just move the AOE2  
> executable to one side and replace it with your program - the user won’t  
> notice the difference then. I don’t know of any cross-platform way to  
> intercept an executable’s launch.

> > If you can see the source to that program, it’s probably worth taking a  
> > look to see what the file format is. To implement a reader in Ruby,  
> > take a look at the bitstruct library - it’s probably got everything  
> > you’ll need.  
> > Where can I get this library?  
> > [http://raa.ruby-lang.org/project/bit-struct/](http://raa.ruby-lang.org/project/bit-struct/)

> (BTW, where can I get a good Ruby library for graphical interface?)  
> TK, GTK, QT and Wx all have Ruby interfaces, among others. Which to  
> choose is a matter of personal taste, to a large degree. There are good  
> examples out there for GTK and QT, at the very least. I’ve not looked  
> into any others myself - search the archives for more discussion on  
> this.

---

<div class="post-metadata">

**Author:** ![caesarsalad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://www.ruby-forum.com/u/caesarsalad)\
**Post date:** [November 16, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/beginner-needs-help/120206/6 "2007-11-16T15:43:12Z")

</div>

> Is offering a separate interface that launches the executable with the  
> relevant modpack in place not an option?  
> Never thought of that. I’m not on my own in this project (actually, some other guy came up with most of the ideas, but he’s no programmer, so he asked me for some advice… so I went on ressearching for a way to implement what he came up with).  
> The thing is: currently, for AOE2, you can launch a graphic modpack  
> through an external program, in a temporary fashion. But only when the  
> game is not running (there are no workarounds for this, unless we hack  
> into the game’s source code, which not only takes time, it’s also  
> illegal). Anyway, what I thought of was to, if the player desired to  
> open a certain modpack, he/she would simply launch the game. It’d be  
> blocked, and my program would appear, giving the player the option to  
> choose what modpack he/she would like to use (in a list or something).  
> Once that was done, the game would then be launched, with the modpack  
> loaded.  
> Also, there are AOE2 players that use Windows, and others that use Linux  
> (and a few who use Macs). So we intended to make this program available  
> for both OS.

> If you can see the source to that program, it’s probably worth taking a  
> look to see what the file format is. To implement a reader in Ruby,  
> take a look at the bitstruct library - it’s probably got everything  
> you’ll need.  
> Where can I get this library?

(BTW, where can I get a good Ruby library for graphical interface?)
