Retrieve the selected text

Hello

I just know how I can retrieve the text selected via the Menu:

I add a MenuItem to the category system so that it is available everywhere:

... ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM,this);...

Then after that I selected the text in the browser for example, I click on the Menu button:

public Object run(Object context) {
  if ( context instanceof ) {
    //do something with the selected Text    ...
  }
}

It should allow me to do something with the text I've selected. What instance is that the text of selected?

Can someone help me here?

Thank you in advance!

        if (fld.isSelectionCopyable()){
            Clipboard cd = Clipboard.getClipboard();
            fld.selectionCopy(cd);
            Object s3 = cd.get();
        //(....)

On the second reading of your code, you do not use the Clipboard correctly. Try the above.

Tags: BlackBerry Developers

Similar Questions

  • Get the selected text

    Hi guys

    I'm trying to format the selected text. I select text and want to make "BOLD". That's what I have so far:

    <mx:Script>
        <![CDATA[
        
            private function taBold():void {
                // do something
            }
            
        ]]>
    </mx:Script>
    
    <mx:Button id="bold" label="bold" click="taBold()"/>
    

    It would have been simple if an event has been registered for the selection of text because then I could use the setSelection and place the text in a textRange and do any update in shape that needed to be done. But as you can see the taBold() function is called, but no args are passed on it, which leads me to ask, how can I retrieve the text selection?

    Hi there you can use TextRange, take a look at the tutorials

    http://www.switchonthecode.com/tutorials/Flex-snippet-tutorial-using-the-TextRange-class

    http://blog.flexexamples.com/2007/08/01/using-the-TextRange-class-to-Hightlight-text/

  • How to search the selected text with a default search engine?

    Hello

    Before the recent update of the search bar, you can select your 'current' search engine, and a search for the selected text (right click on the selection) would use this engine.

    Now, it seems that you can only search for the selected text using the default engine. If that is correct, it's a big step backwards for me. For example, I can't have Google as my default search engine and the search for a text selected on eBay!

    Or am I missing something?

    Thank you!

    R.

    I find this extension very useful for selected items in the web pages. It offers all your search engines with select > right click.
    https://addons.Mozilla.org/en-us/Firefox/addon/context-search/?src=search

  • How to get the 'selected text '? leave a string

    If I highlight text in a text string, I want to be able to copy it to the Clipboard.

    I have already created an event that uses the Application of reference to 'write the Clipboard' now I need to give it the selected text.

    How do I do that?

    Here's a way to do it.

    Ben64

  • Replace the selected text with other content TextFrame

    Hello

    I am changing a text selected in something new, involving the movement of text and the paragraph style using a jsx script. At the present time, everything works beautifully:

    • I entered the select text
    • I have create a new temporary TextFrame
    • I build my new paragraphs and apply styles to them in the new TextFrame

    What I was not able to reach still is to replace the original selected text by temporary TextFrame content.

    Any help would be more than welcome

    A part of my script:

    myText = app.selection[0].contents;

     

    ... do some stuff


    var myDocument = app.documents.item(0);

    var myPage = myDocument.pages.item(0);

    var myTextFrame = myPage.textFrames.add();


    myTextFrame.geometricBounds = [0, -70, 150, 70];

    myTextFrame.contents = "Paragraph1\rParagraph2...";


    myTextFrame.paragraphs[0].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style1');

    myTextFrame.paragraphs[1].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style2');

    And now, in myTextFrame, I have my new paragraph formatted, and I would like to replace the original selected text with the contents of my TextFrame (keeping the paragraph styles).

    Hello

    Keep the logic of the code and edit utilities:

    var
        mSourceIdx = app.selection[0].index,
        mStory = app.selection[0].parentStory,
        mReplaceStuff = {
            elements: [
                ["Paragraph_1\r",  "Style_1"],
                ["Paragraph_2\r",  "Style_2"],
                ["Paragraph_X\r",  "Style_X"]
                ]},
        mTarget, cElement, cText, cParaStyle;
    
    while (cElement = mReplaceStuff.elements.pop()) {
        cText = cElement[0];
        cParaStyle = app.activeDocument.paragraphStyles.item(cElement[1]);    // modify if styleGroups present in a structure
      mTarget = mStory.insertionPoints.item(mSourceIdx);
        mTarget.contents = cText;
        mTarget.paragraphs[0].appliedParagraphStyle = cParaStyle;
         }
    
    app.selection[0].contents = "";
    

    MReplaceStuff allows to prepare stuff to replace

    Jarek

  • Cannot get the "&lt; FEFF &gt;" string in the selected text [indesign CS6]

    Hello world!

    I can't get the string to the selected text. The selected text contains several xml tags.

    In adobe indesign cc version of 2014, the selected text is bring the string «< FEFF >» tags

    In indesign adobe cs6 version cannot get the string "< FEFF >. they do ""-empty space.

    Screen Shot 2015-09-23 at 6.01.25 PM.png

    Are the above-selected text contains several xml tags.

    but I get content using script code can't get the string.

    Screen Shot 2015-09-23 at 6.02.51 PM.png

    the script gives the result, xml tags are converted to "". ""  I expect "< FEFF >.

    I expect the output is: "< FEFF > Applescript < FEFF > < FEFF > selected text < FEFF > < FEFF > < FEFF >."

    Please help me...

    Thank you

    John Peter.

    the script gives the result, xml tags are converted to "". ""  I expect to ''.

    The xml tags are not converted to "" but "\uFEFF" (zero-width space non-bec), it is the character used to represent the tags in a text frame. Looks like the apple script converts a hexadecimal representation unicode values.

  • Dreamweaver CC: How to change the color of the selected text

    Maybe a stupid question, but I can't seem to figure it out, even with searches on the web.  I want to change the color of a single word in my HTML document.  Can anyone offer advice?

    I can change some styles of the selected text (bold, italic, etc.), but do not understand the color.

    Also, I know how to change the color of the different elements using CSS.  But for the selected text in an element, CSS here the simplest solution?

    Thanks in advance.

    carlg79335635 wrote:

    Thank you for that.  But I don't have a color option in my menu format.  It ends at some CSS Styles.  I have to allow him anywhere?  I use Dreamweaver CC.

    Yes.  I checked it and in CC DW, there is not a way to do as I suggested previously.  I was watching DW CS6 and he got it.

    Looks like you'll need to teach how them to manually code.  This will make them think about what they are doing and so concentrate better.

  • Is it possible to convert the selected text in javascript lines?

    Hi all

    I put a word to indesign cs 5.5 file is almost in a single table, I need to separate the text of the actual tables, is it possible to convert the selected text in javascript lines?

    If there is no way to do that, someone can help me to make a script to cut selected lines and place it in the right holders of the table pointer to make independent table and then convert to text?

    Hey brother,

    Simply select the rows or cells represent the lines and then run this Javascript code snippet:

    for (var r = 0; r < app.selection.length; r++) {
        for (var t = 0; t < app.selection[r].rows.length; t++) {
            for (var u = 0; u < app.selection[r].rows[t].cells.length; u++) {
                for (var c = 0; c < app.selection[r].rows[t].cells[u].paragraphs.length; c++) {
                    app.selection[r].rows[t].cells[u].paragraphs[0].move (LocationOptions.AFTER, app.selection[r].rows[t].parent.parent.storyOffset);
                    if (c < app.selection[r].rows[t].cells[u].paragraphs.length - 1)
                        app.selection[r].rows[t].parent.parent.storyOffset.contents += "\r";
                }
                if (u < app.selection[r].rows[t].cells.length - 1) {
                    app.selection[r].rows[t].parent.parent.storyOffset.contents += "\t";
                }
                else {
                    app.selection[r].rows[t].parent.parent.storyOffset.contents += "\r";
                }
            }
        }
    }
    for (var r = 0; r < app.selection.length; r++) {
        for (var t = app.selection[r].rows.length - 1; t >= 0; t--) {
            app.selection[r].rows[t].remove ();
        }
    }
    
  • How do the style of the selected text?

    I have some text formatted the way I like, apparently based on a different style of text. I mean InDesign: 'make a NEW paragraph in the selected text style.

    Can't seem to do it. Is there a way to do it please?

    Thank you!

    Once you have formatted a paragraph as you want, open the paragraph Styles Panel (window > Styles > paragraph Styles). In the Panel menu, choose new paragraph Style. The information contained in paragraph apply to the style definition.

  • Adjust alignment (spacing) of the selected text

    I'm looking for a script that will allow me to apply a tracking value specific to the selected text in InDesign. I'm still not a fan in the script.

    I found the following script in the referenced article: Script: adjust the text alignment (spacing)

    /*

    < javascriptresource >

    < name > character followed... < / name >

    < enableinfo > true < / enableinfo >

    < menu > automate < / menu >

    < about > adjust the kerning. < / about us >

    < category > typography < / category >

    < / javascriptresource >

    */

    If (app.documents.length > 0) {}

    var targettext = app.activeDocument.activeLayer.textItem;

    targettext. Tracking = parseInt (command prompt ("select the letter spacing value", 0));

    }

    It looks like that's about what I would do. Two problems, I think that it is only designed for Photoshop (?), and second, I want to use for only selected text, not the whole page. Also, I want to apply the script to a keyboard shortcut (I guess it's possible).

    Can someone help with this? Sorry to ask, but I have a big document of two columns with a large amount of follow-up to and looking for shortcuts to clicking or typing in the track drop-down list box.


    Thank you very much!

    For InDesign?

    Why you need a script? It is always built in and works with the selected text!

    Using InDesign | Default keyboard shortcuts

    Have fun

  • Create the style of the selected text paragraph?

    I am trying to create a paragraph style for the selected text in InDesign CS6 (Mac). There must be a simple command for this.

    For example, if I'm in the form of text which has no style paragraph and decide I want to save the formatting as a new style to apply it elsewhere, there is no command for 'create the new style of paragraph selected text'. The only option, seems, is to manually create a new paragraph style, click the style, which of course annihilates all the formatting desired, redo all the formitting (assuming a rememebers it), then right click on the paragraph style and hope that the option "Redefine a Style" is available (which is not often).

    Any guidance greatly appreciated.

    1 Select the text or keep blink, position the cursor on the text and the paragraph open style (press F11), on the paragraph style Panel, click the menu and choose new paragraph Style

    2. in this new paragraph Style dialog box, you can make your desire setting and check the box 'Apply the Style to selection'

    OR

    1. create your text of desire and click on this text created (or select the text) and click on create a new style button that is shown on the image

    2. When you click on create new style from the paragraph style list a paragraph style 1 is displayed but it will not be highlighted, it will highlight on the default style 'Standard paragraph', just click once on the style of paragraph 1 and double-click to rename.

    It will allow to keep the style of what you have created.

    Thank you

  • CS6: create a simple extension: how to copy the selected text in the extension?

    Hello

    with this tutorial http://www.DWfaq.com/Tutorials/Extensions/simple_object.asp

    I created a very simple extensions in Dreamweaver CS6.

    But I can't find out how to get the code/selected text "in" this extension.

    I want to reformat the selection with the javascript code for the extension and replace the selected text.

    Thank you!

    mtemp

    Thank you very much for your answer!

    I didn't know the difference between these two methods - my google search for 'extension' led me directly to the old tutorial mentioned...

    And, Yes, I had to search long enough to find the 'object' extension on the fly on the menu...

    Now, I adapted the code referred to in the dreamweaver_cs5_extending.pdf for the creation of such an extension of command - and, wow, it works... with 'copy' the text selected in the extension form.

    So, thanks again! Now I'm on the right track

  • How to get the selected text in a TextInput

    Hallo. I have a textinput, and when the event doubleclick on a part of the text is sent, I need to get the selected text, and then save it in a string... How can I do?

    THX

    Max

    Hi Maximist,

    Below is the code snippet to get the selected text in TextInput on double click event:

    http://www.Adobe.com/2006/mxml '.

    Layout = "vertical".

    verticalAlign = "middle".

    backgroundColor = "white" >

    Import mx.controls.Alert;

    private void textInput_doubleClick(evt:MouseEvent):void {}

    Alert.Show (String (evt.target.text) .slice (evt.target.selectionBeginIndex, evt.target.select ionEndIndex));

    }

    ]]>

    Text = "the Bullfighter is out the path of the bull charge at the last moment, drawing the cheers of the spectators."

    doubleClickEnabled = "true".

    doubleClick = "textInput_doubleClick (event); "/ >

    Hope this will help you.

    Thanks and greetings

    ------------------------------------------------------------------------------------

    Pooja Kuber | [email protected] | www.infocepts.com

    ------------------------------------------------------------------------------------

  • Limits of the selected text in cs3, Javascript

    Hi all

    That someone has the idea of how to get the bounds(x,y,width,height) of the selected text in the document cs3 via javascript. If so, please. share it. Here need urgent on this basis.

    Thanks in advance,

    Valentine

    http://forums.Adobe.com/message/3188272#3188272

  • apply the gradient to the selected text does not work

    with cs5, I click with the button straight on a text layer and choose select pixels and want to add a gradient to the selected text, but it says I need to rasterize the text first of all when I try to do it with the gradient tool? I thought you could do it without pixelation of text?

    Thanks for any clarification.

    Use a gradient overlay layer style or a gradient fill, cut on the text layer layer.

    Create a gradient layer style:

    http://help.Adobe.com/en_US/Photoshop/CS/using/WS76DA9F39-FFFA-4f3c-AC89-89FD52A84C02a.htm l

    Create a gradient fill layer:

    http://help.Adobe.com/en_US/Photoshop/CS/using/WS5A7BAC5F-EF4C-4fd1-94BB-6ACA59C8E73Fa.htm l #WS375F6CCC-1383-4729-A1CD-4D26F1C867DDa

    Clipped layer:

    http://help.Adobe.com/en_US/Photoshop/CS/using/WSfd1234e1c4b69f30ea53e41001031ab64-7853a.h tml

Maybe you are looking for

  • Someone at - it phone number of UK NO 0844xx for Toshiba support?

    Hello everyone. Like a computer 25 professional, I'm starting to wonder if I made the right choice by purchasing from the United Kingdom a Toshiba Camileo!I live in Turkey and have tried to register with the forum, but the site of the EU, but cannot

  • HP XW9400 x 2 Dual-Core 4.8 Ghz 16 GB RAM Windows 7 64 - Bit desktop Gaming PC

    Hi guys I am very interested in the above machine could you tell me if there is any limitation on the hard drive I can use such as what I should use drive HARD Hp or can I use standard hard drive I ask only that it will be a machine at home so cost i

  • LOST auto play or perhaps never had vista?

    I lost the AutoPlay or perhaps never had? Scanner, camera found missing with Iphone 4 install, they apple reloaded their drivers and the test said HP did, they said opps no guarantee read pages! I need auto play no wonder that my scanner has never wo

  • BlackBerry Maps put me in the wrong place

    If someone has dealt with BlackBerry Maps?  I'm trying to plot a point on the map and for a reason even if I'm him giving the coordinates for near Denver, it keeps drawing me in off the coast of Lisbon, in Spain. Here's the rental document that I sen

  • Unable to connect laptop Win 7 to Server 2008R2

    I have a company laptop that is configured to connect to a Server 2003 domain, when I'm at the office and a separate remote desktop connection. Here, at home, I have a server 2008R2 with another domain box.  I have another office here connected to th