lua script execution on startup

697 views
Skip to first unread message

kelye

unread,
Dec 3, 2008, 7:26:49 AM12/3/08
to scite-interest
how can i execute a lua script, or a simple anonymous function, on lua
initialization ?

i've tried to add in SciTEUser.properties ext.lua.startup = path to my
script but the script does not run on startup

thanks

Frank

unread,
Dec 3, 2008, 7:34:55 AM12/3/08
to scite-interest
the configuration should look like this (different property-name):
ext.lua.startup.script=$(SciteDefaultHome)\lua\base.lua

regards Frank

kelye

unread,
Dec 3, 2008, 8:52:38 AM12/3/08
to scite-interest
Thanks!
It works but not with the expected results :)

i did a small script that reads each line in SciTE.session and opens
each path it finds.

but that script is runned at each new file load and slows Scite :(

i made it a function and added a shortcut.. so each time i forget to
load the session i'm calling my function to load the session:)

Frank

unread,
Dec 3, 2008, 9:14:01 AM12/3/08
to scite-interest
without see the code of your script i cannot help you much...why don't
you use the save.session-property? it saves the seesion on exit and
restore it on startup.

a simple script from our gui-extension (maybe perform works only with
sciteRu):

local function OpenFile(filename)
if filename:match(".session$") ~= nil then
filename = filename:gsub('\\','\\\\')
scite.Perform ("loadsession:"..filename)
else
scite.Open(filename)
end
end

maybe this helps you.a session file can hold not only the filenames.
it can contain line position, active buffer and recent-files.so it can
be difficult to parse it manually.

regards frank

kelye

unread,
Dec 3, 2008, 9:53:07 AM12/3/08
to scite-interest
Thanks for your time Frank!
I am using save.session and also check.if.already.open=1 so i'm having
only one instance .
The problem is when i double click a file that has Scite as default
editor and i'm not having Scite running. It opens Scite with that file
only without loading the session.
Untill now i had to open the .properties file, make
check.if.already.open 0 and open another instance of Scite (that one
will load the session), put it back to 1,close the instance with the
single file, open the file in the instance with the session... (the
action itself takes less than writing or reading it ... but still )

I've started another topic with my solution :)

René Treviño Hernández

unread,
Dec 3, 2008, 9:26:00 AM12/3/08
to scite-i...@googlegroups.com
Hi Frank, where I put this function in SciTE?
Thanks.
Regards.


De: Frank <frank.wu...@gmail.com>
Para: scite-interest <scite-i...@googlegroups.com>
Enviado: miércoles, 3 de diciembre, 2008 8:14:01
Asunto: [scite] Re: lua script execution on startup


¡Todo sobre Amor y Sexo!
La guía completa para tu vida en Mujer de Hoy:
http://mx.mujer.yahoo.com/

Frank

unread,
Dec 3, 2008, 3:21:18 PM12/3/08
to scite-interest
you can it put in anywhere in a lua-script wich is loaded at startup
and use it from another function or a dostring in a command property.
its only a help-function, not intended to be a full script.as i wrote
above its a part of SciteRu's Sidebar.lua. look at the sciteRu -
project (http://scite-ru.googlecode.com) for more.

regards Frank

On 3 Dez., 15:26, René Treviño Hernández <renetr...@yahoo.com.mx>
wrote:

kelye

unread,
Dec 4, 2008, 3:43:39 AM12/4/08
to scite-interest
The default Scite release does not have Perform as e metod of 'scite'
so that will work only in Scite-ru.

Frank

unread,
Dec 4, 2008, 4:48:00 AM12/4/08
to scite-interest
i've found an older thread of me regarding sesion-files:
http://groups.google.com/group/scite-interest/browse_thread/thread/5b9b2d5afe145b03
take a look on mozers posting from november 19th.

i'm using sciteru, because it has many useful extensions (http://scite-
ru.googlecode.com/svn/trunk/pack/doc/SciTE-Ru_Kernel.html). maybe its
also a choice for you. you'll find my version (german language) at
http://www.fw-web.de/scite.php.

frank
Reply all
Reply to author
Forward
0 new messages