General discussion about plugins.

Browse, download and discuss plugins for Blumentals code editors
Post Reply
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Post by Aivars »

Features added in Build 185:

Fixes: Documents.TabByFileName is implemented now. keydown signal adds shift state parameter.

If Script.Message(...) outputs string containing a marker in specific format then doubleclicking this line in Messages pane will bring the cursor to the corresponding line.
Some samples that will work:

Code: Select all

Line 1
Line: 1
Line 1:2
Line: 1:2
some_error:1:2
"some error":1:2
New functions

Code: Select all

function DirectoryExists(Path: string): Boolean;
function DateSeparator:string
function TimeSeparator:string
function ShortDateFormat:string
function LongTimeFormat:string
TEdit and TMemo have new methods available:

Code: Select all

CopyToClipboard
PasteFromClipboard
SelectAll
New function CustomSortStringList. Sample:

Code: Select all

function TestSort(SL, i1, i2) {
    return -CompareText(SL[i1], SL[i2]);  //notice the "-"
}

function CreateTestMem() {
    var Mem = new TMemo(WeBuilder);
    var lala = new TStringList;
    Mem.Parent = WeBuilder;
    Mem.Visible = true;
    Mem.Width = 300;
    Mem.Height = 300;
    lala.Add("a");
    lala.Add("c");
    lala.Add("1");
    lala.Add("b");
    lala.Add("2");
    lala.Add("3");
    CustomSortStringList(lala, &TestSort);
    Mem.Lines.Text = lala.Text;
}
Blumentals Software Programmer
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

When using the "document_before_save" signal, is it possible to prevent the document from being saved?
I tried returning FALSE from the callback function, but it didn't have any effect.

I want to prevent saving if an error was found, so document only can be saved when there's no errors in code.
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Post by Aivars »

It's not possible to block saving from plugins normally. You could try to have the signal handler to throw an exception but I haven't tested this approach.
Blumentals Software Programmer
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

Aivars wrote:It's not possible to block saving from plugins normally. You could try to have the signal handler to throw an exception but I haven't tested this approach.
No problem. I ended up using "document_after_save" instead.

Another question: Is it possible to see if the editor content have been changed since last save from plugin scripting?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Post by Aivars »

One way to do it for now would be to monitor "modified" signal.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Post by Aivars »

Actually, couldn't you just use Editor.Modified or Document.Editor.Modified?
Blumentals Software Programmer
User avatar
anderson
Posts: 13
Joined: Thu Jul 02, 2015 6:48 am
Location: Venezuela
Contact:

Re: General discussion about plugins.

Post by anderson »

Hello,

I'm having trouble developing a plugin to compile sass files. I need to run the following command with the ExecuteCommand function:

Code: Select all

"C:\ruby\bin\compass" compile 'C:\Apache24\htdocs\www.ingeniasoftware.com.ve\themes\default\'
And I get a blank error window:

Image

Here is my code:

Code: Select all

(...)

      var command = "\"C:\\ruby\\bin\\compass\" compile '"+dir+"'";
      var OutputText;
      ExecuteCommand(command, &OutputText);
      
      Script.Message(command);
      Script.Message(OutputText);

(...)
Is there any way to run this command directly from WeBuilder?

I tried it with ExecuteFile but do not want it to look that black terminal window

PS: It seems that the variable OutputText does not work either :(
Web developer and designer. Using WeBuilder since 2014.
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

Remove the ampersand (&) from the OutputText variable. Then it will work.

ExecuteCommand(command, OutputText);
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
anderson
Posts: 13
Joined: Thu Jul 02, 2015 6:48 am
Location: Venezuela
Contact:

Re: General discussion about plugins.

Post by anderson »

** SOLVED **
You MUST add the file's extension (in my case, i need to use the .bat compass file) Thanks for the help pmk :D, example:

Code: Select all

var command = "\"C:\\ruby\\bin\\compass.bat\" compile '"+dir+"'";
---

It does not work, still sending error messages (now in Chinese) :shock:

Image

Image
Web developer and designer. Using WeBuilder since 2014.
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

Try taking a look at my "Node-Sass" plugin. It uses ExecuteCommand too.
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

I have noticed that the GUI of plugins doesn't always have the same size on virious systems.
A good example is the Project Manager plugin by dave.

On my old Windows 7 system everything was aligned properly, but on Windows 10, the labels are longer and partly hidden behind form fields. (See screenshot)

Do you have to specify font/size for each form element in order to achieve consistency between systems?

Image
There are 10 types of people in the world: Those who understand binary and those who don't.
pety
Posts: 187
Joined: Fri Mar 02, 2012 7:17 pm

Re: General discussion about plugins.

Post by pety »

What kind of [Project Manager] is that?
Is it a downloadable plugin?
dave
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Post by dave »

The plugin was created in Windows 7. Perhaps Windows 10 has a different default on screen font? Different as in different size?
User avatar
pmk65
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Re: General discussion about plugins.

Post by pmk65 »

dave wrote:The plugin was created in Windows 7. Perhaps Windows 10 has a different default on screen font? Different as in different size?
I have the same problem with some of my plugins. But your Project Manager GUI was the best to illustrate the problem. :D
So if it's the system font that is used, maybe it would help if we specify a font/size for each form element?

Aivars, do you have any solutions for this problem?
Would specifying a font/size help? And should you set it on each form element or can you set it at the form definition?
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Post by Aivars »

I'll look at the text zooming issues. Could you try if setting myform.Scaled = true or false helps?
Blumentals Software Programmer
Post Reply