Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Syntax to open a program

I know this is simple, I just forgot  :dead:

What's the syntax to open a file in a program from Ruby?

I know it involves Thread.new.

For example, I want to open "journal.txt" from the game folder, in Notepad.

Thanks.
 

khmp

Sponsor

Ok if you just want notepad to become the current running object. This will replace the game.exe with notepad.exe:
Code:
exec 'start notepad test.txt'
If you wanted to start notepad and have it take the process time away from game.exe until it's closed:
Code:
system('notepad test.txt')
And finally if you want them to run concurrently together:
Code:
Thread.new{ system('notepad test.txt') }

Good luck with the exams Commander Wyatt! :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top