EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     How to set configuration properties in a macro
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
dw7832
Posted on: 9/14/2009 7:48 am
Not too shy to talk
Joined: 6/28/2009
From:
Posts: 27
How to set configuration properties in a macro
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.
Yutaka
Posted on: 9/14/2009 3:49 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2404
Re: How to set configuration properties in a macro
Quote:

dw7832 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();


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Dino
Posted on: 9/18/2009 10:23 pm
Just popping in
Joined: 9/18/2009
From:
Posts: 1
Re: How to set configuration properties in a macro
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.

Yutaka
Posted on: 9/19/2009 8:04 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2404
Re: How to set configuration properties in a macro
Quote:

Dino 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!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

derekcohen
Posted on: 5/24/2010 10:05 pm
Not too shy to talk
Joined: 5/22/2010
From:
Posts: 38
Re: How to set configuration properties in a macro
Can we have a button to toggle line numbers on and off?
Yutaka
Posted on: 5/24/2010 10:25 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2404
Re: How to set configuration properties in a macro
Hello derekcohen,

Yes, it is included in v10 RC.


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

derekcohen
Posted on: 8/16/2010 11:53 pm
Not too shy to talk
Joined: 5/22/2010
From:
Posts: 38
Re: How to set configuration properties in a macro
can I have a macro to toggle word wrap between none and window (ie between Control+1 and Control+3)?

thanks

Derek
Yutaka
Posted on: 8/19/2010 10:09 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2404
Re: How to set configuration properties in a macro
Hello 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
}


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

derekcohen
Posted on: 8/22/2010 1:30 am
Not too shy to talk
Joined: 5/22/2010
From:
Posts: 38
Re: How to set configuration properties in a macro
thanks
Yutaka
Posted on: 8/22/2010 9:04 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2404
Re: How to set configuration properties in a macro
You are welcome!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文