macros – EmEditor (Text Editor) https://www.emeditor.com Best Text Editor, Code Editor, CSV Editor, Large File Viewer for Windows (Free versions available) Sun, 08 Oct 2017 04:13:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 [Ask for help] Filling the selected cells by progressive number in TSV mode https://www.emeditor.com/forums/topic/ask-for-help-filling-the-selected-cells-by-progressive-number-in-tsv-mode/ Sun, 08 Oct 2017 04:13:18 +0000 https://www.emeditor.com/forums/topic/ask-for-help-filling-the-selected-cells-by-progressive-number-in-tsv-mode/ What I want to do is: In TSV mode, if I select 3 cells, I wish to fill the number 1 to first cell, 2 to second and 3 to third…….If more cells are selected, it will increase and fill the number automatically.
I try to use

document.selection.count

to count the selected cells, but it fails to return a number. I also don’t know how to set value for selected cell.

Could you please give me some suggestions? Thanks in advance.

]]>
JSON support for macros would be extremely useful https://www.emeditor.com/forums/topic/json-support-for-macros-would-be-extremely-useful/ Wed, 20 Apr 2016 10:24:38 +0000 https://www.emeditor.com/forums/topic/json-support-for-macros-would-be-extremely-useful/ The brand new EmEditor 15.9 regexp features are very welcome and extremely helpful for making the macro engine lots more powerful!

One more such feature set that is nowadays commonplace and much used in modern “normal Javascript” (in browsers etc) is JSON support. Contrary to what might be the initial reaction, JSON support is extremely well-suited to macros in a text editor like EmEditor, since it very efficiently bridges the gap between textual data and internal-typed data possible to process efficiently with Javascript.

According to this previous thread (https://www.emeditor.com/forums/topic/does-javascript-macros-in-emeditor-only-support-a-subset-of-javascript-standard/), EmEditor does not currently expose the JSON features of modern Javascript versions, but according to this information (https://blogs.msdn.microsoft.com/jscript/2009/04/16/versioning-language-features-in-jscript/) from Microsoft, maybe this would be quite easy to do after all, without even having to use any non-Javascript library for it (which there absolutely exists good ones for too by the way, just like the ones you used for the regular expressions support!)?

Either way, the two core functions of the Javascript JSON capabilities that would be extremely useful to have in EmEditor macros are the JSON.parse() and JSON.stringify() methods, which, respectively, imports textual-only data to internal-type Javascript data, and exports it back to textual form once ready-processed.

I really hope that you would consider adding support for these JSON methods in the EmEditor macro engine, just like you just added regexp support in 15.9!

If the recently added regexp support in EmEditor 15.9 just doubled the usefulness of EmEditor macros, adding JSON support would (at least) double it again, I’d say!

]]>
Does Javascript macros in EmEditor only support a subset of Javascript standard? https://www.emeditor.com/forums/topic/does-javascript-macros-in-emeditor-only-support-a-subset-of-javascript-standard/ Mon, 14 Mar 2016 21:21:13 +0000 https://www.emeditor.com/forums/topic/does-javascript-macros-in-emeditor-only-support-a-subset-of-javascript-standard/ I’m trying to implement a JSON-beautifier in an EmEditor macro, but when I attempt to use for example the JSON.parse() method (which is part of the Javascript specification), I only get the following error message:
——————————
‘JSON’ is undefined
——————————
Does Javascript macros in EmEditor only support a subset of Javascript standard, and in that case which parts?

Here is a link to the part of the Javascript reference that documents the build-in JSON object:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON

]]>