Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6751
    nickb
    Member

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

    #6755
    Yutaka Emura
    Keymaster

    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.

    #6761
    nickb
    Member

    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.

    #6765
    dreftymac
    Participant

    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:

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

    #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.

    #6771
    nickb
    Member

    Thank you dreftymac for explaining and the example :-) gr.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.