1. Using properties.ini (I'm using parts of Peter's script for this example). The advantage of this method is that these values can be customized by anyone via Plugin Manager.
Create properties.ini:
Code: Select all
[Properties]
Trigger sequence=string
Trigger on keywords only=check
[Values]
Trigger sequence=/**
Trigger on keywords only=0
[Hints]
Trigger sequence=Keyboard sequence to trigger plugin
Trigger on keywords only=If checked, DocBlock Comment will only be inserted if next line contains a matching keyword.
Reading the setting:
Code: Select all
var triggerCombo = Script.ReadSetting("Trigger sequence", "/**"),
triggerKeywordsOnly = Script.ReadSetting("Trigger on keywords only", "1");
Writing the setting:
Code: Select all
Script.WriteSetting("Trigger sequence", triggerCombo);
Script.WriteSetting("Trigger on keywords only", triggerKeywordsOnly);
2. Using custom ini file:
Code: Select all
function WriteIni(Sender) {
var lastFileName = Document.FileName;
var ini = new TIniFile(Script.Path + "test.ini");
ini.WriteString("My Settings", "Last File", lastFileName);
delete ini;
}
function ReadIni(Sender) {
var ini = new TIniFile(Script.Path + "test.ini");
var fileName = ini.ReadString("My Settings", "Last File", "file not found");
delete ini;
Script.Message(fileName);
}
Script.RegisterAction("", "Test INI Read", "", &ReadIni);
Script.RegisterAction("", "Test INI Write", "", &WriteIni);
You can use this plugin as reference as to what other methods TIniFile combined with its parent TCustomIniFile supports:
http://forums.blumentals.net/viewtopic.php?f=33&t=7407. In most cases Read/WriteString, Read/WriteInteger, Read/WriteBool is enough.