Problems viewing source code from an .rb file

I’m learning how to computer program. I have source code written in BASIC and saved as an .rb file. Neither the author of this code using his PC nor I using my Mac can view the source code. When we open it in our respective text editors, we get a bunch of unreadable text. How can I view the source code? I apologize if this isn’t the right forum for Real Basic questions.

when you wrote it in BASIC (I am guessing Real Basic), did you save it as “VCP” or “XML” format? or the default “binary” format? VCP and XML are text based formats. ease to read using a text editor (like Textmate or Notepad). If it was in the default binary format then you need to go back and resave it to VCP or XML formats.

sb

Thanks, Scott. I don’t know whether it was saved as VCP or XML format: the code was written several years ago by a different author. How would I resave it to VCP or XML formats? The only copy the original author and I have is the .rb file with the unreadable text; is it salvageable? Would I need the last version of Real Basic (Real Studio) to salvage it?

Try changing the extension to RBP and opening that with Xojo…

If that does not work you need a version of RB that is old enough to read the file.

If it is an “rb” file then that likely means it is a binary RealBasic file. This eventually was renamed to be “rbp” and now “xojo_binary_project”.

It’s possible it will open with Xojo, so you should just try renaming it to “rbp” and trying to open it with Xojo.

If that doesn’t work, it may need to first be open in an older version of Realbasic to convert it to one of the newer formats. Feel free to send the file to me and I’ll give it a shot: paul@xojo.com

Thanks, everyone. I resaved it with the .rbp suffix and opened it in Xojo, but couldn’t view the source code. Perhaps that’s because I’m unfamiliar with how Xojo works. I will send it to you, Paul, for additional help in getting it to open. Again, thank you.

An .rb file is VERY old - from around RealBasic version 5 or earlier perhaps older as the extension for these was changed to rbp because Ruby also use .rb as the extension for their files
It’s very likely you’ll have to open this in version 5.5, save it as XML or Text & then be able to open it in later versions

[quote=19737:@Norman Palardy]An .rb file is VERY old - from around RealBasic version 5 or earlier perhaps older as the extension for these was changed to rbp because Ruby also use .rb as the extension for their files
It’s very likely you’ll have to open this in version 5.5, save it as XML or Text & then be able to open it in later versions[/quote]

I’m pretty sure I recently did change the extension on an old .rb file and was able to open it… are you saying that is not likely to work generally?

The last time I had to upgrade an .rb file to a new version I had to go through a number of intermediate versions (4.5 to 2006, 2008 then 2009) and fix up all the deprecations along the way.

Just opening the .rb file didn’t work for this particular project - however the .rb format has NOT undergone huge changes but there have been some in the intervening years (nearly 10 :P) Some are significant - some are not.

Your mileage may vary.

.rb is the extension for Ruby-files. A fine language for learning programming. If you want to learn the basics of OO programming, you should play for one day with

http://hackety.com

After that, you will understand a lot more from any other language or programming environment like Xojo.

[quote=19744:@Norman Palardy]The last time I had to upgrade an .rb file to a new version I had to go through a number of intermediate versions (4.5 to 2006, 2008 then 2009) and fix up all the deprecations along the way.

Just opening the .rb file didn’t work for this particular project - however the .rb format has NOT undergone huge changes but there have been some in the intervening years (nearly 10 :P) Some are significant - some are not.

Your mileage may vary.[/quote]

I have opened REALLY OLD .rb files found over the web from back the very old days. You usually get a festival of warnings that need resolving but the file itself is usually recognizable enough to get there. The OP’s problem seems to be earlier than that.

Something tells me the file is not a basic file at all:

I’m guessing the file is NOT a realbasic file at all. By the OP’s implied expectation that changing the extension changes the format I’d be willing to bet the file is BASIC from another part (.BAS file, for example, or even a plain .TXT). I don’t even discard that the actual files are Ruby really :slight_smile:

Looking at the file would be the fastest way to figure it out.

Sam: Could you share one of the files with us? You could do so privately if you wish. I could tell you what the code is in a few seconds when looking at it.

It is now, but it used to be for RealBasic and it got sort of hijacked, so REAL changed it to .rbp.

If the files are old enough, they might be .rb and still be “Xojo” (back from the stone age of Xojo’s evolution, right after extensions started being used in Mac OS, more by convention than need).

I have REALbasic project files that appears (I create some) before .rb was the REALbasic file extension. Go figure.

As far as I can recall, there were three project file formats; the first one is incompatible with the third one (Xojo).

I doubt if this is correct. Ruby is invented and launched in 1992 - 1995 with the extension .rb. Visual Basic became CrossBasic in 1998, later renamed as Real Basic. Thats over 5 years later.

I could have it wrong. I wasn’t interested back when the extension started being used and I might have picked the story wrong.

No sweat. More interesting is, in this context: How can a Xojo-app activate a Ruby-script and pick up the results? So full integration of Xojo and Ruby?

It wasn’t always and .rb files may have been from Ruby OR the now very old REAlbasic versions.

Visual Basic was not CrossBasic.
They are totally separate products. VB came from Microsoft. CrossBasic came from Andrew Barry before REAL software was founded.
CrossBasic turned into RealBasic in about 1996/1997 - and Ruby still wan’t all that common then.

Run it in a shell

Visual Basic did not “become” CrossBasic! Andrew Barry said there was some inspiration from VB but that’s about it.