lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Feb 16, 2012 at 5:18 AM, sergei karhof <karhof21@gmail.com> wrote:

> BTW, where can I find some instructions/tutorial on the use of Lua for
> scripting NoteCase Pro? Can you provide some links/material, please?

Hi, Sergei,

The tutorial documentation is still pretty thin, but the APIs are
thoroughly documented plus there are many example scripts. Quickest
access is to the online version of the Help file at
<http://notecasepro.com/help.html>. You'd want the Automation, Scripts
and Plugins branch. But it might make more sense to download the app
and view the Help file with it. (I'm not fond of navigating through
the online version because of the Javascript and framed HTML.)

If you are interested in writing a plugin or a modular embedded script
rather than scripts stored in plain text files, I direct your
particular attention to the three APIs described in the Help file at
Automation, Scripts and Plugins > Scripting NoteCase Pro > Scriptable
Program Commands > Embedded Script Commands. One is the "donode"
equivalent of Lua's dofile. The other two return the executing
script's document and node IDs.

There are a lot of APIs to play with; 250 at the moment, not including
the embedded Lua File System library and a TCP/IP library. You can do
a normal require for other libraries if they're located in the app's
executable directory. See Help file > Installing and Upgrading > All
Platforms > NoteCase Pro File Locations.

I've got a large document with embedded scripting aids I've developed;
I'd be happy to share that although no guarantees that everything
works. In fact, because the latest version of the program switched
from Lua v. 5.1 to v. 5.2, I'd go so far as to guarantee there are
broken scripts in that document. :-)

You may find that document particularly helpful because its code is
commented profusely, with an eye toward it serving a tutorial purpose
for newbies as well as providing scripting aids.

In addition to the scripts that ship with the program, there are more
example scripts that can be downloaded from
<http://notecasepro.com/scripting.php>.

Daniel Hertrich's Plugin Developer Tools plugin makes generation of a
plugin skeleton a snap and includes a ood tutorial.
<http://www.hermocom.com/products/notecase/plugins>.

In the program, line numbering is toggled from the View Menu. Source
language highlighting is a node property. Double click on the node
title to get to the Node Properties dialog, or use my scripts that add
and remove the relevant node property to and from the current node or
all currently listed nodes.

Although the program supports five file formats natively, the content
of each note is represented internally and for purposes of Lua
scripting as a subset of HTML 4.01 Transitional. The EditNoteHtml.lua
script available at <http://notecasepro.com/scripting.php> allows you
to view and edit note source in a temporary node and is very handy
when scripting the app.

I could keep going, but you've inspired me to do so in a more
organized fashion, in a manner that could also be useful to others. I
think I'll see how far I can get this week on a "Scripting NoteCase
Pro -- Getting Started" outline.

But please feel free to contact me off-list for further information.

Best regards,

Paul