Forum Replies Created
- AuthorPosts
Patrick C
ParticipantWith
\r = carriage return = CR
\n = line feed = LFNew line characters across different operating systems:
All Linux / Unix: Newline = line feed = LF = \n
Old Mac OS: Newline = carriage return = CR = \r
Modern Mac OS: Newline = line feed = LF = \n
Windows & MS-DOS: Newline = carriage return followed by line feed = CR+LF = \r\n
Modern Windows: Newline = carriage return followed by line feed = CR+LF= \r\n
↳ However, as of 2024 Windows applications are increasingly capable of dealing with LF only line terminators (even Notepad).Many tools, EmEditor included, can be configured to let \n detect all newline characters, regardless of type LF, CR+LF or CR.
I.e. you can stick to \n without having to bother about what the current file’s line terminator is.Should you want to use \r\n:
In the find dialogue: ClickAdvanced...
→Treat CR and LF separately
Advanced dialog box → Treat CR and LF Separately check boxPatrick C
ParticipantThe VBScript Command is
editor.ExecuteCommandByID 3916
EmEditor Help: Negative (Filter Toolbar) command——————————————————————-
The JavaScript above expressed as VBScript is#title = "Set the negative filter flag to inactive" #language = "VBScript" #async = "off" ' get the filter toolbar’s negative status (id 3916) Dim negFilterStatus negFilterStatus = editor.QueryStatusByID(3916) ' if negative is enabled -> disable by toggling If ((negFilterStatus And eeStatusLatched) = eeStatusLatched) Then ' case negative is enabled → run the toggle command editor.ExecuteCommandByID 3916 End If
——————————————————————-
VBScript code to set all filters to 0 is (its ugly, couldn`t think of something better):#title = "Set the negative filter flag to inactive" #language = "VBScript" #async = "off" ' reset the filters list Dim filtersList Set filtersList = document.filters filtersList.Clear filtersList.Add "dummy", False, 0, 0 ' add a single item with all flags set to 0 (off) document.filters = filtersList ' apply the filter → flags are now 0 filtersList.Clear ' remove the filter again (removes ‘dummy’) document.filters = filtersList ' empty filter + the flags stay as they are
——————————————————————-
Note that VBScript is deprecated.Patrick C
ParticipantCorrection: One must test for eeStatusLatched.
#title = "Set the negative filter flag to inactive" #language = "V8" #async = "off" // get the filter toolbar’s negative status (id 3916) let negFilterStatus = editor.QueryStatusByID(3916); // if negative is enabled → disable by toggling if ((negFilterStatus & eeStatusLatched) === eeStatusLatched ) { // case negative is enabled → run the toggle command editor.ExecuteCommandByID(3916); }
EmEditor Help: Negative (Filter Toolbar) command
EmEditor Help: QueryStatusByID MethodRegarding
(negFilterStatus & eeStatusLatched) === eeStatusLatched
EmEditor uses bitwise flags for statuses. The & is a bitwise and.Patrick C
Participant#title = "Set the negative filter flag to inactive" #language = "V8" #async = "off" // get the filter toolbar’s negative status (id 3916) let negFilterStatus = editor.QueryStatusByID(3916); // if negative is enabled → disable by toggling if ((negFilterStatus & eeStatusEnabled) === eeStatusEnabled) { // case negative is enabled → run the toggle command editor.ExecuteCommandByID(3916); }
EmEditor Help: Negative (Filter Toolbar) command
EmEditor Help: QueryStatusByID MethodRegarding
(negFilterStatus & eeStatusEnabled) === eeStatusEnabled
:
EmEditor uses bitwise flags for statuses. The&
is a bitwise and.Patrick C
ParticipantAutosave:
Save the document automatically at specified time intervals.
EmEditor Help: AutosaveBackup:
When saving existing files, save the original files into the folder specified in the Backup Folder text box.
EmEditor Help: Backup
→ Basically saves a backup copy of the old version on each save. To be truly useful the Rename if the Same File Name Exists check box should also be activated.Patrick C
ParticipantIs there a way to run a macro from a custom menu?
Are you referring to a custom menu bar entry (Tools → Customise Menus)?If yes: In my case this works. I can, for example, add
“M&y Custom Date” to the Insert menu and associate it with “My Macros → MyCustomDateMacro.jsee”Inserting MyDate then is possible via
Alt+I YPatrick C
ParticipantI just realised that this also allows querying the Num, Caps and Scroll lock states 🙂🙃😃
let iScrollState = 0; iScrollState = shell.GetKeyState(0x91); if(iScrollState === 1) { alert("Scroll Lock is enabled"); } else if(iScrollState === 0 ) { alert("Scroll Lock is disabled"); } else if(iScrollState === -127) { alert("Scroll Lock is enabled and its key is down, i.e. pressed"); } else if(iScrollState === -128) { alert("Scroll Lock is disabled and its key is down, i.e. pressed"); } else { alert("Unexpected Scroll Lock state:" + iScrollState); }
🙏 🙇
Patrick C
ParticipantI once had a similar problem and resorted to PowerShell:
Get-Content .\my_UTF8_file.txt | Set-Content -Encoding utf32 my_UTF32_file.txt
or
Get-Content .\my_UTF16_file.txt | Set-Content -Encoding utf32 my_UTF32_file.txt
Kudos to https://superuser.com/questions/1163753/converting-text-file-to-utf-8-on-windows-command-prompt
+ reference https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-content?view=powershell-7.4#-encodingPatrick C
ParticipantExample code (formatted version):
#title = "URL open or select" #icon = "C:\\Windows\\System32\\shell32.dll",135 #tooltip = "URL open or select" #language = "V8" #async = "off" // Self test: https://www.emeditor.com/ // Issue with control + single click: https://www.emeditor.com/forums/topic/control-click-triggers-double-click/ // PC, Version 1.0 "use strict"; bCtrlDown = shell.GetKeyState( 0x11 ) < 0; if( bCtrlDown ) { // OutputBar.writeln( '"'.concat(document.selection.Text, '"') ); shell.Run( "c:\\Program Files\\Vivaldi\\Application\\vivaldi.exe", 1, false, '"'.concat(document.selection.Text, '"') ); document.selection.Collapse(); }
Patrick C
ParticipantIn case someone runs into an error when installing EmEditor`s local help emed_help_en_24.2.0.msi (https://www.emeditor.com/download-help/):
I did first uninstall the old help. Nonetheless the error remained.
Solution:
Remove all remaining files in
c:\ProgramData\Emurasoft\EmEditor\Help\Patrick C
ParticipantOh thank you Yutaka 😃, I`m super grateful for this and for EmEditor as a whole – best text editor ever 😃 🙏 🙇
Patrick C
ParticipantThanks!
My only use would be the Active String ctrl modifier, just in case that’s easier.
But anyway, adding the modifiers just a suggestion, if you can add it: Great. If not: I’ll be fine and appreciate all the other features that are added instead.Patrick C
ParticipantRegarding the macro: I`m currently stuck with the condition on the pressed shift / alt / ctrl key.
See: https://www.emeditor.com/forums/topic/modifier-key-ctrl-alt-shift-is-was-pressed/Patrick C
ParticipantOk I’ll try to write a Macro sometime this week and will post it here.
Many thanks for considering!Patrick C
ParticipantIn my case it works fine.
Copy / pasting outputted
E:\ProgDB\EmEditor\Macros\Toggle_read_only.jsee \t 0x00000000 E:\ProgDB\EmEditor\Macros\insert_date_only.jsee \t 0x00000000 E:\ProgDB\EmEditor\Macros\insert_date_time.jsee \t 0x00000000 E:\ProgDB\EmEditor\Macros\insert_date_long_time.jsee \t 0x00000000 E:\ProgDB\EmEditor\Macros\delete_between_bookmarks.jsee \t 0x00000000
Where \t is the tab character.
It looks like the \t and 0x00000000 can be omitted from the list.
Pasting allows me to run the Macro, but when trying to edit them I get your “The following files do not exist error”. → Restarting EmEditor fixes this.Patrick C
ParticipantThough just noticed a shortcoming: Macro shortcuts are not or only partially preserved 😐
Patrick C
ParticipantWow, this is ultra-useful for me because sometimes my Macros end up in a mess and this makes cleaning up a whole lot easier 😃
Many thanks to spiros for asking the question and Yutaka for answering it!
Patrick C
ParticipantGlad I could help 😀
Thanks for the feedback!Patrick C
ParticipantI use the following .jsee macro, perhaps it helps (you could assign ctrl+shift+. to the macro, I use ctrl+D, which works reliably).
var date = new Date(); var dd = date.getDate(); // returns the day of the month (from 1 to 31) if( dd < 10 ) dd = "0" + dd; var MM = date.getMonth() + 1; // returns the month (from 0 to 11)! if( MM < 10 ) MM = "0" + MM; var yyyy = date.getFullYear(); // Returns the year (4 digits) // “Output” document.write( yyyy + "-" + MM + "-" + dd);
Patrick C
ParticipantI’ve got an old script that gets close, perhaps it helps.
// Inspired by & resources // https://www.emeditor.com/forums/topic/option-to-adjust-the-datetime-format-edit-insert-time-and-date/ // https://www.emeditor.com/forums/topic/insert-long-date/ // https://www.w3schools.com/jsref/jsref_tolocaledatestring.asp + jsref_getmonth.asp + jsref_getdate.asp function return_date_long_time() { var date = new Date(); // var n = d.toLocaleDateString(); // old approach - unreliable // Date assembly var dd = date.getDate(); // returns the day of the month (from 1 to 31) if( dd < 10 ) dd = "0" + dd; var MM = date.getMonth() + 1; // returns the month (from 0 to 11)! if( MM < 10 ) MM = "0" + MM; var yyyy = date.getFullYear(); // Returns the year (4 digits) // time assembly var hh = date.getHours(); // Returns the hour (from 0-23) if( hh < 10 ) hh = "0" + hh; var mm = date.getMinutes(); // Returns the minutes (from 0-59) if( mm < 10 ) mm = "0" + mm; var ss = date.getSeconds(); // Returns the seconds (from 0-59) if( ss < 10 ) ss = "0" + ss; // “Output” return( yyyy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss ); } document.write( return_date_long_time() );
Patrick C
ParticipantSorry, not done yet.
The cursor’s colour is set analogously by the “Selection” property (second entry from top on my installation).Patrick C
ParticipantMenu bar:
Tools → Properties for all Configurations → Display → Scroll way down and select “Search string” → Select the […] located next to the background colour combobox.Cheers
PatrickPatrick C
ParticipantYes, its displayed on bottom left part of the status bar:
Menu Bar → View → Status barThe only annoying thing is that the Find/Replace dialogue will not show you the number of found strings, but it will show the number of replaced strings.
In contrast the Find (without replace) dialogue allows you to count the number of finds.*) I’ll ask Yutaka if he could add the find dialogue’s count matches tickbox to the replace dialogue.
May 28, 2022 at 1:09 am in reply to: crashes on lowercase / uppercase when the selection exceeds the line’s end #28211Patrick C
ParticipantHello Yutaka
Version 21.7.910
Does not crash 😀Version 21.7.1
Crashes 🙁Looking forward to the next non beta update.
Many thanks!
May 27, 2022 at 6:16 am in reply to: crashes on lowercase / uppercase when the selection exceeds the line’s end #28208Patrick C
ParticipantVersion 21.7.1
with ↵ denoting a new line:
foo bar↵ FOOs BARs↵ Foo Bar↵
In the above: select the block containing
bar
BARs
Bartry to change the case, e.g. lowercase
EmEditor will crash
- AuthorPosts