Forum Replies Created
- AuthorPosts
- StefanParticipant
Note, with last beta
“Head-start version: EmEditor Professional v11.1.6 beta”you can also use:
* Find: [ pattern ] with [Bookmark all]
* “Invert Bookmarks in This Group”
* “Delete Bookmarked Lines in This Group”StefanParticipantuser> what’s next?
??
* Save this script/macro to an text file with VBS or VBEE extension.
(please save it again, i have edited an comment failure in the meantime)* Macros > Select this (means the current open macro file)
or use
* Macros > Select… >>> choose the macro* Open your text file to edit.
* Select an paragraph or the whole text (Ctrl+a)* Execute the macro: Macros > Run myMacro.vbs
??
EmEditor Help > EmEditor Macro Reference > Tutorial > Run Macro
StefanParticipantDelete Lines NOT containing STRING
#language = "VBScript"
FileText = document.selection.Text
If FileText = "" Then
alert "Nothing selected?" & vbCRLF _
& "This script works with selected text only."
Quit
End If
PromptText = "Remove lines containing this search string"
searchStr = prompt(PromptText, "")
If searchStr = "" Then Quit
Lines = Split(fileText, vbCRLF)
For each line in Lines
funcRegEx searchStr, line
'//FALSE = line not contains search pattern
'//TRUE = line contains the search pattern
If funcRegExReturn = FALSE Then
resultText = resultText + line + vbCRLF
End If
Next
'editor.NewFile()
document.writeln(resultText)
Function funcRegEx(needle, haystack)
funcRegExReturn = FALSE
Set regEx = New RegExp
regEx.Pattern = needle
regEx.IgnoreCase = True
regEx.Global = True
If regEx.Test(haystack) Then
funcRegExReturn = TRUE
End If
End FunctionStefanParticipantThis is how i see it. Don’t know if i am 100\% correct.
n
“n” are RegEx METACHARs from the old UNIX days with his SED and GREP tools.
“1” e.g. will give back what is matched by the expression
enclosed in the first set of parentheses (counted from the left)“n” are used for a backreference within an search pattern.
E.g. to match double chars like “(.)1” to match “support”.
That way the search pattern is extended by the way
with the match of the expression to find it two times.“n” can also be used to refer to an match in the find
AFTER it is done, for an use in the replacement like
Find: “(d)” Replace: “the number is 1”$n
“$n” OTOH was introduced by Perl and is an VARIABLE
which holds the match of an expression after the find is done.
“$n” can be seen here as an synonym of “n”. But only in the replacement.Recapitulation
This days it seems to depend of the used regex engine (or maybe on the coder of the app?)
which flavor is used to represents an backreference
in the REPLACEMENT: 1 or $1 can be used.But for the backreference in the SEARCH string i think always 1 is used.
It seams EmEditor (using the Boost library) does the same.
1 is allowed in the FIND only (no $1 here)
but 1 AND $1 are both allowed in the replacement field..
StefanParticipantThat’s not possible. You have to change your how-to.
Use a more granular expression to capture the text and the digit into two separate capture groups.
Then you have the possibilities on the replacement as you want.StefanParticipantJust browse the Library here on the right side…
StefanParticipant1b. is implemented now too:
Posted on: 3/8/2012 12:55 am
Head-start version: EmEditor Professional v11.1.3 beta
– (Snippets plug-in) Drag and drop on the Snippet tree
while pressing the CTRL key can copy items now.Thank you Yutaka.
March 11, 2012 at 9:50 am in reply to: Snippet: drag&drop lines to new item, limit "Name" length #10161StefanParticipantStefan wrote:
Drag&Drop leads to an empty snippet for me ?!
emed32_11.1.2_beta.exe on XP SP3
D&D works again as intended
and the [Name: ] -string is cut down now as suggested at 80 signs
with:Posted on: 3/8/2012 12:55 am
Head-start version: EmEditor Professional v11.1.3 betaThank you!
March 4, 2012 at 3:01 pm in reply to: Snippet: drag&drop lines to new item, limit "Name" length #10118StefanParticipantDrag&Drop leads to an empty snippet for me ?!
emed32_11.1.2_beta.exe on XP SP3
I installed emed32_11.1.2_beta.exe
and then chose import/export to ini.Then enabled snippet plugin
and drag a few selected lines to the snippets
and as result i got an new item symbol
but without any text/content.Today, (2/28/2012) we are releasing EmEditor Professional v11.1.0 beta.
Updates from v11.0.5 include:
NEW FEATURES– (Snippets plug-in) The title of a snippet is now automatically cut off at 79 characters long when text is imported by drag-and-drop from the text area or another application.
StefanParticipant1a. is done for single selected item or folder.
Selecting more then one item/folder is not possible.1b. is not implemented
Thank you Yutaka.
Today, (2/28/2012) we are releasing EmEditor Professional v11.1.0 beta.
Updates from v11.0.5 include:
NEW FEATURES
– (Snippets plug-in) The Cut (Ctrl+X), Copy (Ctrl+C), and Paste (Ctrl+V) commands were added to the Snippets plug-in.
These commands can be used to copy or move snippets items easily around the snippet tree.
The Paste command can be also used to insert a simple text snippet to the snippet tree.EDIT:
Be aware: the snippet copy is an exactly 1:1 copy
including all parameters as f.ex. trigger and shortcut.StefanParticipantI think the hover tool tips are an great improvement.
Many thanks Yutaka.Now we can use an abstract snippet description like “my funny snippet”
and can see in the tool tip what the snippet will do exactly.Today, (2/28/2012) we are releasing EmEditor Professional v11.1.0 beta.
Updates from v11.0.5 include:
NEW FEATURES
– (Snippets plug-in) The Snippets text is now displayed as a tooltip when the mouse hovers on an item of the Snippets tree (Context menu – View – Tooltip must be checked in order to enable this feature).Note:
Only English, Japanese, and Korean user interfaces are up-to-date.
“View – Tooltip” is not available e.g. in my localized german language file right now.
So, at least for the time to enable the tooltips, use the english language.StefanParticipanta) make an zero-width selection in front of the lines
b) execute “Edit > Advanced > Numbering…”
c) press [OK]
Note: to pad with zeros enter them into the “First Line” field like “01” or “0001”d) while still have that inserted numbers selected do an regex s&r:
Find: (dd)
Replace with: 1)[X]Use regex
[X]In selection onlyNote: the amount of find “d” patterns depends on how many zeros you have padded.
“dd” will match two digits.
“ddd” or “d{3}” will match three, and so on…StefanParticipantNot really as “default” but maybe this will help you:
Tools > Customize… > [File]
“[X]Remember Last Folder” check boxIn Open and Save As dialogs, show the previously used folder.
StefanParticipantI have not tested this feature
but i had the meaning it works like this:
* execute an Find in Files command for an “word”
* you get an result like:
C:File1.txt Line 3 in this line is the word
C:FileB.log Line 25 here is this word too* select an line and use “Edit > Advanced > Tag Jump”
this command will open the file and jump to the line number in question.Maybe you can try it yourself?
StefanParticipantWhat do you mean by “tags” ?
Where have you read about tags?
Maybe:
Tag Jump command
Summary
Jumps to a tag.Description
This command is used after running the Find in Files command, or for parsing an error log to locate a string or an error. If a file’s path and a line number are displayed at the start of a line, this command will open the file and jump to the line number in question.How to Run
Default Menu: Edit > Advanced > Tag JumpStefanParticipantHi LTT,
why can you get negative numbers?
I think you self add this numbers to your menu
and take care to use positive nbr only?Here is my PopUp menu example (click)
And in your code you can check for negative nbr and just “break;”
OTOH:
MyMenu.Add(“Execute Function &one”,-1);
gives me no error on EmEditor 11.0.3, portable, XP SP3
It just do nothing, or, if the case-label exists, it works with “-1” too.EDIT:
Ah, now i see…alert( MyMenu.GetText( -1 ) );
did not work for me too. Unknown error.alert( MyMenu.GetText( 2 ) );
works.StefanParticipantYour answer implies that GetLine() returns the whole line already.
That was not clear to me because i saw different results (to my failure as i see now)
Today i saw by an another test that GetLine() returns the whole line indeed:
#language = "VBScript"
'Returns the line number of the top of the selection.
SelLineFirst = document.selection.GetTopPointY( eePosView )
'Returns the line number of the bottom of the selection.
SelLinesLast = document.selection.GetBottomPointY( eePosView )
For LineNumber = SelLineFirst to SelLinesLast
'Retrieves the text on the specified line "LineNumber"
Line = document.GetLine( LineNumber )
'Show line content:
alert Line
'here is my failure
'document.selection.Text = newtext & Line
Next 'LineNumber
Now that i know that GetLine() returns the whole line content
i know i did something wrong.My problem was that i wanted not to select the whole lines
(in front of executing my script)
but start selection at some signs behind SOL at first line
and end at some position before EOL at the last line.BUT then, silly me, i used document.selection.Text = newtext
and was wondering why GetLine() didn’t returns the whole line,
now i see i was to silly to get what happens… sorry.
(only the selected text was altered, of course)No i use something like
For LineNumber = SelLineFirst to SelLinesLast
'Retrieves the text on the specified line "LineNumber"
Line = document.GetLine( LineNumber )
'Selects a line at the cursor.
document.selection.SelectLine
'overwrite this line with new text
document.selection.Text = newtext & Line
Next 'LineNumber
The additional document.selection.SelectLine
extends at real time the selection to the whole line
and so my replacement replaces the whole line as wanted.Issue solved.
Thanks Yutaka! Thank you for your endurance and support!StefanParticipantVBScript “InputBox()” is missing
but there is no EmEditor help entry
pointing to the alternative “Prompt()” commandlike there is one for the missing “MsgBox()” function to alert().
May i ask to add such an cross reference to make it
more easy to find the InputBox alternative Prompt() ?2.)
also i want to suggest an third prompt() parameter.As addition to
strMessage
strDefaulti want to ask for
strTitlelike the VBS inputbox() have:
strAnswer = prompt( strMessage, strTitle, strDefault )
Thank you.
StefanParticipantFROM:
erfqlqbf ; qlkhflkejf
kqrjhfkjrkjf ; qkhkhfg
jreh ; kejrhfgkjhTO:
erfqlqbf ; qlkhflkejf
kqrjhfkjrkjf ; qkhkhfg
jreh ; kejrhfgkjhUSE:
Edit > Separated Values/Sort
CSV (Comma-separated), TSV (Tab-separated) or DSV (User-defined delimiter-separated)
See: http://www.emeditor.com/modules/feature1/rewrite/tc_35.html#csvIt was a bit difficult to me to find how to set the User-defined delimiter.
Therefor go to Tools > Properties > [File] > Delimiter [;]Yutaka, I think there should be an link in the menu
“Edit > Separated Values/Sort > Set User-defined delimiter…”–
But we can’t make this alignment stand forever.
Once we leave this CSV mode, the alignment is lost.I already have asked for an improvement there:
http://www.emeditor.com/modules/newbb/viewtopic.php?topic_id=1856&forum=4.
StefanParticipantDon’t know. Seems to work for me.
EmEditor 11.0.5, 32-bit, Boost 1.47
What’s the differences?
StefanParticipantEmEditor Help – EmEditor Macro Reference – Tutorial > Using Regular Expressions
EmEditor Help – How to – Search > Regular Expression Syntax
StefanParticipantYes i do it the same way:
#title = "Enclose selection";
#tooltip = "Enclose an selection with an sign";
// Select some text and execute this macro to put an sign
// in front and at the end of the selected text;
//mySign = "\%"
mySign = prompt( "Enter sign to enclose selection:", "\%" );
selText = document.selection.Text;
outText = mySign + selText + mySign;
//alert(outText);
document.selection.Text = outText;
Should be easy to modify this code
and replace mySign with LeadingSign and TrailingSign :-)StefanParticipantWOW thanks, that really works! :lol:
<?xml version="1.0"?>
<!--EmEditor Snippets file-->
<Snippets>
<SnippetTree>
<Item Name="h1" Flags="4" ConfigEdit="" ConfigMacro="" ConfigsAssociate="" Text="<h1>${0:${SelText}}</h1>
" Trigger="h1" Tip="" ShortcutKey="0" ShortcutVirt="0"/>
</SnippetTree>
</Snippets>
StefanParticipantThank you. I just wanted to know if there is a future ;-)
Till then.
P.S. i am sorry for having misspelling your name. Corrected!
StefanParticipantHi Yutaka,
i have taken a lot of time to provide you a few ideas to improve the snippets plugin,
also because i use it often and missed that features myself.But unfortunately i never got an answer if this are good
ideas or not and if they will be implemented or not.Would be courteously to give back an feedback.
Can you tell if you will improve snippets plugin and, if yes,
which idea will be implemented and for when can be an update awaited.If you have any question about my suggestion don’t hesitate to ask.
Thank you.
- AuthorPosts