Applescript to select text

Is it posible for an applescript to select text from a website.
For example:
Wikipedia pages are always in a same format.
So the applescirpt can select the fist two paragraphs of the article.
Same goes for most news webpages.
The articles are different but the format remains the same.
So I was wondering if it is possible for an applescript to select the text and read it or save it or something like that.
Thanks for your help!

Here is the basic workflow, using just the built-in actions:
To try to have Applescript pull the paragraphs, replace Get Text from Webpage with Run Applescript.
Or, you may need the Get Text action, and have the Applescript work on the text instead of the web page. I don't know what would work better.

Similar Messages

  • Pages '09: Can't use AppleScript for selected text inside tables?

    When I run get selection on selected text in a Pages document, I get something like this:
    <pre>text from character 1 to character 4 of body text of document id 9943974 of application "Pages"</pre>
    When I run get selection on selected text inside a table cell in a table in a Pages document, I get something like this:
    <pre>text from character 1 to character 4 of some table of document id 3539679 of application "Pages"</pre>
    When I run get selection on selected text inside a table cell in ANOTHER table in the same Pages document, I get the exact same thing. It still says "some" table. So there is no way to distinguish between tables if there are more than one table in the same Pages document.
    Am I correct in understanding that this means that most AppleScript commands for manipulating text are unusable inside table cells?
    For example, it seems impossible to get the properties of the selection when the selection is selected text inside "some" table. So it's impossible do anything about text styles, etc.
    Is AppleScript support in Pages ’09 really that limited, or am I missing something?

    The first script below should return the character style of any selection made in Pages ’09, whereas the second script should apply the "XXX" character style to any selection:
    --BEGINNING OF SCRIPT 1
    tell application "Pages"
    activate
    tell application "System Events" to tell process "Pages"
    -- Show the format bar:
    if not (pop up button 1 of window 1 exists) then
    click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
    end if
    -- Show the styles drawer and character styles:
    if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
    keystroke "t" using {shift down, command down}
    end if
    tell front window
    tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
    repeat until it exists
    delay 0.1 -- wait until the styles drawer is open
    end repeat
    if description is "show character style" then click
    end tell
    -- Get the row index (although it is not a property) of the character style:
    tell menu button 2 -- “Choose a character style.” menu button
    click
    set k to 0
    repeat
    set k to k + 1
    if value of attribute "AXMenuItemMarkChar" of menu item k of menu 1 exists then exit repeat
    end repeat
    keystroke return -- hide the menu
    end tell
    -- Get the character style name:
    if k > 1 then set k to k + 1
    value of static text 1 of row k of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
    end tell
    end tell
    end tell
    --END OF SCRIPT 1
    --BEGINNING OF SCRIPT 2
    set myStyle to "XXX" -- the name of the character style you want to apply
    tell application "Pages"
    activate
    tell application "System Events" to tell process "Pages"
    -- Show the format bar:
    if not (pop up button 1 of window 1 exists) then
    click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
    end if
    -- Show the styles drawer and character styles:
    if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
    keystroke "t" using {shift down, command down}
    end if
    tell front window
    tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
    repeat until it exists
    delay 0.1 -- wait until the styles drawer is open
    end repeat
    if description is "show character style" then click
    end tell
    set characterStyles to value of static text 1 of rows of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
    set k to 0
    repeat with thisStyle in the characterStyles
    set k to k + 1
    if thisStyle as text is myStyle then exit repeat
    end repeat
    -- Apply the character style:
    if k > 1 then set k to k - 1
    click menu button 2 -- “Choose a character style.” menu button
    click menu item k of menu 1 of menu button 2
    end tell
    end tell
    end tell
    --END OF SCRIPT 2
    I suppose that +paragraph styles+ should work the same.
    I'm beginning to know Pages ’09 a little better now.
    Message was edited by: Pierre L. (show format bar)

  • Applescript to copy selected text plus page URL in Safari

    I do a lot of online research. I would like to be able to select text then run an applescript to add the selected text plus the page URL to the clipboard. I have found a couple scripts that come close to what I want to do, but they don't work. They get the URL and usually some other information, but instead of the slected text, I get "missing value". Does anyone know how I can make this work?
    The scripts I found that do kind of what I want, but don't work are:
    http://allancraig.net/index.php?option=com_content&view=article&id=113:saving-se lected-text-and-url-from-safari-to-a-file&catid=40:applescript&Itemid=91
    http://hints.macworld.com/article.php?story=20080207080505152
    This script works, but it copies URL and page title rather than URL and selected text:
    https://gist.github.com/70565
    I would be so grateful for some help on this.

    After looking around a bit more –
    first here: https://discussions.apple.com/message/9643814#9643814
    then here: https://discussions.apple.com/thread/3197130?start=0&tstart=0
    – I was able to cobble together this script:
    tell application "Safari"
      activate
              set theURL to URL of front document
              set selectedText to (do JavaScript "(''+getSelection())" in document 1)
              set theDate to do shell script "date +'%d-%m-%Y'"
      set the clipboard to theURL & return & selectedText & return & theDate as string
    end tell
    which does the trick very nicely. (I added the date to make it easier to do my references in college assignments.) I used Automator to save it as a Service and assigned a a keyboard shortcut (option + c). I believe this will speed up my workflow tremendously.

  • Applescript to copy selected text to TextEdit without clipboard

    Hi,
    I am looking for an simple Apple Script that can copy any selected text, start TextEdit and paste it in. I have managed to do this with the clipboard but I would like it to work without clipboard. So that it copies the selected text to a variable and paste it from the variable afterwards.
    Is there any easy solution to this?

    if you're talikng about copying selected text anywhere, the easy solution is to use an automator service. 
    launch automator
    choose service
    choose 'receive selected text in any application' at the top - should be the default
    use the 'New TextEdit Document' action or the 'Set Contents of TextEdit Document' action, depending on what you need
    save, and run from the services menu
    if you want to select text from a specific application then you can use automator or get more fine-grained control by using Applescript, but appllescript doesn't have an easy way to get generic selected text.

  • Select text based on format (free form style text)

    As suggested by Apple, I'm trying to create my first ePub using Pages as opposed to inDesign.
    I only have a PDF as a source file and don't want to re-type all the text.
    When I copy the text from the PDF and paste to Pages, the text comes in with the 'free form' style applied no matter what options I select during copy and paste.
    In order to produce an ePub, I need to set styles for the text. This is quite tedious.
    Is there any way to select text based on the way it is formatted when styles are not applied to the text?

    Here is a script which may be useful if your problem surface again.
    --{code}
    --[SCRIPT words_attributes_to_Style]
    Enregistrer le script en tant que Script : words_attributes_to_Style.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
    Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
    Ouvrir un document Pages contenant des mots soulignés
    Aller au menu Scripts , choisir Pages puis choisir “words_attributes_to_Style”
    Le script appliquera :
    le style "Souligné" aux mots soulignés
    le style "Accentuation" aux mots en gras
    le style "Italic" (si vous l'avez créé) aux mots en italique.
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script: words_attributes_to_Style.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
    Maybe you would have to create the folder Pages and even the folder Applications by yourself.
    Select a Pages document embedding underlined words
    Go to the Scripts Menu, choose Pages, then choose “words_attributes_to_Style”
    The script will apply :
    the named style "Underlined" to the underlined words
    the named style "Emphasis" to bolded words
    the named style "Italic" (assuming that you defined it) to italicized words.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/11/13
    2011/11/13 enhanced by Nigel Garvey in : http://macscripter.net/viewtopic.php?pid=145883#p145883
    --=====
    on run
              set Underlined_loc to my getLocalizedStyleName("Pages", "Blank.template", "STYLE_Underline")
              set Emphasis_loc to my getLocalizedStyleName("Pages", "Blank.template", "STYLE_Emphasis")
              tell application "Pages" to tell document 1
                        set character style of words whose underline type is single underline or underline type is double underline to character style Underlined_loc
                        set character style of words whose bold is true to character style Emphasis_loc
    Assuming that you defined your own Italic style named "Italic", you may use : *)
                        try
                                  set character style of words whose italic is true to character style "Italic"
                        end try
              end tell
    end run
    --=====
    Example
    set Heading8_loc to my getLocalizedStyleName("Pages", "STYLE_Heading 8")
    Requires :
    getLocalizedName()
    on getLocalizedStyleName(theApp, tName, x)
      activate application theApp
              tell application "System Events"
                        (application file of application process theApp as text) & "Contents:Resources:Templates:" & tName & ":Contents:Resources:"
                        return my getLocalizedName(theApp, x, result)
              end tell
    end getLocalizedStyleName
    --=====
    on getLocalizedName(a, x, f)
              tell application a to return localized string x from table "Localizable" in bundle file f
    end getLocalizedName
    --=====
    List of default styles embedded in the Blank template :
    "STYLE_Body" = "Corps";
    "STYLE_Body Bullet" = "Puce du corps de texte";
    "STYLE_Bullet" = "Puce";
    "STYLE_Caption" = "Légende";
    "STYLE_Emphasis" = "Accentuation";
    "STYLE_Footnote Text" = "Texte de note de bas de page";
    "STYLE_Free Form" = "Format libre";
    "STYLE_Harvard" = "Harvard";
    "STYLE_Header & Footer" = "En-tête et bas de page";
    "STYLE_Heading 1" = "Sous-section 1";
    "STYLE_Heading 2" = "Sous-section 2";
    "STYLE_Heading 3" = "Sous-section 3";
    "STYLE_Heading 4" = "Sous-section 4";
    "STYLE_Heading 5" = "Sous-section 5";
    "STYLE_Heading 6" = "Sous-section 6";
    "STYLE_Heading 7" = "Sous-section 7";
    "STYLE_Heading 8" = "Sous-section 8";
    "STYLE_Heading 9" = "Sous-section 9";
    "STYLE_Legal" = "Légal";
    "STYLE_None" = "Aucun";
    "STYLE_Normal" = "Normal";
    "STYLE_Normal 22" = "Normal 22";
    "STYLE_Normal 4" = "Normal 4";
    "STYLE_Normal 8" = "Normal 8";
    "STYLE_Numbered List" = "Liste numérotée";
    "STYLE_Series_0" = "Series_0";
    "STYLE_Series_1" = "Series_1";
    "STYLE_Series_2" = "Series_2";
    "STYLE_Series_3" = "Series_3";
    "STYLE_Series_4" = "Series_4";
    "STYLE_Series_5" = "Series_5";
    "STYLE_Strikethrough" = "Barré";
    "STYLE_TOC" = "Table des matières";
    "STYLE_TOC Heading 1" = "Sous-section 1 de table des matières";
    "STYLE_TOC Heading 2" = "Sous-section 2 de table des matières";
    "STYLE_TOC Heading 3" = "Sous-section 3 de table des matières";
    "STYLE_TOC Heading 4" = "Sous-section 4 de table des matières";
    "STYLE_Title" = "Titre";
    "STYLE_Underline" = "Souligné";
    "STYLE_[Null]" = "[Nul]";
    You may use more sophisticated custom styles embedding several properties:
    baseline shift (real) : Raise or lower the target text.
    bold (boolean) : Whether the font style is bold.
    capitalization type (all caps/normal capitalization/small caps) : Whether a capitalization style is applied.
    character background color (color) : The color of the character's background.
    color (color) : The color of the font.
    font name (text) : The name of the font.
    font size (real) : The size of the font.
    italic (boolean) : Whether the font style is italic.
    ligatures (all ligatures/default ligatures/none) : Remove ligatures from the target text if the document is set to use ligatures.
    name (text) : The name of the style.
    outline (boolean) : Whether the font style is outline.
    shadow (boolean) : Whether the text box content casts a shadow or not.
    shadow angle (real) : The directional angle, in degrees, that the shadow is cast.
    shadow blur (integer) : The relative amount of blur of images seen through the shadow.
    shadow color (color) : The color of the shadow.
    shadow offset (real) : The offset from the text box content that the shadow extends to.
    shadow opacity (real) : The amount of opacity for the shadow, in percent.
    strikethrough color (color) : The color of the strikethrough line(s).
    strikethrough type (double strikethrough/none/single strikethrough) : Whether one or more lines are drawn through the characters.
    subscript (boolean) : Decrease the font size and lower the baseline of the text.
    superscript (boolean) : Decrease the font size and raise the baseline of the text.
    tracking (real) : The space between text characters, in percent.
    underline color (color) : The color of the underline(s).
    underline type (double underline/none/single underline) : Whether the font style is underline.
    --[/SCRIPT]
    --{code}
    Yvan KOENIG (VALLAURIS, France) lundi 2 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : http://public.me.com/koenigyvan
    Please : Search for questions similar to your own before submitting them to the community
    For iWork's applications dedicated to iOS, go to :
    https://discussions.apple.com/community/app_store/iwork_for_ios

  • Applescript to select specific airport network

    hi all,
    I'd like to write an applescript to select a specific airport network named 'NETGEAR'
    I haven't got much experience with Applescript and I can't get Automator's 'Watch Me Do' to work properly.
    What i'd like done is:
    -select the airport menu (in the menu bar)
    -select the wifi network 'NETGEAR'
    using automator and applescript editor, I've got the following scritpt:
    on run {input, parameters}
        -- Click the “AirPort Menu Extra” menu bar item.
        delay 1.664016
        set timeoutSeconds to 2.0
        set uiScript to "click menu bar item 6 of menu bar 1 of application process \"SystemUIServer\""
        my doWithTimeout(uiScript, timeoutSeconds)
        return input
        -- NETGEAR
        delay 0.882737
        set timeoutSeconds to 2.0
        set uiScript to "click menu item \"NETGEAR\" of menu 1 of menu bar item 6 of menu bar 1 of application process \"SystemUIServer\""
        my doWithTimeout(uiScript, timeoutSeconds)
        return input
    end run
    however, this returns the dialogue: 'AppleScript Error (null)'. So clearly something isn't right.
    I'm sure that whatever mistakes I'm making are pretty obvious to someone who's more familiar with scripting.

    I am so sorry to bother you again. I have another question about how to create a script to change Safari downloaded folder.                                                                            Automatically changing Safari's downloads folder                    
    I have searched a script but it seems to have problem. How should i do?
    -- Set alternative drive name to use as downloads folder here
    set dlFolder to convertHome("/Volumes/Untitled")
    tell application "Finder"
         if exists [POSIX file dlFolder] then
              -- Do Nothing and use the folder
         else
              -- set dlFolder to default home directory
              set dlFolder to (POSIX path of (path to home folder as text)) & "Downloads"
         end if
    end tell
    -- get current path from safari plist
    set currentpath to convertHome(do shell script "defaults read com.apple.Safari DownloadsPath")
    -- change path only if the current setting does not match the input path (there is something to change)
    if (currentpath as text) is not equal to (dlFolder as text) then
         -- if Safari is running, change settings through Safari's preferences
         if appIsRunning("Safari") then
              -- determine the frontmost application to restore when script is done
              set frontApp to path to frontmost application as text
              -- copy the download folder path to the clipboard
              set the clipboard to dlFolder as text
              activate application "Safari"
              tell application "System Events" to tell application process "Safari"
                   -- open the preferences or bring to front (window 1)
                   keystroke "," using {command down}
                   delay 1 -- pauses in window display may result in an error, so we wait a second
                   -- Change to the General tab
                   click button "General" of tool bar 1 of window 1
                   -- Change download location to Other
                   tell pop up button "Save downloaded files to:" of group 1 of group 1 of window"General"
                        click
                        click menu item "Other..." of menu 1 -- three dots is an ellipsis, not three periods
                   end tell
                   -- Open the "go to folder" dialogue box
                   keystroke "g" using {shift down, command down}
                   -- Paste the folder path into the location field
                   tell window "Go To Folder"
                        keystroke "v" using {command down}
                        keystroke return
                   end tell
                   click button "Select" of sheet 1 of window "General"
                   -- close the preferences
                   keystroke "w" using {command down}
              end tell
              -- restore frontmost application after job is complete
              tell application frontApp to activate
         else
              -- if Safari is NOT running, then use the defaults command to change the preferences
              do shell script ("defaults write com.apple.Safari DownloadsPath " & dlFolder)
         end if
    end if
    -- Function to convert home path references to full paths
    on convertHome(currentpath)
         if currentpath contains "~/" then
              set oldDelimiter to AppleScript's text item delimiters
              set AppleScript's text item delimiters to {"~/"}
              set textPath to every text item of currentpath
              set AppleScript's text item delimiters to oldDelimiter
              set currentpath to POSIX path of (path to home folder as text) & item 2 in textPath
         end if
         return currentpath
    end convertHome
    -- Function to check if application "appName" is running (in this case, used for Safari)
    on appIsRunning(appName)
         tell application "System Events" to (name of processes) contains appName
    end appIsRunning

  • Can no longer select text in email template or read only field with mouse using IE or Firefox?

    Hi Guys,
    I can no longer select text in email template or read only field using my mouse in IE or Firefox anymore. We are using CRM 2011 rollup 18 applied with IE 11 and the latest version of Firefox. We only applied roll up 18 in Feb when this issue began.
    Thanks
    Dave
    David Kelly

    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    (You also can clear Firefox's cache completely using:
    orange Firefox button ''or'' Tools menu > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now")
    (2) Remove the site's cookies (save any pending work first) using either of these. While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    Then try reloading the page. Does that help?
    These features rely on JavaScript, and it sounds as though you have scripting enabled if you get (the wrong) color changes. Some add-ons might alter the way scripts operate, so a standard diagnostic to bypass interference by extensions (and some custom settings) is to try Firefox's Safe Mode.
    First, I recommend backing up your Firefox settings in case something goes wrong. See [[Backing up your information]]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
    Next, restart Firefox in Firefox's Safe Mode ([[Safe Mode]]) using
    Help > Restart with Add-ons Disabled
    In the dialog, click "Start in Safe Mode."
    If those features work correctly, this points to one of your extensions or custom settings as the problem.
    To also disable plugins, you can use this page:
    orange Firefox button ''or'' classic Tools menu > Add-ons > Plugins category
    Any change?

  • Select text from all_views returns an empty string

    My application allows the user to select between the Data Provider for ODBC and the Data Provider for Oracle. (ODP)
    When using the ODBC provider the statement:
    Select text from all_views where view_name='MYVIEW'
    returns the expected string.
    If I connect via ODP however it returns an empty string.
    (If I use 'Select *' it tells me the text_length is 154 in this specific case - so there is definately text available.)
    I'm thinking it has something to do with the fact that the data type is LONG.
    In both cases I retreive the data using rdr.GetChars(), which should work.
    If I use the dbms_metadata.get_ddl function instead, it does return the string (Probably because the return type is not LONG)
    Unfortunately that function only works for Views in the current schema, while the original Select works for any view.
    (And I dont know what version of Oracle this function was added in - I have to support older versions too.)
    Similarly, if I use one of the XML functions to retreive the text as XML it works fine.
    (Again it is probably returned as a VARCHAR2 instead of a LONG.)
    The strange thing is that when I created my own table containing a LONG column I was able to load and retreive data without any problems.
    The problem appears to be specific to this column in all_views.
    Anyone know a solution to this?
    Thanks
    Mike

    Thanks that was it.
    I had not seen those properties since I am working with the 'generic' objects (DbCommand rather than OracleCommand, etc.)
    What is strange is that I was able to retreive data from my own LONG column WITHOUT setting this value to -1.
    (It defaulted to 0 in both cases.)
    The only difference was that when I retreived data from my own column I specified CommandBehaviour.SequentialAccess.
    When I retreived the all_views.text column I did not specify a behaviour at all.
    However the Oracle docs said that SequentialAccess is not supported ... so I guess that is not correct.
    (Maybe it doesn't 'work', but it certainly seems to cause things to work differently)
    Thanks
    Mike

  • Print/Save Selected Text to PDF

    I want to use Mozilla Firefox very much for a long time. I like it because the UI is very clean, easy to use, the icon vey pretty. When I use in my Android Mobile, it is very easy and intelligent to select content of page site. Very good!
    But I had to install Chrome instead so I've always been using "Print a selected content to PDF" but I couldn't find ways to do that with Firefox. Chrome is doing very good.
    I searched all add-ons, pdf printer software but they are only saving or printing all the page (website) to PDF.
    Please help me the ways to save a selected content to PDF. Thanks very much.

    Hii hanh01001..
    I think i know one solution to the problem
    https://addons.mozilla.org/en-US/firefox/addon/print-selected-text/?src=api
    this is an add on that is used to print the selected text only..
    have a nice day :) :)
    ---Thanks tracy :)

  • Create a dynamic form where selected text boxes appears, based on options chosen in a drop-down box

    HELP!!! Can anyone please provide some guidance on how to create a dynamic form where selected text boxes appears, based on options chosen in a drop-down box.
    I have a form which – based on the department that's selected from a drop-down box – will have different form fields/text boxes, etc, made available.
    Is this possible in LiveCycle, if so, can you please provide the script/info - as needed.
    Thanks,

    In the preOpen event of the second dropdown list you put something like (in formCalc):
    if (dropdown1 == 1) then
    $.clearItems()
    $.setItems("Year, 2 Year,  3 Year")
    elseif (dropdown1 == 2) then
    $.clearItems()
    $.setItems("3 Year,  4 Year")
    endif

  • How to select text from a webpage

    hi. i have firefox for my n900. i would like to know how to select some text from a webpage so i can copy and paste it. thanks for the help. i couldn't it anywhere.

    First tap where you want the selection to start. (It might help to zoom in as far as possible first. You can do this using the volume buttons in the newly-released Firefox 1.1rc1.) Then hold the Shift key while pressing the arrow keys on the N900 keyboard to select text.
    Note: We are aware that this is not a very user-friendly way to select text, and we hope to include a better design in a future version of mobile Firefox.

  • Get selected text from af:inputText

    Hi,
    I am using an <af:inputText> component, within which I would want to know if any text has been selected.
    InputText.getValue() would give me the total value that is there within the inputText component. But if I have selected a part of the text, I would like to get hold of that.
    Is there a way in ADF, to get that selected Text ?
    Thanks,
    Pawan.

    Hi,
    If I am to use javascript, can i directly use the IE/FF (browser-specific) code to get hold of the selected text ?
    The ADF javascript API doesn't seem to have a way to get the selected text.
    Thanks,
    Pawan.

  • Why does my cursor not automatically select the entire word when I try to select text by starting/ending in the middle of a word?

    In any other browser I've used (or word processor, for that matter) when I select text using my mouse cursor, if I start and/or end in the middle of a word, it automatically selects the whole word when I'm selecting more than one word. But for some reason this is not happening in Firefox. If I try to select say 3 words, and I start in the middle of the first word and end in the middle of the last word, it will only select those parts, not all 3 words entirely.

    Firefox allows to select part of a word. You can select a word with a double click and use Shift + left click to set the end of the selection, so you need to click at the end of the last word instead of in it.

  • Problem with focus and selecting text in jtextfield

    I have problem with jtexfield. I know that solution will be very simple but I can't figure it out.
    This is simplified version of situation:
    I have a jframe, jtextfield and jbutton. User can put numbers (0-10000) separated with commas to textfield and save those numbers by pressing jbutton.
    When jbutton is pressed I have a validator which checks that jtextfield contains only numbers and commas. If validator sees that there are invalid characters, a messagebox is launched which tells to user whats wrong.
    Now comes the tricky part.
    When user presses ok from messagebox, jtextfield should select the character which validator said was invalid so that user can replace it by pressing a number or comma.
    I have the invalid character, but how can you get the focus to jtextfield and select only the character which was invalid?
    I tried requestFocus(), but it selected whole text in jtextfield and after that command I couldn't set selected text. I tried with commands setSelectionStart(int), setSelectionEnd(int) and select(int,int).
    Then I tried to use Caret and select text with that. It selected the character I wanted, but the focus wasn't really there because it didn't have keyFocus (or something like that).
    Is there a simple way of doing this?

    textField.requestFocusInWindow();
    textField.select(...);The above should work, although read the API on the select(...) method for the newer recommended approach on how to do selection.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • How to get selected text values in a textarea by mouse click?

    Hi Everyone,
    What I am trying to do is to click on some texts in a textarea, then get the selected text value.
    If you guys have used an accounting software called Simply Accounting, you might understand better.
    I list all my customer names in a textarea. What I want is, when I click on one customer, another GUI pops up with this customer's information. My problem is that I don't know how to get the selected text value from a textarea.
    Could anyone give a hand here? Thank you in advance.

    Is there some reason you aren't using a JList or
    JTable to display
    the user names/information?Thank you for es5f2000's reply. You just gave me a better idea! There is not a particular reason I have to use TextArea to list my customers. As long as the component can make my idea alive, I definitely use it. Still, if there is any way to get a selected text value, it will help me a lot with my project. Thank you.

Maybe you are looking for

  • Installing Adobe CS from iMac to MacBook Air... NOT!

    Got my new MBA yesterday - beautiful. Remote Disk? Not so beautiful. I'm trying to install a new version of Adobe CS on my MBA using Remote Disk from drive on my iMac. 1. Installed Remote Disk software on my iMac. 2. Enabled DVD or CD sharing in the

  • IPhoto Trash can is not getting empty.

    I am trying to use iPhoto trash can method.  just click on emtpy trash can.  But it is not working. Recently, I cleaned up my library, and deleted about 13k photos.  When I click empty, shows status bar, and it appears stucked.  I need to force out i

  • Ant fails to compile modules which use interfaces

    Hi, I am having a major problem compiling flex modules with ANT. I will try to give ALL necessary information so we can avoid days of useless novice questions. I have an application that uses many modules.  They DO compile perfectly in flash builder.

  • SAPSCRIPT Print Preview / Output Type Options?

    When in a PO, ME23N, I do a Print Preview. For one of our businesses it displays two output types for selection, ZSBL and ZSTK, for another business (consolidated in the same test system) it just displays output without any selection options. Where i

  • How can I get a new search box for each new tab?

    When I open a new tab, I would like a new, dedicated search box that is owned by it. This would help to keep the context preserved when doing searches on multiple, separate topics. Is there a way to configure this or an add-on to do it?