Ellie Staff 762,747 Jun 2, 2008 #1 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.
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 382 Jun 2, 2008 #2 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: Upvote 0 Downvote
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: