Forum Replies Created

Viewing 25 posts - 301 through 325 (of 353 total)
  • Author
    Posts
  • in reply to: user input in a FindInFiles macro #10039
    Stefan
    Participant

    VBScript “InputBox()” is missing

    but there is no EmEditor help entry
    pointing to the alternative “Prompt()” command

    like 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
    strDefault

    i want to ask for
    strTitle

    like the VBS inputbox() have:

    strAnswer = prompt( strMessage, strTitle, strDefault )

    Thank you.

    in reply to: -= Text Alignment =- #10038
    Stefan
    Participant

    FROM:


    erfqlqbf ; qlkhflkejf
    kqrjhfkjrkjf ; qkhkhfg
    jreh ; kejrhfgkjh

    TO:


    erfqlqbf ; qlkhflkejf
    kqrjhfkjrkjf ; qkhkhfg
    jreh ; kejrhfgkjh

    USE:
    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#csv

    It 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

    .

    in reply to: Need help on setting syntax highlight with RegEx #10012
    Stefan
    Participant

    Don’t know. Seems to work for me.

    EmEditor 11.0.5, 32-bit, Boost 1.47

    What’s the differences?

    in reply to: Java Script Help #10008
    Stefan
    Participant

    EmEditor Help – EmEditor Macro Reference – Tutorial > Using Regular Expressions

    EmEditor Help – How to – Search > Regular Expression Syntax

    in reply to: Java Script Help #10003
    Stefan
    Participant

    Yes 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 :-)

    in reply to: Snippet: allow to export an single item only #9988
    Stefan
    Participant

    WOW 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>

    in reply to: Snippet: Expand / Collapse Folder #9985
    Stefan
    Participant

    Thank you. I just wanted to know if there is a future ;-)

    Till then.

    P.S. i am sorry for having misspelling your name. Corrected!

    in reply to: Snippet: Expand / Collapse Folder #9965
    Stefan
    Participant

    Hi 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.

    in reply to: Directory created in the system's disk root #9831
    Stefan
    Participant

    Hi.

    Same OS here and portable EmEditor version with ini instead of registry.

    I never have seen such folder in the root.
    That folder belongs to your \%AppData\% folder in your profil folder.
    For me (as portable) i have an AppData folder in my EmEditor folder.

    For an test:
    what path do you get if you type \%appdata\% in the address bar of TC?

    Because you mentioned D as system drive you should see something like
    “D:Documents and SettingsFlintApplication Data”
    but in your language

    and there should be the subfolder “EmurasoftEmEditorWorkspace”

    .

    in reply to: find the max number #9804
    Stefan
    Participant

    No, an RegEx is an pattern matching system only.
    There are very little comparing features.

    You will need to use an macro/script for that.
    How that macro will work and what you will get as
    result depends on your real current needs and how
    the rest of the line looks a like: are that digits
    and tabs the only signs in such an line?

    Here is an quick example code.
    Be sure to use this always with copies of your importent documents.
    Because i don’t have an impression what could get worse.
    If anyone should improve this script for you we will need an
    better example how the rest of such an line will look a like.

    Ahh, and this script will work only with tabs as delimiter
    or it have to be adjusted as one needs.



    ////===== Description: ==================
    //// Click into an line and execute this macro/script.
    //// The line will split at tab stops
    //// and if an part is detected as an number
    //// the greatest number is stored as vBiggestNumber for your use.


    //// ====== Setting: ====================
    //// Split line at tab. Use your own delimiter if needed:
    SplitAt = "t";


    //// ====== Work: ======================
    //// Get current line content:
    document.selection.SelectLine();
    CurrLine = document.selection.text;
    //// Call function to split str and find biggest number:
    vBiggestNumber = ReturnLargedNumber(CurrLine, SplitAt);


    //// ====== End: =======================
    //// Do something with the result:
    alert('result: >' + vBiggestNumber + '<');
    //document.selection.Collapse();
    //document.selection.NewLine( );
    document.selection.text = vBiggestNumber;


    ////======================================
    ////======== Function =====================
    function ReturnLargedNumber(str,delim)
    {
    Tokens = str.split(delim);
    vMaxNumber = 0;
    for (x = 0; x < Tokens.length; x++)
    {
    vCurrentNumb = Tokens[x];
    if (!isNaN(vCurrentNumb))
    {
    if (Number(vCurrentNumb) > vMaxNumber)
    {
    vMaxNumber = vCurrentNumb;
    }
    }
    }
    return vMaxNumber;
    }


    HTH? :-D

     

    in reply to: Learning by doing: Loop through all lines #9797
    Stefan
    Participant

    Some examples for section:

    ////Delete start of line (Remove first sign/char):
    redraw = false;
    document.selection.SetActivePoint( eePosLogical, 1, Line );
    str = document.GetLine( Line );
    if (str != “”)
    {
    document.selection.StartOfLine();
    document.selection.Delete();
    }

    ////Delete end of line (Remove last sign/char):
    redraw = false;
    document.selection.SetActivePoint( eePosLogical, 1, Line );
    str = document.GetLine( Line );
    if (str != “”)
    {
    document.selection.EndOfLine();
    document.selection.DeleteLeft();
    }

    ########################################

    However, for just this task there
    would be an easier solution then such an big script as shown above:

    //Remove first sign from selected lines
    redraw = false;
    document.selection.Replace(“^.”,””, eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.HighlightFind = false;

    //Remove last sign from selected lines
    redraw = false;
    document.selection.Replace(“.$”,””, eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
    document.HighlightFind = false;

    in reply to: Learning by doing: Loop through all lines #9796
    Stefan
    Participant

    No useful script. Just an little lesion.
    Loop virtually through only the selected lines in file.
    The cursor will not move!
    We access each line by its number only.

    – – –

    Best to learn is to do some lessons.
    So i will show my steps creating an macro for others.

    I am not saying that this is the best way to do it,
    it is just an start.

    If you have an better way to do it, or other
    suggestions, just reply :-)


    ////Loop through Selection

    ////Object handling to save always typing of 'document.selection':
    var d = document;
    var s = d.selection;


    ////////Get the selected text to work on:
    ////////(Depends if already something is selected or not)
    if (s.IsEmpty)
    {
    ////If document.selection is empty:
    vWasAnSelection = false;

    ////Alternative one
    //alert("Nothing selected, script quits. Please select and start again.");
    //quit();

    ////Alternative two
    alert("Nothing selected, script will select whole text for you.");
    s.SelectAll();

    }else{

    ////If there was an selection already:
    vWasAnSelection = true;
    alert("Selected text to work on: n" + s.text);
    }



    ////////Get start and end line of the selection:
    ///Returns the line number of the top of the selection.
    FirstSelLine = s.GetTopPointY(eePosLogical);
    ///Returns the line number of the bottom of the selection.
    LastSelLine = s.GetBottomPointY(eePosLogical);



    ////For Each Line In SelectedLineS Do:
    for( Line = FirstSelLine; Line <= LastSelLine; Line++)
    {
    //// <<< Your code here >>>
    //// Here an simple example:
    ret = Confirm(d.GetLine(Line));
    if (ret == false) {if (!vWasAnSelection){s.Collapse();} Quit();}
    }


    ////If there was no selection do an UnSelectAll at the end:
    if (!vWasAnSelection) s.Collapse();

    in reply to: Replace Dialog: Find Previous #9780
    Stefan
    Participant

    +1 Seams useful to me too :-)

    in reply to: Example please for (?n:true_expression:false_expression) #9745
    Stefan
    Participant

    Thank you.

    My understanding right now:
    You have to set up the FIND RegEx with an alternation so that it has both a success and a failure point.
    As the REPLACE have too possibilities too: (?n:true_expression:false_expression)

    Test:


    I have:
    Test Price 1000
    Test Price 100
    Test Price 800

    Find: (.+) (.+) (d{3})(d)*
    Repl: (?4: too expensive: affordable)
    [X] Use RegEx

    Result:
    Test Price 1000 too expensive
    Test Price 100 affordable
    Test Price 800 affordable

    Thanks again. I still have to do some test, but i think you showed me the way.


    BTW, good idea :lol: of you:
    Replace: (?4:too expensive:affordable)

    in reply to: Example please for (?n:true_expression:false_expression) #9743
    Stefan
    Participant

    Conditionals
    The character ‘?’ begins a conditional expression, the general form is:
    ?Ntrue-expression:false-expression
    where N is decimal digit.
    If sub-expression N was matched, then true-expression is evaluated and sent to output,
    otherwise false-expression is evaluated and sent to output.
    You will normally need to surround a conditional-expression with parenthesis in order to prevent ambiguities.
    For example, the format string “(?1foo:bar)” will replace each match found with “foo” if the sub-expression $1 was matched,
    and with “bar” otherwise.
    For sub-expressions with an index greater than 9, or for access to named sub-expressions use:
    ?{INDEX}true-expression:false-expression
    or
    ?{NAME}true-expression:false-expression

    conditional expression ?Ntrue-expression:false-expression

    In addition, conditional expressions of the following form are recognized:
    ?Ntrue-expression:false-expression
    where N is a decimal digit representing a sub-match.
    If the corresponding sub-match participated in the full match, then the substitution is true-expression.
    Otherwise, it is false-expression. In this mode, you can use parens () for grouping.
    If you want a literal paren, you must escape it as (.

    Seams clear, but i have still problems using this.
    Some tests:


    conditional expression
    '?Ntrue-expression:false-expression' test 1

    I have:
    Test Price 1000
    Test Price 100
    Test Price 800
    ---
    Find: (.+) (.+) (d{3})(d)
    Replace: (?4: too expensive: affordable)
    [X] Use RegEx
    ---
    Result:
    Test Price 1000 too expensive
    Test Price 100
    Test Price 800
    ---
    Expected:
    Test Price 1000 too expensive
    Test Price 100 affordable
    Test Price 800 affordable
    ---
    Explanation:
    If sub-expression No. 4 match THEN
    use 'true-expression'
    else 'false-expression'


    conditional expression
    '?Ntrue-expression:false-expression' test 2

    I have:
    Color 1 green
    Color 2 blue
    Color 3 red
    The available colors are either green, blue or red.
    ---
    Find: (Color d) (.+)
    Replace: (?1:1 2-ich:1 -2-)
    [X] Use RegEx
    ---
    Result:
    Color 1 green-ich
    Color 2 blue-ich
    Color 3 red-ich
    The available colors are either green, blue or red.
    ---
    Expected:
    Color 1 green-ich
    Color 2 blue-ich
    Color 3 red-ich
    The available colors are either -green-, -blue- or -red-.
    ---
    Explanation:
    Only if sub-expression No. 1 will match THEN
    use 'true-expression'
    else 'false-expression'

    OK, i will test some more.

    in reply to: Example please for (?n:true_expression:false_expression) #9742
    Stefan
    Participant

    Thanks John!

    I see it, but i don’t understand it.
    Will have an closer look and read the Boost help…

    in reply to: copy file name to clipboard #9739
    Stefan
    Participant

    Hi Derek.

    derekcohen wrote:

    Is there an API reference anywhere?

    I think EmEditor Help (F1) > Macro Reference
    is what you search for.

    So here is my solution:
    EmEditor Help > Macro Reference > Document Object > Properties: Name Property

    clipboardData.setData(“Text”, document.Name );

    _

    There are also
    document.FullName
    document.Path
    and many more…

    in reply to: Find/Replace: Multiple replaces needed when using Replace All #9733
    Stefan
    Participant

    .

    Hi :-)

    Me thinks that is how the regex engine works?

    You search “,d,” on an string like “10,6,3,12”

    The regex will match “,6,”
    then it continuous at the very next sign from the rest of the string which is now “3,12”.

    As you see your search pattern will not match on “3,12” because there is no “,d,” anymore.

    The trick is to not match the comas itself as you do but only take an look if they are present.
    That can be fine done by using positive lookbehind and lookahead which EmEditor supports (thanks Yutaka).
    For more info about that feature see e.g.: http://www.regular-expressions.info/lookaround.html

    Example:
    search pattern: “oogl”
    positive lookbehind if there is an “G” right before your search pattern: (?<=G)
    positive lookahead if there is an “e” just after your search pattern: (?=e)

    So RegEx search for:
    (?<=G)oogl(?=e)

    Will match:
    Woogle
    Google
    Googlo
    Google
    Foogle

    Example for your issue with commas:
    (?<=,)(d)(?=,)
    01

    HTH? :lol:

    .

    in reply to: Inserting vertical columns. #9628
    Stefan
    Participant

    RAM wrote:
    taking a column of dates (100,000s rows) like:
    20110905

    and separating the Y M and D using tabs, to result in:
    2011 09 05

    Or use an RegEx search&replace like


    Find: (d{4})(d{2})(d{2})
    Replace with: $1t$2t$3
    [X] Use Regular Expressions

    BTW: that way you can even reorder the YMD sequence.

    in reply to: Ignore r in regex #9603
    Stefan
    Participant

    Deipotent wrote:
    I don’t mean strip it out of the edit box, I mean just strip it out of the regex

    Yes, basically the very same.
    I (the user) try to do smtg, and the app do smtg other in the back.
    And i (the user) get the impression that i did it right, what is not the truth.

    I know that that is common (see IE which autom. add http:// in front of an URL, or how Win7 lies with UAC virtualizing)
    but i did not want to see that more often.

    in reply to: Match New Line Characters doesn't work? #9601
    Stefan
    Participant

    There could be an warning dialog after clicking [OK]
    IF “Regular Expressions Match New Line Characters” is checked
    AND “Additional Lines to Search for Regular Expressions” is set to ‘0’

    Like:
    “You have chosen to use RegEx in multi line mode.
    Please note that you have to set the roughly expected “Additional Lines” option too.”


    EDIT:
    Or an better idea:
    That two options could be somehow “grouped” by an thin frame line,
    and the “Additional Lines” option could be greyed-out
    while “Match New Line” is disabled,
    to make the relationship better visible.

    —————————————————
    “[X] Regular Expressions Match New Line Characters”
              “Multi Line mode search max. for [ 0 ] additional lines.”
    —————————————————

    – – –

    Or maybe these option could be set to an higher amount as ‘0’ by default.
    Would be an amount of, lets say, ’30’ really that slow?

    .

    in reply to: deficient function of replace #9600
    Stefan
    Participant

    1++
    I would like also to see both features implemented.

    in reply to: Ignore r in regex #9599
    Stefan
    Participant

    > “it would be useful if EmEditor stripped out r from regexes”

    I think that would be too smart and unexpected for many.
    The user just have to learn how it works.
    If not already, there should be an explanation incl. example in the help, that should be enough.

    in reply to: Context sensitive CHM help file integration #9598
    Stefan
    Participant

    Yes, me too.

    in reply to: Context sensitive CHM help file integration #9596
    Stefan
    Participant

    Hi Athan,

    take an look if that will help you:

    “I created a small program that can be used to open a CHM file with a keyword from EmEditor external tools”

    >> http://www.emeditor.com/modules/newbb/viewtopic.php?forum=2&post_id=5789&topic_id=610

Viewing 25 posts - 301 through 325 (of 353 total)