EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     Can we insert the content of a jsee file in a jsee file?
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
nickb
Posted on: 12/14/2008 1:36 pm
Just popping in
Joined: 3/18/2008
From:
Posts: 20
Can we insert the content of a jsee file in a jsee file?
How can we insert the content of standard.jsee in action.jsee at a desired position?
Yutaka
Posted on: 12/15/2008 8:40 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2423
Re: Can we insert the content of a jsee file in a jsee file?
Quote:

nickb wrote:
How can we insert the content of standard.jsee in action.jsee at a desired position?


You can use #include directive, but it must be specified at the first lines of the script above the main code.


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

nickb
Posted on: 12/15/2008 3:04 pm
Just popping in
Joined: 3/18/2008
From:
Posts: 20
Re: Can we insert the content of a jsee file in a jsee file?
Thanks. I have tried '#include "standard.jsee"' and this includes the content of standard.jsee in the file that I'm changing with action.jsee

I added the include at the position where I need the content from action.jsee, so not in at the start of the file. This would run that file before the other lines.

I thought it could work as a php include. As this would be very usefull.

gr.
dreftymac
Posted on: 12/15/2008 5:02 pm
Not too shy to talk
Joined: 10/1/2008
From:
Posts: 39
Re: Can we insert the content of a jsee file in a jsee file?
You can still do what you want if you make sure that standard.jsee encloses its code in a javascript function or a javascript class definition.

For example:

Quote:

function say_hello(name){
return "hello world from " + name + " ! " ;
}
// filename = say_hello.jsee


Quote:

#include "say_hello.jsee"

var name = 'emeditor';
alert(say_hello(name));

name = 'emacs??';
alert(say_hello(name));

name = 'vim??';
alert(say_hello(name));


The #include feature of EmEditor is powerful enough to allow you to 'insert' code wherever you want as long as the code you are 'inserting' is correctly enclosed in a function or class, then you use the function or class to invoke the code you want to run at the exact place where you want to run it.
nickb
Posted on: 12/16/2008 12:41 pm
Just popping in
Joined: 3/18/2008
From:
Posts: 20
Re: Can we insert the content of a jsee file in a jsee file?
Thank you dreftymac for explaining and the example gr.
Threaded | Newest First Previous Topic | Next Topic | Top


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