Cannot open Leo files by double-click in Windows Explorer?

66 views
Skip to first unread message

Nick_H

unread,
Apr 13, 2012, 6:24:30 AM4/13/12
to leo-editor
Sorry, this is probably a foolish question, but when I double-click on
any Leo file on my desktop to launch Leo, it simply launches with the
default workbook.leo file open.
I can, of course, open any file via the File|Open dialog, but that's
not so convenient.
The file association contains the following command to execute for the
Open operation:
"C:\Tools\Python32\python.exe" "C:\Tools\Leo-4.10-final\launchLeo.py
%*"

Can you suggest what might be wrong?
Thank you!

Nick

Edward K. Ream

unread,
Apr 13, 2012, 9:30:28 AM4/13/12
to leo-e...@googlegroups.com
On Fri, Apr 13, 2012 at 5:24 AM, Nick_H <n...@plextek.co.uk> wrote:

> "C:\Tools\Python32\python.exe" "C:\Tools\Leo-4.10-final\launchLeo.py
> %*"
>
> Can you suggest what might be wrong?

The last set of double quotes looks wrong. Try:

"C:\Tools\Python32\python.exe" "C:\Tools\Leo-4.10-final\launchLeo.py" %*

In this case, none of the double quotes are needed, because the paths
have no embedded blanks, so this also should work:

C:\Tools\Python32\python.exe C:\Tools\Leo-4.10-final\launchLeo.py %*

Finally, unless you have a strong reason not to do so, I would suggest
adding the --gui=qttabs option::

C:\Tools\Python32\python.exe C:\Tools\Leo-4.10-final\launchLeo.py

--gui=qttabs %*

Edward

HansBKK

unread,
Apr 14, 2012, 12:49:02 AM4/14/12
to leo-e...@googlegroups.com
Here's my launch batch. Note nothing's actually installed

set HOME=E:\aasync\Data\H_HOME
cd \aasync\PortableApps\leo-editor
start "" "..\CommonFiles\Python27\pythonw.exe" "..\CommonFiles\Python27\Lib\site-packages\leo-editor4\launchLeo.py" %*
exit

Matt Wilkie

unread,
Apr 14, 2012, 11:17:30 AM4/14/12
to leo-e...@googlegroups.com
> The file association contains the following command to execute for the
> Open operation:
> "C:\Tools\Python32\python.exe" "C:\Tools\Leo-4.10-final\launchLeo.py
> %*"

it's the trailing %*, use "%1" instead.

You want %* in a batch file. It passes all command line arguments to
the program being called.

"%1" passes just the file being clicked on, quoted for spaces etc.
When in a batch file %1 passes just the first command line parameter.

It is logical to expect %* to work for click file association as well,
but it doesn't. I don't know why.

--
-matt

Matt Wilkie

unread,
Apr 14, 2012, 11:30:10 AM4/14/12
to leo-e...@googlegroups.com
> it's the trailing %*, use "%1" instead.

Here is my setup...

Set up file type association:

C:\> ftype LeoFile=C:\Python27\pythonw.exe C:\apps\leo\launchLeo.py “%1″
C:\> assoc .leo=LeoFile


And put this leo.bat in %PATH%:

@start /b "Leo" C:\Python27\python.exe C:\apps\leo\launchLeo.py %*

--
-matt

Nick_H

unread,
Apr 16, 2012, 3:14:20 AM4/16/12
to leo-e...@googlegroups.com
Many thanks to all for these replies!
This is my final "open" string in the Windows file associations:
"C:\Tools\Python32\python.exe" "C:\Tools\Leo-4.10-final\launchLeo.py" --gui=qttabs "%1"
Note that the brackets are needed round the %1 to cater for file paths containing spaces.

Matt, thanks for the extra details about using ftype and assoc. I hadn't realised those existed in Windows. For anyone else reading this, that is an alternative to working through the file associations GUI.

Nick

HansBKK

unread,
Apr 16, 2012, 3:33:21 AM4/16/12
to leo-e...@googlegroups.com
This is a bit OT, but: for those like me who work in "portable" mode, there's a very cool tool called "PortableFileAssociator" that allows you to create a set of windows file associations, icons etc and enable/disable the whole profile at one time, without messing with the local system's registry.

Also handy for those not in portable mode, but working on different windows boxes and bored with having to tweak each one separately.

Matt Wilkie

unread,
Apr 16, 2012, 2:43:34 PM4/16/12
to leo-e...@googlegroups.com
> there's a very cool tool called "PortableFileAssociator" that allows you to
> create a set of windows file associations, icons etc and enable/disable

neat, thanks for the tip.
oh, looks like it's problematic with portableapps.com suite 'cause of
high false-positive AV warnings... but maybe the same functionality
will be incorporated into the PA menu launcher. Cool.
http://portableapps.com/node/15583?page=4

--
-matt

HansBKK

unread,
Apr 18, 2012, 12:20:14 AM4/18/12
to leo-e...@googlegroups.com

Yes, many cool tools like this use autohotkey, or a certain compiler that also gets used for some malware and triggers false positives for some of the sloppier a/v packages.

If you want to be safe, get a more balanced picture from one of these:
http://www.virustotal.com/
http://virusscan.jotti.org/en

Matt Wilkie

unread,
Apr 18, 2012, 1:20:35 AM4/18/12
to leo-e...@googlegroups.com

Set up file type association:

C:\> ftype LeoFile=C:\Python27\pythonw.exe C:\apps\leo\launchLeo.py “%1″
C:\> assoc .leo=LeoFile 

And put this leo.bat in %PATH%:

@start /b "Leo" C:\Python27\python.exe C:\apps\leo\launchLeo.py %*

Edward (or anyone else with access to bzr, I don't right now (and the last time it didn't work anyway ;-): the docs have the wrong version, It should match the above:
http://webpages.charter.net/edreamleo/install.html#installing-leo-on-windows

 
-matt

Edward K. Ream

unread,
Apr 18, 2012, 10:48:31 AM4/18/12
to leo-e...@googlegroups.com
On Wed, Apr 18, 2012 at 12:20 AM, Matt Wilkie <map...@gmail.com> wrote:

> the docs have the wrong version, It should match the above:
> http://webpages.charter.net/edreamleo/install.html#installing-leo-on-windows

Good catch. I think rather than updating this for every release, I'll
try to generalize it a bit so people will understand what is intended.
The fix will probably be tricky: it's so hard to be clear and general
at the same time. Otoh, making instructions
Python-and-Leo-version-depenedent is pretty hopeless.

EKR

Eoin

unread,
Apr 19, 2012, 4:50:13 AM4/19/12
to leo-editor
I got the association working on Windows 7 using:
>ftype LeoFile="C:\Python322\pythonw.exe" "C:\Program Files (x86)\Leo-4.9-final\launchLeo.py" "%1"
>assoc .leo=LeoFile
>regsvr32 /i shell32.dll

On Apr 18, 3:48 pm, "Edward K. Ream" <edream...@gmail.com> wrote:
> On Wed, Apr 18, 2012 at 12:20 AM, Matt Wilkie <map...@gmail.com> wrote:
> > the docs have the wrong version, It should match the above:
> >http://webpages.charter.net/edreamleo/install.html#installing-leo-on-...

Matt Wilkie

unread,
Apr 19, 2012, 2:48:54 PM4/19/12
to leo-e...@googlegroups.com
I'm glad you got it working.

>>regsvr32 /i shell32.dll

Just note that this command does a lot more than update file
associations, and may undo some other customizations you've done
(default program for camera preview, shortcut wizard behaviour, ...)
Here are some things it does:
http://www.pcworld.com/article/126116/windows_tips_fix_windows_glitches_by_reregistering_your_dlls.html

cheers,

--
-matt

Edward K. Ream

unread,
May 1, 2013, 11:23:29 AM5/1/13
to leo-editor
On Thu, Apr 19, 2012 at 3:50 AM, Eoin <eoinmc...@fastmail.fm> wrote:
I got the association working on Windows 7 using:
>ftype LeoFile="C:\Python322\pythonw.exe" "C:\Program Files (x86)\Leo-4.9-final\launchLeo.py" "%1"
>assoc .leo=LeoFile
>regsvr32 /i shell32.dll

Thanks for this report.  I've filed it under Leo/Install, so that it will considered as we update installation docs and scripts.

Edward
Reply all
Reply to author
Forward
0 new messages