Automatically open TBrowser after double-click on a .root file

Hi there,

I’m trying to distribute Graphs stored in root files to users that have no idea of ROOT. As such, i want to make it as easy as possible to them.
What I’d like to have is that every time a user double clicks in W7 on a .root file, the TBrowser opens automatically such that he doesn’t have to type “new TBrowser”.

I remember that a TBrowser was automatically opened upon a .root double click, a few months ago, but somehow it doesn’t work anymore now. Now, the file is attached as _file0 but no Browser shows.
I didn’t change my ROOT environment (v5.34), so I don’t know why it changed.

Does anybody have an idea?
Thanks a lot!

Hi,

It should work. For example, it should display something like this:

root [0] Attaching file C:/Users/bellenot/rootdev/tutorials/geom/geometries/lhcbfull.root as _file0... Processing C:\Users\bellenot\bin\root\v5-34-00-patches\macros\fileopen.C... root [2]
And check that the “.root” extension is properly associated with root.exe (right-click on a .root file and select “properties” in the context menu):



Cheers, Bertrand.

In my console it displays the following:

root [0]
Attaching file C:\.... as _file0
root [1]

So it looks like it doesn’t process.

The root extension is associated with the aid of a batch file that I’ve created for my distribution:

set ftypename=rootfile
set extension=.root
set pathtoexe="C:\root\bin\root.exe"
set pathtoicon=""

if %pathtoicon%=="" set pathtoicon=%pathtoexe%,0
REG ADD HKEY_CLASSES_ROOT\%extension%\ /t REG_SZ /d %ftypename% /f
REG ADD HKLM\SOFTWARE\Classes\%ftypename%\DefaultIcon\ /t REG_SZ /d %pathtoicon% /f
ftype %ftypename%=%pathtoexe% "%%1" %%*
assoc %extension%=%ftypename%

Now it looks like this:


I also tried to manually change it through Change->root/bin/root.exe, trying to replace my batch association but the same issue happens again.

Thanks,
Michael

Well, usually ROOT does everything (modifying the registry) for you when double-clicking on root.exe, so I would advise to cleanup what you did (be careful if you edit the registry) an simply try to use what ROOT does…

Cheers, Bertrand.