Forum Replies Created

Viewing 25 posts - 301 through 325 (of 345 total)
  • Author
    Posts
  • 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

    in reply to: get help on function using standart chm files #9510
    Stefan
    Participant

    WOW Yutaka, thanks, works great.

    I will test some more, but basically that’s how i had imagine it.

    My experiences:

    First i got an error


    ---------------------------
    eehelptool.exe - Komponente nicht gefunden
    ---------------------------
    This application has failed to start because MSVCR100.dll was not found. Re-installing the application may fix this problem.
    Die Anwendung konnte nicht gestartet werden, weil MSVCR100.dll nicht gefunden wurde. Neuinstallation der Anwendung könnte das Problem beheben.
    ---------------------------
    OK
    ---------------------------

    That’s because i didn’t have the “Visual C++ 2010 Redistributable Package” installed.
    I had only 2005 and 2008 installed.
    Now i got interim the MSVCR100.dll and put them in the
    same folder as the eehelptool.exe and it works fine.

    I have set up this tool as:

    Titel: short description, e.g. VBScript help file
    Command: path to eehelptool.exe, even relative to EmEditor folder, e.g. myDocuseehelptool.exe
    Arguments: path to help file, even relative to EmEditor folder, e.g. myDocusSCRIPT56.CHM $(WordText)
    Initial Dir:
    Icon Path: path to icon resource, e.g. \%SystemRoot\%hh.exe for the default help file icon

    Note the ” $(WordText)” after the CHM which will search the CHM for just that selected keyword.
    In fact, the keyword even have NOT to be selected, just the cursor right before the first char or after the last char is enough for “$(WordText)” to work. Great.

    Of course this “search for the keyword” feature will work only for CHM files which are compiled with an proper index. If not, or if you just want to open the CHM without jumping to the “selected” word, you don’t need to include this ” $(WordText)” part to your Arguments: definition.

    – – –

    I have found one improvement wish:
    the keyword is found and selected in the index tab,
    but i miss:
    * pressing enter (so to say) to open the page in the preview pane for ease use
    * having the focus in that preview pane to allow immediately scrolling

    Maybe that can be included too?

    – – –

    Question:

    will this tool be part of the core package or even be included in the EmEditor.exe?

    Maybe from interest for you:

    other editors allow to have one syntax related help file (like SCRIPT56.CHM for *.VBS) per syntax language configuration, and all are accessible via the same shortcut (like Alt+F1).
    Which CHM is opened depends on the currently active syntax configuration.
    If i am on an VBS doc, the vbs.CHM is launched.
    If i am on an HTML doc, my html.CHM is opened.

    So we didn’t need to have 5 tools / toolbar icons / shortcuts
    just to open the syntax related help files. One would be enough.

    Just some ideas. Thanks for EmEditor. Great Tool. Well done.


    Ah, thank CrashNBurn too. I have tried that before posting my question but found it not works
    well with relative paths and all over all that is not that easy for the average user (beginners)

    in reply to: Snippets insertion point #9507
    Stefan
    Participant

    As an hint for others reading the above request, here is the solution.

    To work with selected text have ${SelText} in your snippet.

    Example 1:
    For HTML; format bold
    ${SelText}

    Example 2:
    For AutoHotkey; surround with \%-signs
    \%${SelText}\%

    – – – – – –

    To have your cursor at the right place after the snippet is inserted
    simple add an placeholder like $7

    Example 1:
    For VBScript
    Dim $4 As String

    Results in:
    Dim | As String

    Example 2:
    For Dairy
    ${Date} ${Time} Log: “$1”

    Results in:
    19.07.2011 17:37 Log: “|

    Example 3:
    For XYplorer script

    $$$1=1; 
    while($$$1 < 10){

    msg $$$1,1;
    //your code here> $2

    $$$1++;
    }

    Usage:
    * first, at the first $1, type the name of the loop var, e.g. ‘LoOp’
    (This var name is copied to all places where the placeholder ‘$1’ is found else)
    * second press TAB to jump behind ‘//your code here’

    Note:
    the var name for XYplorer script have to be prefixed by an ‘$’
    and since this $ has an special meaning for EmEditor snippet
    we have to escape them by doubling this sign to ‘$$’

    Results in:


    $LoOp=1;
    while($LoOp < 10){

    msg $LoOp,1;
    //your code here> |

    $LoOp++;
    }
    in reply to: get help on function using standart chm files #9502
    Stefan
    Participant

    No answer here the last three years?

    Hello there,

    I’m locking for the same:
    how can i open an help file for an language
    to lookup an keyword?

    I search a function
    to put the cursor at an word and then press an shortcut
    to open an defined help file (CHM),
    just for the current used language,
    which jumps to that word.

    How can i do this with EmEditor?

    I searched the properties for the language configuration
    and the tools configuration but found nothing.

    For example:
    for *VBS files
    i want to set the “.docsSCRIPT56.CHM” as language help file.
    And then i want to put the cursor on the word “msgbox”, press an shortcut
    and want EmEditor to open “.docsSCRIPT56.CHM::MsgBox.htm”
    for me.

    Stefan
    Participant

    I don’t know if i do it the elegant way, but at least it works:

    Example text:








    Result:
    1:

    4:

    6:

    9:

    RegEx used to match wanted line:

    Script:


    strSelectedText = document.selection.Text
    If strSelectedText = "" Then
    alert "Nothing selected. Script quits."
    Quit
    Else
    'alert strSelectedText
    End If


    'regex search pattern:
    strREPattern = "<a href=.https.+/(en|us)/.+>"


    'how many lines?
    yPosStartSelection = document.selection.GetAnchorPointY( eePosLogical )
    yPosEndSelection = document.selection.GetBottomPointY( eePosLogical )
    LinesSelected = yPosEndSelection-yPosStartSelection


    'For Each Line In LineS Do:
    LinesArray = split(strSelectedText, vbCRLF)
    funcRegExReturn =""
    For LineNr = 0 to LinesSelected -1
    currLine = LinesArray(LineNr)
    'alert LineNr & ": " & currline & ": " & strREPattern
    funcRegEx strREPattern, currLine
    'alert funcRegExReturn
    If funcRegExReturn = TRUE Then
    OutArray = OutArray & Linenr+1 & ": " & currLine
    If LineNr < LinesSelected -1 Then OutArray = OutArray & vbCRLF
    End If
    Next

    'TEST:
    'alert OutArray



    'Write OutArray to new document:
    'if not editor.EnableTab then
    ' editor.EnableTab = True
    'end if
    editor.NewFile
    document.write OutArray



    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 Function

    HTH? :-D


    @Emura

    But i don’t understand why the function didn’t return something with the function name?

    I think this should work:


    call funcRegEx x y

    If funcRegEx Then alert "OK"

    Function funcRegEx(needle, haystack)
    Set regEx = New RegExp
    regEx.Pattern = needle
    regEx.IgnoreCase = True
    regEx.Global = True
    if regEx.Test(haystack) Then funcRegEx = TRUE
    End Function

    but i have to use something like:


    Dim funcRegExReturn

    call funcRegEx x y
    If funcRegExReturn Then alert "OK"

    Function funcRegEx(needle, haystack)
    Set regEx = New RegExp
    regEx.Pattern = needle
    regEx.IgnoreCase = True
    regEx.Global = True
    if regEx.Test(haystack) Then funcRegExReturn = TRUE
    End Function

    10.1.0, 32-bit portable on XP 32 SP3

    in reply to: Buy EmEditor from Emurasoft directly paying with Euros? #9077
    Stefan
    Participant

    Thanks for the responses.
    Here are some facts, just for your information, in case you don’t know:

    Yes, i have removed all additional positions.
    And the price of 31,81 Euro excl. VAT is still 44,36 Dollar.
    http://de.finance.yahoo.com/waehrungen/waehrungsrechner/#from=EUR;to=USD;amt=31.81

    The rest till EUR 37.85 are german VAT.
    So i have to pay EUR 37.85 which are $53,
    http://de.finance.yahoo.com/waehrungen/waehrungsrechner/#from=EUR;to=USD;amt=37.85

    That’s why i asked if there are other possibilities to buy (pay for) EmEditor :-)
    Is there an store in USA from where i can buy?
    Or can i make perhaps an donation to get an license,
    or can i send the money to your private PayPal account?

    Thanks…

    in reply to: Search and Replace multiple lines #6689
    Stefan
    Participant

    “Tools > Customize…” >> Search -Tab

    >>> [x] RegEx match newline
    >>> Additional Line [50], f.ex.

    in reply to: Vertical selection problem #6491
    Stefan
    Participant

    silverma wrote:

    I feel very frustrated now and please help!

    Help!

    Abe

    Hi Abe.
    What’s on?… did it works now?

    in reply to: Vertical selection problem #6478
    Stefan
    Participant

    O.K. Abe, here we go…

    would you please test this feature with the EmEditor version who provide this feature?
    see http://www.emeditor.com/modules/feature1/

    EmEditor Professional 8 New Features
    Vertical Selection Editing
    The new vertical selection editing feature allows you to replace similar lines quickly without using regular expressions.

    Go to Download page http://www.emeditor.com/modules/download2/
    and download the last beta of the upcoming EmEditor version 8.

    Next Beta Version (Version 8.00 beta 12)
    Download 32-bit

    Then please test again and tell us how it works.

    HTH?
    bye
    stefan

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