General discussion about plugins.

Browse, download and discuss plugins for Blumentals code editors

Re: General discussion about plugins.

Postby Aivars » Wed Apr 30, 2014 2:28 pm

I think ctrl + / is reserved for some editor functionality. Maybe you can choose a different combination?
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby rich770 » Wed Apr 30, 2014 3:38 pm

What is "Ctrl + /" assigned to?
I looked around and I didn't find it in the menus or the shortcut list.
rich770
 
Posts: 2
Joined: Tue Apr 29, 2014 11:37 pm

Re: General discussion about plugins.

Postby dave » Tue Dec 16, 2014 11:38 am

Hi,

I would like a better method of easily opening/closing a set of files associated with particular projects, and was hoping that this feature may have made it into the new 2015 of WeBuilder, but it seems that it was not included.

Having thought about it, I may be able to achieve this by writing a plugin. On that basis, is there any way that I can access system variables (read only) from within the plugin architecture? I would like to get the currently selected project name and root folder path for it? Is this possible?

Thanks

Dave
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby Aivars » Tue Dec 16, 2014 11:59 am

Project information is currently not available to plugins but I assume it could be added. Let me know specific details of how you imagine your plugin would work and I'll see what needs to be added to make such plugin possible.

Regarding file lists - you can use Tools -> Load a List of Files and Tools -> Save a List of Open Files.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby dave » Tue Dec 16, 2014 1:09 pm

Thanks for the reply.

I am aware of 'Save list of open files', but I don't like the fact that you have to specify the file path to save/open the file(s), having to manage multiple files, and also the fact the resulting file will be saved outside of the application directory. It would be nice to having more streamlined.

I was thinking along these lines for the plugin...

Create a new toolbar with a number of new entries on. It would be along these lines, although the wording could change.

'Save filelist this project'

I would need to get the current project name and directory filepath. Loop through the open tabs, and compare the start of the filepaths to establish which open tabs belong to the current project. Then save a list of filenames/paths to ini using the project name as the key.

'Open files for this project'

Get the current project name, see if there is a corresponding list of files in the ini file where the project name matches the key. This would only be present if previously created by the above process. If present open the list of tabs.

'Close files for this project'

I would need to get the current project name and directory filepath. Loop through the open tabs, and compare the start of the filepaths to establish which open tabs belong to the current project. Then close the tabs which match.

Other options could be added, such as 'Open files for this project but close all others' etc.

The above plugin/process does rely on the user selecting the project first, but will not interfere with any current processes. It should be a lot faster and slicker than the current functionality.

Does that sound doable? Unless of course you would like to add this feature in the application? :)

Thanks

Dave
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby Aivars » Fri Jan 23, 2015 12:45 pm

Dave: The latest build (163) supports basic plugin operations (get project name, get project root) and events (project_before_select and project_after_select). I'm attaching sample here - you can use what you need from it to make your plugin.
Attachments
project management test.zip
(1009 Bytes) Downloaded 245 times
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby dave » Fri Jan 23, 2015 3:14 pm

Thank you for including this in the current build. I'll have a play over the weekend, and see what I can produce.
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby dave » Sun Jan 25, 2015 1:58 pm

Hi Aivars,

Can you give some guidance on using .ini files please. There are no examples anywhere?

The API: Global objects page suggests that you can read and write to .ini files via the following methods

ReadSetting(Name, DefaultVal)
WriteSetting(Name, Value)

but this is different when you go to API: Built-in classes which links to [url]http://docwiki.embarcadero.com/Libraries/XE2/en/System.IniFiles.TIniFile.ReadString[/url] where the syntax is different,

ReadString(const Section, Ident, Default: string): string; override;
WriteString(const Section, Ident, Value: String); override;

I have also tried several ways to create a new .ini file without success, i.e.

var TIniFile = TIniFile.Create("myini.ini");

var i = new TIniFile();
i.Create("test.ini");

And many other ways. Some help and examples needed please.
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby Aivars » Mon Jan 26, 2015 2:48 pm

There are 2 different things that you're mixing:

Script.ReadSetting and Script.WriteSetting are special functions for writing/reading to properties.ini conveniently, but only to properties.ini. You don't need to know anything about ini files to use them but you need to create properties.ini file in the required format. See Alignment plugin for an example.

If you want to use custom ini files, it's something like this:

Code: Select all
var ini = new TIniFile(Script.GetPath + "myini.ini");
ini.WriteString("General Settings", "Title", "Lorem Ipsum");
delete ini;
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby dave » Tue Jan 27, 2015 12:51 pm

Thank you.

Version 1.0 of Project Management to be uploaded shortly :)
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby dave » Sat Feb 07, 2015 12:11 pm

Can you please provide some examples of capturing events such as change or onClick for List boxes and Combo boxes please?

I am having trouble converting from the conventional Delphi style of coding to what is expected in JavaScript.

Are you using some known engine to drive the plugin architecture via JavaScript, i.e. is there better documentation anywhere that can be found particularly with regards to the use of forms?

Thanks
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby Aivars » Sun Feb 08, 2015 6:15 pm

Sure, the engine is based on this: http://www.fast-report.com/en/product/fast-script/.

Regarding the events, here's a sample:

Code: Select all

function OnChange(sender) {
  Script.Message("Changed");
}

function OnClick(sender) {
  Script.Message("Click");
}


var cmbLength = new TComboBox(f);
cmbLength.OnClick = &OnClick;
cmbLength.OnChange = &OnChange;

Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby Aivars » Sun Feb 08, 2015 6:21 pm

Also, taking a look at these examples might be helpful: http://help.blumentals.net/webuilder/pl ... amples.htm
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2385
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: General discussion about plugins.

Postby dave » Sun Feb 08, 2015 11:04 pm

Thanks for the examples I have got this part working now :)

I have looked at the documentation you provided the link to, but there was only one form example and no events.
dave
 
Posts: 24
Joined: Fri Mar 31, 2006 2:45 pm

Re: General discussion about plugins.

Postby pmk65 » Mon May 18, 2015 4:35 pm

I'm trying to write a plugin which uses Regular expressions, but I just can't get it to work.

The documentation for "RegexMatchAll" says it returns a Boolean value (Which is true/false or 1/0). But I get either 0 or -1 returned.

Example:
Code: Select all
var str = "abc 3px hh 4px";
regEx = RegexMatchAll(str, "px", true, unitMatch, unitPosition);   // regEx is -1, length = 2
regEx = RegexMatchAll(str, "xx", true, unitMatch, unitPosition);   // regEx is 0
regEx = RegexMatchAll(str, "(\d*\.?\d*)px", true, unitMatch, unitPosition);   // regEx is -1, length = 0

Does -1 indicate a match is found?

I got a simple Regular expression "(\d*\.?\d*)px", but I don't know how to use it in a WeBuilder plugin, since it apparently uses a custom format (Which isn't described in the docs)

What format does the 2nd (the regular expression) parameter use?
- Does it have to be enclosed in quotes?
- Does some char needs escaping?

Without this info the documentation is pretty useless IMO.

The documentation says that: "Matches is array of array of string that receives all matched instances, containing substrings by regular expression groups."

To get the length of the matching array I do: "var len = Length(unitMatch);"
which gives me a number back, but how do I access each of the results?

If I try something like:
Code: Select all
       var msg = unitMatch[1];
         alert(msg);

I get an error: "Could not convert variant of type (Null) into type (Integer)"


My actual code:

Code: Select all
    var selection = Editor.SelText; // obtain current text selection
    var regEx = RegexMatchAll(selection, "(\d*\.?\d*)px", true, unitMatch, unitPosition);

    var len = Length(unitMatch);
    Script.Message("Length: " + _t(len) );

    for (var j = 1; j <= len; j++) {
         msg = unitMatch[j]; // Error: Could not convert variant of type (Null) into type (Integer)
   Script.Message("Match: " + _t(msg) );
    }
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 672
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

PreviousNext

Return to Plugins for HTMLPad / Rapid CSS / Rapid PHP / WeBuilder

Who is online

Users browsing this forum: No registered users and 1 guest