Forum Replies Created
- AuthorPosts
- StefanParticipant
Hi TransUA,
to sort the lines alphabetically from A to Z, you can utilize the build-in functions from the Edit menu.
–To randomly shuffle the lines, this basic JavaScript functions should work:
//Randomly shuffle lines
//1.) select some text. 2.) execute this JavaScript macro. 3.) Done!
strSelText = document.selection.Text;
strLinebreak = “\r\n”;
arrLinesArray = strSelText.split(strLinebreak);
arrLinesArray.sort(function random(){return 0.5 – Math.random()});
arrOut = arrLinesArray.join(strLinebreak);
document.selection.Text = arrOut;Store that above as shuffle.jsee into the EmEditor folder and load it via menu Macros > Select…
Next select your text to shuffle and execute Macros > shuffle.jseeNote:
you can find discussions about “better” or faster sort algorithms in the net and exchange my random function by another one.HTH?
StefanParticipantAdd
eeFindReplaceOnlyWord
.
October 31, 2013 at 1:36 am in reply to: QueryStatusByID method not working for EEID_FINDBAR_INCREMENTAL (4571) #17412StefanParticipantAnd BTW, this too doesn’t work for me:
//Sets the focus to the Find toolbar editor.ExecuteCommandByID(4565);
The focus is still on document.
Sets the focus to the Find toolbar works for me only
– by utilizing a keyboard shortcut or
– by All Commands: Search > Set Focus to Find ToolbarTested with 13.0.6 portable
.
October 31, 2013 at 12:55 am in reply to: QueryStatusByID method not working for EEID_FINDBAR_INCREMENTAL (4571) #17411StefanParticipantBut I get always a “2” for eeStatus, no matter if the button is in pressed state or not? :confused:
Test:
editor.ExecuteCommandByID(4571); //Toggles the Incremental Search BUTTON on the Find toolbar var eeStatus = editor.QueryStatusByID(4571); alert("eeStatus: " + eeStatus); // 2 alert("eeStatusLatched: " + eeStatusLatched ); // 4 alert("eeStatusEnabled: " + eeStatusEnabled ); // 2
The toggle command “4571” works, but we can’t get the state of that button back with QueryStatusByID().
Me think, “4571” is not the ID of that button itself, but just the ID of the toggle command.
So to answer your question beforehand, I have no glue if this increment search button itself has a own ID to get its state..
October 31, 2013 at 12:17 am in reply to: QueryStatusByID method not working for EEID_FINDBAR_INCREMENTAL (4571) #17410StefanParticipant“EEID_FINDBAR_INCREMENTAL” is not a ID, but a string, the name of that command.
The ID is 4571
See EmEditor Help – Command Reference – Search category
Incremental Search (Find toolbar) command
Toggles the Incremental Search button on the Find toolbar.
Toggles the Incremental Search button on the Find toolbar. When Incremental Search is activated,
EmEditor will search and highlight results as the user types.How to Run
Default Menu: None
All Commands: Search > Find Toolbar > Incremental Search
Toolbar: None
Status Bar: None
Default Shortcut Key: None
Plug-in Command ID
EEID_FINDBAR_INCREMENTAL (4571)
Macros
[JavaScript]
editor.ExecuteCommandByID(4571);Also take a look in the help for EmEditor Macro Reference – Editor Object > QueryStatusByID Method
Retrieves the current status of the specified command, whether it is enabled and checked.
[JavaScript]
nStatus = editor.QueryStatusByID( nID );Parameters
nID
Specifies an integer indicating the Command ID to execute.
See the Command Reference for the list of available commands.Return Values
Returns a combination of the following values.
eeStatusEnabled The command is enabled.
eeStatusLatched The command is checked..
StefanParticipantYutaka wrote:
Please see EmEditor Professional v13 New Features.
http://www.emeditor.com/modules/feature1/rewrite/tc_41.htmlFor your information, that page can now be found here:
http://www.emeditor.com/text-editor-features/history/new-in-version-13/Feedback:
That multiple selection editing if often useful to select several lines between other, unimportant lines, like here:HKLM\SOFTWARE\Microsoft\Uninstall\{D95297092}\Version=””
HKLM\SOFTWARE\Microsoft\Uninstall\{D95297092}\Language=””
HKLM\SOFTWARE\Microsoft\Uninstall\{D95297092}\DisplayName=”Registration Wizard”
HKLM\SOFTWARE\Microsoft\Uninstall\{C24F6BA0}\Version=””
HKLM\SOFTWARE\Microsoft\Uninstall\{C24F6BA0}\Language=””
HKLM\SOFTWARE\Microsoft\Uninstall\{C24F6BA0}\DisplayName=”MoS 4.6.2″
HKLM\SOFTWARE\Microsoft\Uninstall\{DE2D4A5E4}\Language=””
HKLM\SOFTWARE\Microsoft\Uninstall\{F055B0A4C}\Version=””
HKLM\SOFTWARE\Microsoft\Uninstall\{F055B0A4C}\DisplayName=”Vun 9.0 Run-Time Engine”Great.
Idea:
But now I see I can not remove mistakenly made selections, this feature is only for adding another selection.
So, while you are working on this, perhaps you can add a feature to remove individual selection. e.g. by holding the CTRL-key and clicking on an selection?Another idea:
Imagine I would select “DisplayName” in one line and press CTRL+SHIFT+A) to select all the occurrences,
next I wanted to extend all selection to select the whole lines where a selection is made.
Can there be a option to get this working? Ctrl+F8 works only for the current line.
Maybe there is a change to improve that Ctrl+F8 feature to work on all lines with an selection?Thanks for making EmEditor.
StefanParticipantGreat!
That “Enhanced Multiple Selections – allows you to move multiple cursors more freely”
seems to provide even more functionality than I had dreamed off. :thumpsup:Moving multiple cursors around to another place needed modification is very nifty. Good work!
Thank you for making EmEditor.
StefanParticipantHi Yutaka
Please consider to add a “Restore last Selection” option.
I think about a setting/option like “[X] Remember Selection” and a menu entry “Restore last Selection” .EmEditor should remember always each made selection for each open document, as long as there is no other selection made, or the editor is closed.
I could need that often after an operation who has destroyed my selection to just redo the selection.
Thanks for making EmEditor.
StefanParticipant.
Show Marks (Space Tabs EOL) in Selection onlyI just realized that we can do that already at our own:
1.) Enable all (or the wanted) whitespace marks from menu “View > Marks”
2.) Go to menu “Tools > Properties for xxx Configuration”
3.) Click the [Display] tab and select “Returns, tabs, EOL”
4.) choose Text Color > Custom and set it to white
(or to your chosen background color, if not default), (of course you could also set the color to a light grey for example)
5.) close the dialog with the [OK] button
Done.Now the marks are invisible on normal work, but visible on selection only.
To reset to default, just go to that setting dialog from step 4) again and click at [Default] instead.
Thanks for making EmEditor.
StefanParticipant.
5. Ctrl-A to Select All, then type “c”
6. Notice the Status bar now shows “CR+LF (Windows)” <– Problem hereThe Status bar now shows “CR+LF (Windows)” .
For me only if working on the first line.
And only until I press Enter one time after the ‘c’, then it switch to “LF Only (UNIX)”Tested with 13.0.5 portable.
The “Tools > Customize… > Status > Return Method” has nothing to do with this situation at all as it seems.
Maybe I just don’t get it right. Please wait for Yutaka.
.
StefanParticipantHi atnak.
I don’t know details, but perhaps check out if this help entry will solve your issue:
EmEditor Help – Dialog Boxes – Configuration Properties > General tab
Preserve (CR/LF) returns on Clipboard check box
If this box is checked, the return methods will be preserved at copy and paste.
For instance, the LF only returns will be copied and pasted to another location with LF only returns..
StefanParticipantUpps, now the Edit “button” is missed from my post?!? So I post a new one:
Little problem:
If I click at a number link to go to the next page of Recent Topics, I am at the top of the forum side and have to scroll down to the Recent Topics list.Suggestion:
have an anchor at the top of the Recent Topics list and jump to that link, so I can start reading at the next page, without scrolling first..
StefanParticipantThanks for bringing back big “Recent Topics” list!
I hope you have planed to add “Last post at %date% %time% by %user%” behind each topic of the Recent Topics list too.
.
StefanParticipantGood example of utilizing “OutputBar”, thanks.
If you are interested, you can modify your script with some details like shown here:
// do not update the screen during our work: Redraw = false; // get and store current cursor position: yPos = document.selection.GetActivePointY( eePosLogical ); xPos = document.selection.GetActivePointX( eePosLogical ); // ask the user: var strAnswer = prompt( "find what ?", "\\w+" ); // do the work; search for occurrences: var count=0; while ( document.selection.Find( strAnswer, eeFindNext | eeFindReplaceRegExp) ) { count++; } // provide the result to the output bar: OutputBar.Clear(); OutputBar.writeln( "find count for \"" + strAnswer + '\" after column ' + xPos + ' of row ' + yPos + ': ' + count ); OutputBar.Visible = true; OutputBar.SetFocus(); // erase search highlighting: document.HighlightFind = false; // go back to origin cursor position: document.selection.SetActivePoint( eePosLogical, xPos, yPos, false );
Keep up! ;-)
StefanParticipantYou may want to try this script on COPIES of your srt subtitles files.
1.) save this script as a textfile with JS extension or as a snippet to the snippet plugin.
2.) load your srt file
3.) execute that script one time for every line to modify. The script will tell you if nothing more is found.If this works and you have saved this script to a file, you can utilize menu “Macros > Run wit temporary Options…” to let it run more than one time at once.
This script will:
1.) Find line with leading dd:dd:dd,ddd
2.) Check if last non-blank sign of next line is a dot
3.) If not empty, get content of next line
4.) If dot was found above; replace first char to upper case, else to lower caseRedraw = false; //we use a RegEx search pattern to match first time from strings like: "00:02:59,203 –> 00:03:01,906" foundcount = document.selection.Find("^\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s",eeFindNext | eeFindReplaceRegExp); if(foundcount){ //if line starts with something like "00:02:59,203 ", then go one line down: document.selection.LineDown( ); //get the last sign of thatline: LineContent = document.GetLine( document.selection.GetActivePointY(eePosLogical) ); LineContent = LineContent.replace(/\s+$/,""); LastSign = LineContent.slice(-1); //go again one line down: document.selection.LineDown( ); yPos = document.selection.GetActivePointY( eePosLogical ); LineContent = document.GetLine( yPos ); //if that line is not empty ("If a row of subtitle have 2 lines"): if(LineContent.length > 0){ //if the last sign was a dot: if(LastSign=="."){ //be sure first char is upper case: OUT = LineContent.slice(0,1).toUpperCase() + LineContent.slice(1); }else{ //be sure first char is lower case: OUT = LineContent.slice(0,1).toLowerCase()+ LineContent.slice(1); } //replace origin line content: document.selection.SelectLine(); document.selection.text = OUT + "\n"; } } else alert("Search pattern not found."); document.HighlightFind = false;
HTH?
StefanParticipantNew Forum 2013: now at last some more details for ‘Recent Topics’ overview added, great improvement, thanks!
.
StefanParticipantif I do a search for,
<br in.*>
it should just grab the tag <br indentlevel…> correct?
Well, it is grabbing everything all the way to the end of line and leave the last tag there.
Any thoughts on this one? Thanks.Please note that regex multiplier like plus and star works greedy in mostly every regex engine, so here too.
Use the non-greedy , frugal switch ‘?‘ to get what you are after:
<br in.*?>
.
StefanParticipant;-) Sounds like you would need “Bey0nd C0mpare” fr0m Sc00ter S0ftware
.
StefanParticipantYou can utilize “Tools > Properties for xyz > [Auto Save] >> Auto Save [ 1] Minutes”
Additionally you can write a macro to save your document, and launch that macro at an event:
Select Events :
** Cursor Moved
** Changed
** Character Inserted
** Group Window Closed
** Configuration Changed
** Group Window Created
** Document Closed
** Active Document Changed
** File Opened
** Idle
** Focus Lost
** Modified or Unmodified
** Tab Moved
** Scrolled
** Selection Changed
** Focus Set
** Before Saving
** File Dropped.
StefanParticipantAFAIK there is no such customizing possible.
But you can add “Save as…” to the context menu of the document window:
Tools > Customize Menus… > Context Menu >> Insert Below >> File || Save As
.
StefanParticipant>>> In the drop-down menu, how can I see line contents instead of line numbers?
To see line numbers and line contents, change this on the code:
FROM:
s = “Line ” + n;
TO:
L = document.GetLine(n); //line content
L = L.substring(0,80); //shorten content
s = “Line ” + n + “: ” + L;.
.
Here is a slightly altered code from me:
CurrentLine = document.selection.GetActivePointY( eePosLogical ); menu = CreatePopupMenu(); count = 0; document.selection.SetActivePoint( eePosLogical, 1, 2 ); if (document.selection.PreviousBookmark()){ AddToList(); } while( document.selection.NextBookmark() ){ AddToList(); count++; if (count > 20) break;} function AddToList(){ n = document.selection.GetActivePointY( eePosLogical ); L = document.GetLine(n); //line content L = L.substring(0,80); //shorten content s = "Line " + n + ": " + L; menu.Add( s, n ); } //back to that line where this script was executed: document.selection.SetActivePoint( eePosLogical, 1, CurrentLine ); //show bookmarks list: result = menu.Track( 0 ); if( result > 0 ) { document.selection.SetActivePoint( eePosLogical, 1, result ); }
June 25, 2013 at 10:39 am in reply to: is there a way to have new windows instead of new tabs? #11188StefanParticipant.
If you have at least two files open
you can create a new EmEditor window
(called here “Group”) in several ways:– drag&drop one document tab outside
– right click the document tab > “New Group”
– press Alt+Strg+N
– utilize the Window menu>>I want to have two txt files side by side.
Then best for you would be Window menu “New [Hor|Vert] Group”.
StefanParticipant
Posted by Yutaka on 6/11/2013 10:16:50 pm
Today, we are releasing EmEditor Professional v13.0.0.
http://www.emeditor.com/modules/news/article.php?storyid=135WOW, first Black Sabbath 13, now EmEditor 13.
Thank you! どうもありがとうございました
This is for you Yutaka > http://www.youtube.com/watch?v=mgAKyWU77iA
.StefanParticipant
Works!Upgraded from v12 during all v13-betas
till to RC1 with new key without any problem.(Win7 32+64, 32-bit portable)
Thank you.
StefanParticipant
Just right click the Ruler:The same is available from the context menu while right clicking a column.
Or check out “Edit menu > Separated Values/Sort…”Learn more about CSV, TSV, and DSV mode at this video:
http://www.youtube.com/watch?v=ALJOqOh7_9g - AuthorPosts