Script in script

  • I covered the suggestion here:

    Apart from above mentioned reasons, I think it would be great feature because you can also set things like:

    • title of article
    • target urls, etc
    • all proxy settings + email settings

    For example if you create profiles, then you would make use of variables like "description100char" "link" "description200char" or even use them couple times. so if you have 5 fields to write contextual text when creating a profile, then you could simply use same spintax over and over (same variable lets say "description100").

    It could all already be set in initilaization project!

    I think its much better than storing data in text files and then creating resource lists every. single. project to retrieve exactly the same data.

    saves a lot of time and mess. also if one day u will want to change something then you simply need to edit ONE initialization project instead of editing lets say 100 projects (profiles, webs, etc)

    Just my little suggestion :)

  • @yourfriendkarol I can share the code I use to do just that:

       var filename;
       var fullPath;
       var fileContents;
       filename = "your_init_script_here.js";
       fullPath = (true ? (directory_of(project_path()) + "/") : "") + filename.replace(/\\/g, "/");
       log('LoadJS: Processing JS file "' + filename + '"' + (true ? ', resolved to path "' + fullPath + '"' : ''));
       fileContents = file_read(fullPath);
       if(fileContents != "") {
           log('LoadJS: Loading OK');
       } else {
           log('LoadJS: ERROR: No such file or file empty');
       /* IMPORTANT: Indirect call to eval() causes execution in global context. */

    You may want to put it inside the "Tools\Execute code" in the beginning of each script, or create a module action to make it neat and tidy.

  • @daemons lol! will try immediately, thank u

    seems great minds think alike

    but it loads .js scripts no? not xml

  • @yourfriendkarol Yes, a Javascript source code file. You can put all settings you need into a nice JS object, say "config":

    var config = {
        // Setting 1
        "setting1": "value1"
        // Setting 2
        ,"setting2": "value2"
        // Setting N
        ,"settingN": "valueN"

    It can be of any structure you require.

    The source file also can define other commonly used variables and functions.

    XML... I don't think you need to bother with that.

Log in to reply