Programatically copying text to the clipboard

Short: I need to programatically copy a string of text from
either a variable or a hidden control field to the clipboard.
Long: We have a requirement to allow the user to 'pop-up' a
list of frequently used words, select one from the list and have
it pasted into a field on the form. What I would prefer to do
is select the user's words into an LOV and have the chosen word
placed into a hidden field. If I could move the contents of
that field to the clipboard, I can place the focus back in the
original field ('keep cursor position' = yes) and used the
PASTE_REGION built-in to insert the text without overwriting
anything.
The other method I have been experimenting with is creating my
own 'List of Values' form. I'm using a t-list to display the
user's word list. When-List-Changed copies the word to a visible
text field and an OK button places the focus in the text field,
executes the SELECT-ALL built-in, then the COPY-REGION built-in
and returns to the calling form with the word in the clipboard.
Problems: The user can't shrink the list by typing like they can
with an Oracle LOV. When the focus is in the t-list, the
DEFAULT functionality of the OK button doesn't happen. I can't
get a When-Mouse-Doubleclick trigger to fire while in the t-list.
In the end, I prefer the first method (the LOV) BUT... I have to
have a field visible on the form to place focus in, select all
of the text and copy to the clipboard. This field looks silly.
I'm sorry this question is so long winded. Thank you for
reading it all. Does anyone know how I might accomplish this
requirement (professionally)?
Thank you,
Fouad

Short: I need to programatically copy a string of text from
either a variable or a hidden control field to the clipboard.
Long: We have a requirement to allow the user to 'pop-up' a
list of frequently used words, select one from the list and have
it pasted into a field on the form. What I would prefer to do
is select the user's words into an LOV and have the chosen word
placed into a hidden field. If I could move the contents of
that field to the clipboard, I can place the focus back in the
original field ('keep cursor position' = yes) and used the
PASTE_REGION built-in to insert the text without overwriting
anything.
The other method I have been experimenting with is creating my
own 'List of Values' form. I'm using a t-list to display the
user's word list. When-List-Changed copies the word to a visible
text field and an OK button places the focus in the text field,
executes the SELECT-ALL built-in, then the COPY-REGION built-in
and returns to the calling form with the word in the clipboard.
Problems: The user can't shrink the list by typing like they can
with an Oracle LOV. When the focus is in the t-list, the
DEFAULT functionality of the OK button doesn't happen. I can't
get a When-Mouse-Doubleclick trigger to fire while in the t-list.
In the end, I prefer the first method (the LOV) BUT... I have to
have a field visible on the form to place focus in, select all
of the text and copy to the clipboard. This field looks silly.
I'm sorry this question is so long winded. Thank you for
reading it all. Does anyone know how I might accomplish this
requirement (professionally)?
Thank you,
Fouad

Similar Messages

  • I find that I can no longer copy text to the clipboard.

    Why can I no longer copy text to my clipboard?

    Here is a little more information.  Last week everything worked fine.  I opened the same document yesterday and tried to copy some text to the clipboard and now I get an error message saying "can not copy to clipboard, internal error.  I also find that pdf files from the internet will not load and all I get is a small black x box in the upper left corner of the screen.  Went through the steps in control panel and adobe is enabled.

  • Copying text to the clipboard in AVDocDidOpen event handler causes Acrobat 9 to crash

    I'm trying to copy the filename of a document to the clipboard in a plugin with my AVDocDidOpen event handler.  It works for the first file opened; however when a second file is opened, Acrobat crashes.  The description in the application event log is: "Faulting application acrobat.exe, version 9.1.0.163, faulting module gdi32.dll, version 5.1.2600.5698, fault address 0x000074cc."
    I've confirmed that the specific WIN32 function that causes this to happen is SetClipboardData(CF_TEXT, hText);  When that line is commented out and remaining code is left unchanged, Adobe doesn't crash.
    Is there an SDK function that I should be using instead of WIN32's SetClipboardData()?  Alternately, are there other SDK functions that I need to call be before or after I call SetClipboardData()
    Bill Erickson

    Leonard,
    I tried it with both "DURING, HANDLER, END_HANDLER" and "try catch," as shown below.  However, it doesn't crash in the event handler; it crashes later, so the HANDLER/catch block is never hit.
    The string that's passed to SetClipboardData() is good, because I'm able to paste it into the filename text box of the print dialog when I try to create the "connector line" PDF.  I also got rid of all the string manipulation and tried to pass a zero-length string to the clipboard but it still crashes.
    Here's the code:
    ACCB1 void ACCB2 CFkDisposition::myAVDocDidOpenCallback(AVDoc doc, Int32 error, void *clientData)
        PDDoc pdDoc = AVDocGetPDDoc(doc);
        char* pURL = ASFileGetURL(PDDocGetFile(annotDataRec->thePDDoc));
        if (pURL)    {
            if (strstr(pURL, "file://") && strstr(pURL, "Reviewed.pdf")) {
                // Opened from file system so copy filename to clipboard for connector line report
                char myURL[1000];
                strcpy(myURL, pURL);
                ASfree(pURL);    // Do this before we allocate a Windows handle just in case Windows messes with this pointer
                pURL = NULL;
                HGLOBAL hText = GlobalAlloc(GMEM_MOVEABLE, 1000);
                if (hText)    {
                    try
                        // Skip path info and go right to filename
                        char *pText = (char *)GlobalLock(hText);
                        char *pWork = strrchr(myURL,'/');
                        if (pWork)    {
                            strcpy(pText, pWork+1);
                        } else {
                            strcpy(pText, myURL);
                        char *pEnd = pText + strlen(pText);    // Get null terminator address
                        // Replace "%20" in filename with " "
                        pWork = strstr(pText, "%20");
                        while (pWork)    {
                            *pWork = ' ';
                            memmove(pWork+1, pWork+3, (pEnd - (pWork+2)));
                            pWork = strstr(pText, "%20");
                        // Append a new file extension
                        pWork = strstr(pText, ".pdf");
                        *pWork = 0;    // truncate the string before ".pdf"
                        strcat(pWork,".Connectors.pdf");
                        GlobalUnlock(hText);     // Must do this BEFORE SetClipboardData()
                        // Write it to the clipboard
                        OpenClipboard(NULL);
                        EmptyClipboard();
                        SetClipboardData(CF_TEXT, hText);     // Here's the culprit
                        CloseClipboard();
                        GlobalFree(hText);
                    } catch (char * str) {
                        AVAlertNote(str);
            if (pURL)
                ASfree(pURL);

  • Button to copy text to the clipboard

    Reading the document "Javascript for Acrobat API Reference" Page 120:
    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf
    the document discusses the execMenuItem command. From all that I have researched it appears I cannot create a button that copies text from a text field to the UI clipboard. 
    On page 121 the API reference says:
    To ensure a secure environment, the menu items that can be executed are limited to the following:
    ●AcroSendMail:SendMail
    ●ActualSize
    ●AddFileAttachment
    ●BookmarkShowLocation
    ●Close
    ●CropPages
    ●DeletePages.............
    ..............●ZoomViewOut
    The list is long but nowhere is "Copy" mentioned. I don't want to surreptitiously copy text or use a trusted function. I am content with the user knowing a button just copied a field of text. I just want to skip the highlighting of multiple field to get all the text. Does anyone know a way around this? I would like to copy a text field to the clipboard so the text can be entered elsewhere in another program.

    All I know is they made this impossible a long time ago, like with Acrobat 5 or 6. I recall because I took advantage of it and never discovered a workaround.

  • Is it possible to copy text to the clipboard in Illustrator via Javascript ?

    I am working on a very basic script that exports coordinates from Illustrator.
    At the moment I am just outputing the values via $.writeln()
    I was wondering if I could copy the output values to the clipboard. If so, what
    am I looking for in the API ?
    Thanks,
    George

    For an actionscript project I will need to animate a few hundred objects to certain destinations. These destinations are given by a designer who works on the look and feel of things in Illustrator.
    I would like to make it as simple as possible for the designer to adjust things visually in Illustrator, then he can get a snippet to test in Flash as well.
    Thank you very much for the applescript idea!
    I'll use something like:
    app.system("osascript -e 'set the clipboard to \"" + code + "\"'");

  • Writing text in the clipboard

    Hi,
    To write text in the clipboard the natural way is to use the StringSelection flavor. The problem is it requires a String to work on. But here I have a big volume (xml) that I generate from a DOM like structure => I would like to stream the generated xml in the clipboard without loading it in a String.
    Anybody knows if it is possible by writing a custom Data Flavor ?
    Thanks,
    Jean

    Look at the ArrayListTransferHandler class in the following Drag List Demo example: http://www.java2s.com/Code/Java/Swing-JFC/DragListDemo.htm

  • Copy text to Windows clipboard

    I need to copy text, either from a Flash textArea component
    or a text member, to the Windows clipboard so it can be pasted into
    a form field in a web page. I'm trying to streamline a data entry
    process and alleviating CTRL+C will be a big help. Does anyone know
    a way of doing this?
    Thanx in advance.

    If you do not need it in Shockwave, there is the free
    clipboard xtra
    from the wonderful Valentin Schmidt...
    http://staff.dasdeck.de/valentin/xtras/clipboard/
    That has a whole of of control over the clipboard and its
    contents/formats.
    If you just need a simple text to/from the clipboard routine,
    then you
    can use BuddyAPI's baCopyText() and baPasteText()

  • 11.1.1.5 - Unable to copy XML to the clipboard

    Could someone do a quick check in 11.1.1.5 and see if you're experiencing this? Click the Catalog link on the common header. Click the More icon for any analysis or KPI. Click Copy. The XML should be on the clipboard, right?
    Now try to paste into a text editor. For me, nothing happens.

    Hi,
    Did you refreshed GUID after applied obiee11.1.1.16.8BP?
    Bug Ref: (catalog might be corrupted) also refer oracle bug info..
    12779543 DASHBOARD ERROR CATALOG OBJECT SCHEMA VALIDATION FAILED AGFIXBO2:EIRWWH9E
    12427582 10G->11G UPGRADE: CATALOG OBJECT SCHEMA VALIDATION FAILED : AGFIXBO2:EIRWWH9E
    Thanks
    Deva

  • Unable to copy text values in CLipboard in Ubuntu 8.1

    Hi all ,
    Im using the following code to copy the text:
    import java.awt.Toolkit;
    import java.awt.datatransfer.Clipboard;
    import java
         .awt
         .datatransfer
         .StringSelection;
    import java
         .awt
         .datatransfer
         .Transferable;
    public class TextWriter {
         public static void writeToClipboard(String writeMe) {
              // get the system clipboard
              Clipboard systemClipboard =
                   Toolkit
                        .getDefaultToolkit()
                        .getSystemClipboard();
              // set the textual content on the clipboard to our
              // transferable object
              // we use the
              Transferable transferableText =
                   new StringSelection(writeMe);
              systemClipboard.setContents(
                   transferableText,
                   null);
         public static void main(String[] args) {
              System.out.println(
                   "Writing text to the system clipboard.");
              String writeMe =
                   "I'd like to be put on the clipboard";
              writeToClipboard(writeMe);
    }After running the application when I try to paste it in GEDIT , it is not pasting .
    Also in menubar the PASTE is also not getting enable.
    Can anybody tell how to copy text .
    OS used Ubuntu 8.1 and java version 1.6 update 10
    Thanks and regards
    Anshuman Srivastava

    Copy cannot be disabled to my knowledge. Did you try quitting Safari and resetting your iPad? To quit an app double click the Home button to reveal the row of recently used apps. Flick up on the page preview and it will fly away and disappear. That quits the app. Then Press and hold both the Home button and the Sleep/Wake button continuously until the Apple logo appears. Then release the button and let the device restart. You will not lose data doing this. It's like a computer reboot.

  • I can't copy text in the Firefox.

    I select the text, select the copy function, but when i try to paste elsewhere, the clipboard is always empty

    @<b>togrulko</b>:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    # Shockwave Flash 10.0 r42
    # Java Plug-in 1.6.0_13 for Netscape Navigator (DLL Helper)
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • Copying data to the clipboard cause windows 8 to lock up

    Whenever I copy to the clipboard Windows 8 will lock up for about 20-30 seconds and then it will finally work. After that it will work fine for a little while. Then the problem will repeat. I am tried running sfc /scannow and everything reports OK. I also
    don't see any errors in the event logs. Please help

    To turn off UAC, go to the Control Panel, then User Accounts.
    Under the header, "Make changes to your user account", there is an entry titled "Change User Account Control Settings".
    Pick it, and drag the slider all the way down to "Never Notify".
    Access of Japan is the company Palm hired to write Palm Desktop 6.2.2.  
    WyreNut
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • Why after a recent systems update, I can't copy text from the internet (every web page) and paste into word?

    MacBook Pro Community,
    I need help. After a recent systems update this week, I can not longer copy and paste text from the internet. I have never had this problem before. I have searched through systems preference and google'ed it. Please help!!
    Thank you!

    A book is a lot of work and in the end needs to not only be openable, printable, but also be laid out with facing pages amongst other numerous desirable features.
    None of which suggest Pages 5 to me.
    If you want to persist in Pages 5.5 you will have to laboriously cut and paste the content into one file and hope that will still be usable when you are finished.
    Or you could export to Pages '09 or pdf format and assemble it there.
    Peter

  • Can't highlight and copy text from the Podcast Information window

    With previous versions of iTunes I was able to convert Podcasts to AIFF files in my music library and then copy the track notes and text from the information window pane in Podcasts. With iTunes 8, I can get the information windows to pop-up but the text is not highlightable. Any ideas how I can cut and paste the info? thanks.

    I think I finally figured out the copy paste podcast thing and I do not know why I did not think of this earlier.
    Instead of clicking on the "i" symbol to get the information about the podcast to come up in the window that you cannot copy and paste from, hit command i or File> Get Info. The window that opens is just like the one that opens when you get info from a track in your regular music library. You can copy and paste from this one, even if it is a Podcast.
    paul

  • [AS] Moving copied text to the end of a Text frame with Applescript?

    I'm trying to run an IF statement that eventually will check for 3 wild card characters (@,—," - ") and then copy that paragraph information into the end of another textbox that my script is also creating.
    Here's a snippet of what i'm stuck on...
    tell application "Adobe InDesign CS5"
              repeat with i from 1 to (count of paragraphs)
                        try
                                  tell paragraph i
                                            set ThePage to my get_CurrentPage()
                                            try
      (*Check for wildcard " - "*)
                                                      if it contains " – " then
                                                                set applied paragraph style to "AD SIZE"
                                                                set Ad_Size to contents
                                                                set {This_Width, This_Height} to {"", ""}
                                                                repeat with This_Ad in Ad_Props
                                                                          if Ad_Size contains (Ad_Label of This_Ad) then
                                                                                    set This_Width to Ad_Width of This_Ad
                                                                                    set This_Height to Ad_Height of This_Ad
                                                                                    exit repeat
                                                                          end if
                                                                end repeat
                                                                set Ad_Box to my Make_Box(ThePage, {1.875, 10.875, This_Height + 1.875, This_Width + 10.875})
      duplicate contents to (insertion point -1 of Ad_Box)
      (*Check for wildcard "—"*)
                                                      else if it contains "—" then
                                                                set applied paragraph style to "AD REP"
      duplicate contents to (insertion point -1 of Ad_Box)
      (*Check for wildcard "©"*)
                                                      else if it starts with "©" then
                                                                set applied paragraph style to "AD PLACEMENT"
      delete (character 1)
      duplicate contents to (insertion point -1 of Ad_Box)
                                                      else
      duplicate contents to (insertion point -1 of Ad_Box)
                                                      end if
                                            end try
                                  end tell
                        on error errmsg number errnum
                                  display dialog "There has been an error " & "[" & i & "] (" & errmsg & " [" & errnum & "])" buttons {"Okay"} default button 1 with icon stop
                        end try
              end repeat
    end tell
    The whole script makes the boxes like I need, but it's not moving the content to the Ad_Box. I think the problem is here:
      duplicate contents to (insertion point -1 of Ad_Box)
    But I can't figure out the right script. Racking my brain all day. Any help would be greatly appreciated!!
    Here's a block of text i'm using this with if it helps to visualize it:
    1/4 –
    Ad Name
    P/U—SW
    ©12
    FULL –
    Ad Name
    C/R—SW
    ©9
    FULL –
    Ad Name
    C/R—SW
    ©5
    Message was edited by: Luke Hodsdon (fixed coding & spelling mistakes)

    I've been tinkering with trying to figure out where this would work, and I can't seem to figure it out. I have tried many different itterations of this code, but have had no luck. It either puts nothing into the Ad_Box container, or I get an error, but i've yet to successfuly be able to duplicate anything.
      duplicate (contents of paragraph i) to insertion point -1 of Ad_Box
    I've also moved this code our of the "tell paragraph i" statement as you stated.

  • Copying text to WIndows clipboard

    I have a JTextPane and want to be be to cut & paste text from it to Windows ckipboard so I can paste into
    Windows.
    So if I select text displayed in 12 point Arial, I will
    get the Text in Word from a paste but not the style.
    I can cut and paste the text but none of the styles
    (font family,size) come across. Is it possible to do
    this??
    MArk

    instead of creating your own cut, copy, and paste methods:
    if you are using a JTextComponent, use its JTextComponent.cut()/copy()/paste()

Maybe you are looking for

  • Why does iTunes not give me the option to backup my iPhone?

    I have three iPhones in my family. On two of the iPhones, I am able to plug them into my computer and do a local backup (by selecting it in iTunes, right clicking and choosing "Back Up"). There is one phone, however, that does not allow me to choose

  • IPhone4 wifi connection not working

    my iphone4 now no longer connects to the home wifi network or any other wireless network (so all data is provided trough 3G!!) It picks up the wifi signal (the network is shown with a check/tick mark next to it) but the phone does not connect. I have

  • J2me polish compilling in netbeans

    I'm trying to integrate netbeans with j2me polish but when rebuilding I get an error Buildfile: build.xml clean.tar.src: clean.resources: clean.devices: clean: build.tar.src:       [tar] Building tar: D:\projects\MobileClient1\CP_Phone_Backup-Src.tar

  • F4140 not working. cant remove, software says it's not installed but then wont re-install

    The printer isn't working so I want to remove and re-install BUT the printer is not in Add/Remove Programs (I have XP).  I downloaded the complete install package and tried to uninstall it that way, but the unistall program says nothing is installed.

  • Search in iTunes doesn't seem to work now.

    Search in iTunes doesn't seem to work now.