How do you open a binary file in Xojo?

I’m just learning programming with code that I inherited. I have what I assume is a binary file and would like to open it using Xojo. When I double click on it, it opens in a text editor and I just see a stream of what looks like gibberish. How can I open it? Thanks for your help.

Try to right click on the file and “Select” your Xojo App. I have to do this sometimes with downloaded projects.

What is the extension of the file? Does it not open using File->Open with Xojo?

Thanks, guys. @Paul: There is no extension on the file. Finder says it’s File Type Document. I’m still unable to open it in Xojo. Any clues as to what’s wrong?

The file: https://www.dropbox.com/s/g3d7qihnatqt9mw/Untitled
The app: https://www.dropbox.com/s/ber8g061jzmt4dm/My%20Application.zip
The program: https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project

Sam

Samuel I was able to successfully open the third link *Xojo_binary_project without issue. I just clicked, downloaded, and opened it.

Thanks, Mike. I’m able to open the program saved as *Xojo_binary_project in link 3 just fine as well as the App in link 2 but cannot use Xojo to open the binary file in link 1. Any idea what’s wrong? Thanks again,

Sam

That’s not a Xojo project file. Is it a data file? What do you expect to be able to do with it?

Hi Tim, sorry for the late reply, but I’ve been busy with other work and am just now returning to this project. The file was created by saving the configuration (see App.FileSave in the Xojo binary project under App >> Menu Handlers). I expect to be able to run the program with various saved preferences.

The app: https://www.dropbox.com/s/ber8g061jzmt4dm/My%20Application.zip
The program: https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project

Ok. So you save the file using a BinaryStream and a series of WriteByte, WriteDouble, etc., calls. You would read it back the same way. Can you restate the question? It’s not clear what you’re looking for.

Thanks, Tim. This part of the program is unmodified from an earlier version of the program, so I’m confused as to why it won’t work. Sorry for not phrasing things properly, but I’m pretty inexperienced with programming.

Basically, I want to make modifications to the main Graphics Window and Control Window to temperature, the color of the blue and yellow squares, etc. and be able to save those changes. Will that code do this for me? If so, how do I “read it back the same way”, as you mentioned? Could you please give an example? In an earlier version of the program, you were able simply to make changes by going to File >> Save and then double clicking the saved file to open it.

Thanks again,

Sam

Double clicking the file to open it depends on your particular system’s File Associations. The problem with the file you have is that it doesn’t have an extension (or a sensible name). I’m not a Mac guy, but I believe Mac OS uses the file extension to associate a program with the file. Newer versions of OS X use settings in your app’s plist as well. Somebody else will have to chime in on how to set that up.

Once you do get the file associations set up, when you double click the file, your app will fire its App.OpenDocument event. Look there for the code that opens the file. I suspect that everything is set up in the project correctly, you just need to tell your Mac to use your app to open the file.

Thanks, Tim. Can any Mac guys help me out?

The program: Dropbox - Error - Simplify your life

Try this:
https://www.dropbox.com/s/f621i6qs16u80gf/MyApp.xojo_binary_project

I added a FileType set with your extension and type, changed the GetOpenFolderItems to use that FileType, and then made a short post build script to edit the plist to include the new extension. It all seems to work for me now running OSX 10.7.5.

Thanks, Jason. I’m running Mac OSX 10.9.2. When I double click the file to open it, however, I get a message saying that “PowerPC applications are no longer supported.” Is there any way around this? I will try tomorrow at work running OSX 10.6.8.

Interesting… I don’t think I can open PowerPC files either. Maybe a few ideas -

If you right click on the file from your app and select open with “Your app” does it successfully open or do you get the same message? What if the app is open when you double click on the file?

Also I have come across an issue where Air Dropping or emailing an unzipped app can confuse the OS into thinking it is a PPC app. Did you air drop the app or email it to yourself without compressing the app?

Thanks, Jason. That works fine!!! Is there a way to have it open in my app by default, or will all users of this program get the same message that I got?

As for compressing the app, yes, I compressed it before emailing it to myself.

@Samuel Cohen , you probably have an older version of the app on your drive, and that one was built as PowerPC. Delete that and your launching issues will probably stop.