 
                
                How to Use the GetLine Feature for Selective Text Retrieval in EmEditor Text Editor
 
                How to Use the GetLine Feature for Selective Text Retrieval in EmEditor Text Editor
Viewing 3 posts - 1 through 3 (of 3 total)
- Author
 Posts
- February 18, 2012 at 7:56 pm #10040 Stefan 
 Participant
 This is 11.0.5, 32-bit portable on XP SP3GetLine Method 
 Retrieves the text on the specified line.
 [JavaScript] str = document.GetLine(yLine [, nFlags ]);
 [VBScript] str = document.GetLine(yLine [, nFlags ])
 But i wonder why GetLine returns the selected part only
 instead of the whole line?
 Back ground:
 in an macro i walk through all selected lines and wanted to get the text of the WHOLE line.
 FOR y = 1 to 3
 ‘Retrieves the text on the specified line.
 str = document.GetLine(y)
 NEXT
 Instead i get the selected part of that lines only.
 Why?
 How can i get the whole line at easy?
 Do i really have to use something like:
 FOR y = 1 to 3
 ‘Sets the cursor position.
 document.selection.SetActivePoint eePosLogical, 1, y, false
 NEXT'Selects a line at the cursor. document.selection.SelectLine 'Retrieves the text on the specified line. str = document.GetLine(y)
 Question:
 Can GetLine() be extended by an flag to get the whole line always, no matter of the selection?
 If not, should the help wrote
 “Retrieves the selected text on the specified line.”
 instead of
 “Retrieves the text on the specified line.”
 Or is there an other method?
February 20, 2012 at 7:02 pm #10048 Yutaka Emura
Keymaster
Hello,
 I couldn’t reproduce this issue. Can you show me or send me a sample file? Can you write how the file was selected when you run this macro?
 Thank you,
February 20, 2012 at 8:47 pm #10050 Stefan
Participant
Your 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!
- Author
 Posts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Also read:
- [New] Echoes of Amusement Comical Tune Transformations for 2024
- [New] In 2024, Amplify Your Snapchat Experience with Easy Voice Customization
- [New] In 2024, From Blurry Beginnings Transforming Your Videography with Instagram Techniques
- 1-Year Subscription Pass for EmEditor - Professional Text Editing Software
- B29] Challenges of Handling Massive File Sizes in EmEditor
- Efficient Coding with EmEditor - A Fast and Feature-Rich Text Editing Solution
- EmEditor Text Editor: Master Your Coding Sessions with the Power of Code Folding
- Resolving Rainbow Six Siege's Error Code 3-0X0001000B: A Comprehensive Guide
- Understanding Text File Encoding in EmEditor - Why Reloading Won't Change It
- Virtual Voyage Unlimited The Ultimate Selection of Free Roleplayers
- Ways to stop parent tracking your Apple iPhone XS | Dr.fone
- Title: How to Use the GetLine Feature for Selective Text Retrieval in EmEditor Text Editor
- Author: Charles
- Created at : 2024-10-08 07:02:56
- Updated at : 2024-10-14 05:39:35
- Link: https://win-awesome.techidaily.com/how-to-use-the-getline-feature-for-selective-text-retrieval-in-emeditor-text-editor/
- License: This work is licensed under CC BY-NC-SA 4.0.