iMacros4Firefox Internals: Your own editor

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: iMacros4Firefox Internals: Your own editor

Post by chivracq » Mon Sep 05, 2016 9:11 pm

Hum..., you could elaborate a bit on your Post/Link, I first thought it was Spam as you only post a Link without any Explanation...

And even from checking the Site you refer to, there isn't hardly any Explanation and most of it is in Spanish, even most of your Code contains Names for Vars in Spanish and doesn't contain any Comments, so it's a bit difficult to follow...
credoLAB Laboratorio de MEDIOS de PRUEBA

Scrapping, Data Mining y Bots.
domingo, 28 de agosto de 2016
Imacros4Firefox Internals: The Power of XUL Part I: your own editor

Code: Select all

    /*
    EDITOR INTERNO IMACROS
    XUL-XPCOM MOZILLA
    */


    Components.utils.import("resource://gre/modules/FileUtils.jsm");
    Components.utils.import("resource://gre/modules/Sqlite.jsm")
    Components.utils.import("resource://gre/modules/Services.jsm");




    const CRLF = "\r\n";
    const LF = "\n";

    const cRetLin = DetectaCR();
    const cDetBS =  DetectaBS();
    const cViaDts = getiMacrosFolder("DataSources") ;
    const cViaMac = getiMacrosFolder("Macros");

    const cVersion = "Editor XUL iMacros FIREFOX";

    var _iimTaskDelayObj = null;


    //var ss = require("sdk/simple-storage");


    var cFic = EligeFicDts();
    EditaFichero(cFic);


    function isBlank(str) {
        return (!str || /^\s*$/.test(str));
    }




    function DetectaBS()
    {
    var cBS = "";
    var cNT ="WINNT";

    cBS = "\\";

    var cOpSys = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
    //window.alert(cOpSys);
    if (cOpSys != cNT)
        {  cBS  = "/";  }                       
       
    return cBS;
    }


    function DetectaCR()
    {
    var cCR = "\r\n";
    var cNT ="WINNT";

    var cOpSys = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;

    if (cOpSys != cNT)
        {  cCR  = "\n";  }                       
       
    return cCR;
    }

      function getiMacrosFolder(folderName)
        {
           var pname;
           switch (folderName)
           {
              case "Macros" :
                 pname = "defsavepath";
                 break;
              case "DataSources" :
                 pname = "defdatapath";
                 break;
              case "Downloads" :
                 pname = "defdownpath";
                 break;
              case "Logs" :
                 pname = "deflogpath";
                 break;
              default :
                 throw folderName + " is not a valid iMacros folder name";
                 break;
           }
           return imns.Pref.getFilePref(pname).path;
    }


    function CortaNombre(cFullPath)
    {
    var cFichero = cFullPath.substring( cFullPath.lastIndexOf(cDetBS)+1 );
    return cFichero;
    }



    function EditaFichero(cFichero)
    {

    var oFile = imns.FIO.openNode(cViaDts+cDetBS+cFichero);
    var oEdita = {name: oFile.leafName, path: oFile.path};

    var source_file = imns.FIO.isFullPath(oEdita.path) ?
                imns.FIO.openNode(oEdita.path) :
                imns.FIO.openMacroFile(oEdita.path);

    var param = {name: oEdita.filename,
                 file: source_file,
                 line: 1};

    window.openDialog('chrome://imacros/content/edit.xul','',
                                      'centerscreen,resizable,dialog=yes,modal=yes',
                                      param);



    }
    function EligeFicDts()
    {

    var fp = imns.Cc["@mozilla.org/filepicker;1"]
                    .createInstance(imns.Ci.nsIFilePicker);
                    fp.init(window, "ELIJA FICHERO EDITAR", imns.Ci.nsIFilePicker.modeOpen);

    var oFile = imns.FIO.openNode(cViaDts);
    var cFichero = "email1000a.txt";

         fp.appendFilter("Fichero EDITABLE (*.txt)", "*.txt");
    //   fp.appendFilters(imns.Ci.nsIFilePicker.filterAll);
         fp.filterIndex = 0;
         var rootdir = oFile;
         fp.displayDirectory = rootdir;
         var r = fp.show();
         if(r == imns.Ci.nsIFilePicker.returnOK ||
            r == imns.Ci.nsIFilePicker.returnReplace)
            {
              cFichero = fp.file.path;
              cFichero  = CortaNombre(cFichero);
              //window.alert(cFichero);
            }
    return cFichero;
    }
Publicado por Juan Antonio Espejo González en 5:16
Etiquetas: Firefox, iMacros, scripting, XPCOM, XUL
=> It's not clear to me what "it" is, what "it" does and how to use "it"...?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: iMacros4Firefox Internals: Your own editor

Post by thecoder2012 » Thu Oct 03, 2019 10:51 am

chivracq wrote:
Mon Sep 05, 2016 9:11 pm
And even from checking the Site you refer to, there isn't hardly any Explanation and most of it is in Spanish, even most of your Code contains Names for Vars in Spanish and doesn't contain any Comments, so it's a bit difficult to follow...
Few lines are useless (e.g. sqlite) in the script.
chivracq wrote:
Mon Sep 05, 2016 9:11 pm
=> It's not clear to me what "it" is, what "it" does and how to use "it"...?
File select (*.txt) in your directory "DataSources" => iMacros Editor with your file => editable in the iMacros Editor (as script) or you can use "open" in your iMacros Editor. Same way.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Post Reply