- AuthorPosts
- September 14, 2009 at 3:48 pm #7638dw7832Participant
I’m currently struggling to set the properties of the active configuration of a file in a macro:
// toggle show spaces
if (document.Config.Mark.ShowSpaces) {
document.Config.Mark.ShowSpaces = false;
} else {
document.Config.Mark.ShowSpaces = true;
}and
with (document.Config.Indent) {
TabColumns = 4;
InsertSpaces = true;
WrapIndent = true; }
document.Config.Save();Neither of these give an error message but when alert()-ing the properties they are not changed nor does EmEditor act like they’ve changed. Can anybody shed any light?
Thank you in advance.
September 14, 2009 at 11:49 pm #7639Yutaka EmuraKeymasterdw7832 wrote:
I’m currently struggling to set the properties of the active configuration of a file in a macro:// toggle show spaces
if (document.Config.Mark.ShowSpaces) {
document.Config.Mark.ShowSpaces = false;
} else {
document.Config.Mark.ShowSpaces = true;
}and
with (document.Config.Indent) {
TabColumns = 4;
InsertSpaces = true;
WrapIndent = true; }
document.Config.Save();Neither of these give an error message but when alert()-ing the properties they are not changed nor does EmEditor act like they’ve changed. Can anybody shed any light?
Thank you in advance.
Please try this way:
cfg = document.Config;
if (cfg.Mark.ShowSpaces) {
cfg.Mark.ShowSpaces = false;
} else {
cfg.Mark.ShowSpaces = true;
}
cfg.Save();
September 19, 2009 at 6:23 am #7651DinoParticipantThanks, this works. A bit slow, however. I personally think this “show spaces” should be triggered by the Marks button. All these “marks” are also customized in one place, why aren’t they shown in one place? In many editors showing line breaks and spaces is done by the same button.
September 19, 2009 at 4:04 pm #7654Yutaka EmuraKeymasterDino wrote:
Thanks, this works. A bit slow, however. I personally think this “show spaces” should be triggered by the Marks button. All these “marks” are also customized in one place, why aren’t they shown in one place? In many editors showing line breaks and spaces is done by the same button.I will consider the option to customize which marks can be trigerred by the button. Thanks!
May 25, 2010 at 6:05 am #8516derekcohenParticipantCan we have a button to toggle line numbers on and off?
May 25, 2010 at 6:25 am #8517Yutaka EmuraKeymasterHello derekcohen,
Yes, it is included in v10 RC.
August 17, 2010 at 7:53 am #8846derekcohenParticipantcan I have a macro to toggle word wrap between none and window (ie between Control+1 and Control+3)?
thanks
Derek
August 19, 2010 at 6:09 pm #8853Yutaka EmuraKeymasterHello Derek,
Here is the macro to toggle between no wrap and wrap by window.
if( editor.QueryStatusByID( 4210 ) & eeStatusLatched ){
editor.ExecuteCommandByID( 4208 ); // no wrap
}
else {
editor.ExecuteCommandByID( 4210 ); // by window
}
August 22, 2010 at 9:30 am #8860derekcohenParticipantthanks
August 22, 2010 at 5:04 pm #8862Yutaka EmuraKeymasterYou are welcome!
- AuthorPosts
- You must be logged in to reply to this topic.