Bat file launchers for nightly builds

59 views
Skip to first unread message

Matt Wilkie

unread,
Dec 14, 2012, 2:59:05 AM12/14/12
to leo-e...@googlegroups.com
Hi Terry,

Inspired by the recent problem Nils reported with the 4.10 final installer, I've built a batch file to make running the development snapshots a little easier, attached. Here is the header:

{{{
@echo
:: A batch file which generates other batch files to run the Leo Editor,
:: adapted for the local machine. Optionally, it will also set the Windows
:: filetype and association so .leo files can be opened from Explorer.
::
:: It needs to live in the same folder as "launchLeo.py"
::
:: Open Source X/MIT License
:: initial version * 2012-Dec-13 * matt wilkie <map...@gmail.com>
}}}

Feel free to use, modify or discard as you see fit.

Although it can register the filetype and association, removing them is left as an exercise for the reader (`assoc /? && ftype /?`); maybe later. ;-)

cheers,

-matt

Matt Wilkie

unread,
Dec 14, 2012, 3:10:37 AM12/14/12
to leo-e...@googlegroups.com
....let's actually attach the file this time!

...and then again, maybe not. Apparently one isn't allowed to attach .bat files anymore. Stupid #!#$$@*% malfesant crackers. It can be fetched from https://code.google.com/p/maphew/source/browse/other/create-leobat.bat.

-matt

Nils Lindemann

unread,
Dec 14, 2012, 10:26:59 AM12/14/12
to leo-editor
thats cool but i would also like to have
a bit of doc how to do it manually.

Nils

Matt Wilkie

unread,
Dec 14, 2012, 11:57:04 AM12/14/12
to leo-e...@googlegroups.com

thats cool but i would also like to have
a bit of doc how to do it manually.

as noted in the other thread, you've stumbled over an omission in the docs. Here is the manual recipe for benefit of the thread archives:

Installing Leo on Windows

  1. Install Python from http://www.python.org/download/releases/

  2. Install either Tk or Qt, as described above.

  3. Install Leo. Get Leo’s .zip file from http://sourceforge.net/projects/leo/ You can unpack the .zip file anywhere, including Python’s site-packages folder, for example, C:\Python26\Lib\site-packages

  4. [optional] Generate/update a junction link from unpacked leo folder to ...\site-packages\leo:

    cd C:\Python26\Lib\site-packages\
    junction leo leo-4-6-2-final
  5. Create windows shortcut (edit paths as necessary):

    Target   =  C:\Python26\pythonw.exe "C:\Python26\Lib\site-packages\leo\launchLeo.py"
    Start in =  D:\code
  6. Associate .leo filetype batch file:

    ftype LeoFile=C:\Python26\pythonw.exe "C:\Python26\Lib\site-packages\leo\launchLeo.py" "%*"
    assoc .leo=LeoFile
  7. [optional] Put this leo.bat in %PATH%:

    @C:\Python26\python.exe "C:\Python26\Lib\site-packages\leo\launchLeo.py" %*

For more information see:


From http://webpages.charter.net/edreamleo/install.html#installing-leo-on-windows (and http://www.maphew.com/How_To/Installing_Leo_Editor_on_Windows.html)

cheers,

-matt

Terry Brown

unread,
Dec 14, 2012, 9:52:24 AM12/14/12
to leo-e...@googlegroups.com
On Thu, 13 Dec 2012 23:59:05 -0800
Matt Wilkie <map...@gmail.com> wrote:

> Hi Terry,
>
> Inspired by the recent problem Nils reported with the 4.10 final installer,
> I've built a batch file to make running the development snapshots a little
> easier, attached. Here is the header:

Edward - I haven't tested this batch file to register the .leo
extension and make batch files to run leo in Windows, not using
windows, but it looks useful. Here's the current contents of the Leo
root dir:

bzr-manifest.txt leo_to_html.xsl pylint-leo.py
INSTALL.TXT LICENSE.TXT README.TXT
launchLeo.py Makefile setup.py
leo PKG-INFO.TXT stand_along_globals.leo
leo.nsi profileLeo.py
leoStandAloneGlobals.py pylint-leo.bat

so it seems adding another file, create-leobat.bat, can't hurt, do you
agree?

On the snapshot download page I'll add pointer to the create-leobat.bat
for windows users and I guess it should go in the docs. somewhere also.

Cheers -Terry

> {{{

Matt Wilkie

unread,
Dec 15, 2012, 12:48:37 AM12/15/12
to leo-e...@googlegroups.com
Thanks Terry. I didn't know/remember you're not running Windows, else I wouldn't have lobbed it at you first. ;-)

-matt

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To post to this group, send email to leo-e...@googlegroups.com.
To unsubscribe from this group, send email to leo-editor+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.


Nils Lindemann

unread,
Dec 15, 2012, 12:53:36 AM12/15/12
to leo-editor

> as noted in the other thread, you've stumbled over an omission in the docs.

ah yes. this is missing in latest docs for v 4.9:
http://webpages.charter.net/edreamleo/installing.html#installing-leo-on-windows

and it is there in the v4.8 docs:
http://webpages.charter.net/edreamleo/install.html#installing-leo-on-windows

i think this doc is cool and it should be reinserted with some
changes, see my answer in other thread.

cheers, Nils

Edward K. Ream

unread,
May 1, 2013, 10:57:02 AM5/1/13
to leo-editor
On Fri, Dec 14, 2012 at 1:59 AM, Matt Wilkie <map...@gmail.com> wrote:


Inspired by the recent problem Nils reported with the 4.10 final installer, I've built a batch file to make running the development snapshots a little easier, attached.

I'm going to file this under Leo/Install for now.  This will give it a fairly high priority for the next release, as I'll explain in another post.

Edward

Edward K. Ream

unread,
May 5, 2013, 6:47:32 AM5/5/13
to leo-editor
On Fri, Dec 14, 2012 at 8:52 AM, Terry Brown <terry_...@yahoo.com> wrote:

Edward-Here's the current contents of the Leo
root dir: [snip]


so it seems adding another file, create-leobat.bat, can't hurt, do you
agree?

Yes.

On the snapshot download page I'll add pointer to the create-leobat.bat
for windows users and I guess it should go in the docs. somewhere also.

Good idea.

Edward

Terry Brown

unread,
May 5, 2013, 9:57:17 AM5/5/13
to leo-e...@googlegroups.com
On Sun, 5 May 2013 05:47:32 -0500

Matt - this is an old thread, but the gist was to include

https://code.google.com/p/maphew/source/browse/other/create-leobat.bat.

in the top level Leo directory and point windows users to it in the
docs. and the nightly .zip page.

Can you review the above to see if it needs any changes and confirm
adding it still makes sense in light of other Leo association things
you've come up with more recently? I'm guessing it could still be
helpful.

Cheers -Terry

gatesphere

unread,
May 5, 2013, 9:59:46 AM5/5/13
to leo-e...@googlegroups.com
When I used that script, I had to modify it slightly to get it to work
with my system. My version is here:
https://gist.github.com/gatesphere/4692706

Just a heads up.

-->Jake

Matt Wilkie

unread,
May 5, 2013, 5:19:42 PM5/5/13
to leo-e...@googlegroups.com
Hi Jake,

> When I used that script, I had to modify it slightly to get it to
> work with my system.  My version is here:
> https://gist.github.com/gatesphere/4692706

Do you remember why you needed to use `%%1` in place of `%%*` ?

The former will only pass the 1st parameter while the 2nd will pass everything. So when using `%%1` the second and further files or parameters will be ignored. I didn't come up with a scenario where that is needed or an improvement, but perhaps I'm missing a use case were it is(?)

Since writing that batch file I notice the association created by the Python.org installer uses this syntax:

    C:\pythonXX\python.exe "%1" %*

This got me curious enough to do some digging.This is what happens on my machine (Win7 x64; parts omitted for clarity).

-----
    ::leo.bat   
    start "leo" /B "b:\o4w\bin\pythonw.exe" "B:\apps\leo-editor\launchLeo.py" "%*"

usage example and result:

    B:\>leo first.leo second.leo

    B:\>start "leo" /B "b:\o4w\bin\pythonw.exe" "B:\apps\leo-editor\launchLeo.py" "first.leo second.leo"

only 2nd workbook opens

-----
    ::leo.bat   
    start ... "%1"

usage example and result:

    B:\>leo first.leo second.leo

    B:\>start ... "first.leo"

only 1st workbook opens

------
    ::leo.bat   
    start ... %*

usage example and result:

    B:\>leo first.leo second.leo

    B:\>start ... first.leo second.leo

both workbooks open

-----
and finally, the python filetype syntax:

    ::leo.bat   
    start ... "%1" %*

usage example and result:

    leo first.leo second.leo "third with space.leo"

    B:\>start /b "Leo" "b:\o4w\bin\pythonw.exe" "B:\apps\leo-editor\launchLeo.py"
"first.leo" first.leo second.leo "third with space.leo"

All 3 workbooks open. So it seems harmless that the first is listed twice, though I imagine there would be a performance impact if it were a large leo file. I don't see a reason for using this syntax though.

more slightly off topic comments in your gist (shortly).

cheers,

-matt

Matt Wilkie

unread,
May 5, 2013, 5:44:31 PM5/5/13
to leo-e...@googlegroups.com
Can you review the above to see if it needs any changes and confirm
adding it still makes sense in light of other Leo association things
you've come up with more recently?  I'm guessing it could still be
helpful.

Done, two small changes added:
create-leobat.bat: change gui Leo launch to Start command (after Jacob Peck);
assoc and ftype commands were in inverted order; change ftype name to follow
python patter (LeoFile --> Leo.File)

In my opinion it's ready to go, pending the results of Jacob's feedback.

cheers,

-matt

gatesphere

unread,
May 5, 2013, 10:16:04 PM5/5/13
to leo-e...@googlegroups.com
Hi Matt,

I've responded on the Gist too, but I'll copy what I had here.


On 5/5/2013 5:19 PM, Matt Wilkie wrote:
Do you remember why you needed to use `%%1` in place of `%%*` ?

The former will only pass the 1st parameter while the 2nd will pass everything. So when using `%%1` the second and further files or parameters will be ignored. I didn't come up with a scenario where that is needed or an improvement, but perhaps I'm missing a use case were it is(?)


L32: Good question why I did that... no clue, really. It works, though, for my purposes. %%* is probably correct, and I will revise this.

L34-35: Google says otherwise: http://www.instructables.com/id/Slightly-More-Advanced-Basic-Batch/step2/ECHO-OFFON-Command/
That being said, I did test this both with and without the @echo off line... and it only worked with the @echo off line. At least on my systems (2 win xp, 1 win 7 64).

L21: It was complaining on my WinXP boxes, but that could be a security setting. Both of my WinXP boxes are the property of my employer, and they have some pretty crazy security protocols in place. Not sure if that has anything to do with it, but my WinXP boxes didn't like the extra slash at all.

-->Jake


Matt Wilkie

unread,
May 6, 2013, 3:29:58 AM5/6/13
to leo-e...@googlegroups.com
Re "@", that instructables says the same thing, to my reading. SS64 might be a better reference site: http://ss64.com/nt/echo.html. Just ponder this: why do we commonly use "@echo off" instead of "echo off" ?

Re: "\\in\\path" not working on XP for you. Interesting, I've used it on XP myself without troubles many times. I did turn up an unanswered question on Stack Overflow about the same thing with double-double slashes: http://stackoverflow.com/questions/729151/double-backslash-not-work

So It looks like the safe thing to do is strip the extra slash, even if it does play havoc with most editor's syntax highlighting of variables.

-matt






--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.

To post to this group, send email to leo-e...@googlegroups.com.

Jacob Peck

unread,
May 6, 2013, 8:59:39 AM5/6/13
to leo-e...@googlegroups.com
Hi Matt,

On 5/6/2013 3:29 AM, Matt Wilkie wrote:
> Re "@", that instructables says the same thing, to my reading. SS64
> might be a better reference site: http://ss64.com/nt/echo.html. Just
> ponder this: why do we commonly use "@echo off" instead of "echo off" ?
Ah, I see what you were getting at now. My apologies, you are correct.

I don't often write Windows batch scripts... only out of necessity,
really. And I was a bit groggy last night when I was reading that.
> Re: "\\in\\path" not working on XP for you. Interesting, I've used it
> on XP myself without troubles many times. I did turn up an unanswered
> question on Stack Overflow about the same thing with double-double
> slashes:
> http://stackoverflow.com/questions/729151/double-backslash-not-work
>
I agree that it's absolutely bizarre, but that's the situation I'm in.
As I mentioned, it might be some security setting that isn't well
documented, might be a Win XP bug, etc.

If we're not aiming to support Win XP, then we could live with the
double slash - I see no evidence of this happening on other Windows
OSes. Also, Microsoft is ending free support for Win XP next year. But
personally, I would vote to keep XP supported - an abnormally large
proportion of users are on XP still.
> So It looks like the safe thing to do is strip the extra slash, even
> if it does play havoc with most editor's syntax highlighting of variables.
>
Agreed.
> -matt
>
-->Jake
Reply all
Reply to author
Forward
0 new messages