Script to examine the Clipboard before pasting

I had some success using an beforePaste() event listener to help users avoid pasting text formatted in places where they should not. This script could be a lot smarter if it would first make the contents of the Clipboard. Even a simple count of paragraphs would be a great help.

Crew on this forum, it is clear that the more current idea to check the contents of the Clipboard in the JS is to create a temporary text box, paste in and then to get the content of the temporary image. But I think remember that AppleScript was directly access the contents of the Clipboard and having read VBscript might as well.

So: someone at - it a code snippet that shows how to use VBscript to get the content of the Clipboard and send it to javascript?

The following works on Mac and theoretically should work on Windows, but I don't have an easy way to test at the moment.

alert(GetClipboard());
function GetClipboard(){
    var clipboard;
    if(File.fs == "Macintosh"){
        var script = 'tell application "Finder"\nset clip to the clipboard\nend tell\nreturn clip';
        clipboard = app.doScript (script,ScriptLanguage.APPLESCRIPT_LANGUAGE);
    } else {
        var script = 'Set objHTML = CreateObject("htmlfile")\r'+
        'returnValue = objHTML.ParentWindow.ClipboardData.GetData("text")';
        clipboard = app.doScript(script,ScriptLanguage.VISUAL_BASIC);
    }
    return clipboard;
}

Tags: InDesign

Similar Questions

  • After hiighlighting a Word and paste it into another document, the Clipboard does not; When I hit enter again and again blocks. How should I do?

    When I select a word or phrase and copy to the Clipboard, then paste it into another area of the Clipboard does not erase the expression. Therefore, every time that I type and press the Enter key it continues paste the sentence throughout my document. I have the latest download of Firefox are installed (16.0, win 7 and that's when it started.) How to stop this heinous behavior so I can type a sentence with normality?

    Louise

    Try Firefox Safe mode to see how it works there.

    A way of solving problems, which disables most of the modules.

    The problems of Firefox using Firefox SafeMode

    When in Safe Mode...

    • The State of plugins is not affected.
    • Custom preferences are not affected.
    • All extensions are disabled.
    • The default theme is used, without a character.
    • userChrome.css and userContent.css are ignored.
    • The layout of the default toolbar is used.
    • The JIT Javascript compiler is disabled.
    • Hardware acceleration is disabled.
    • You can open the mode without failure of Firefox 15.0 + by pressing the SHIFT key when you use the desktop Firefox or shortcut in the start menu.
    • Or use the Help menu option, click restart with the disabled... modules while Firefox is running.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before using the shortcut of Firefox (without the Shift key) to open it again.

    If it's good in Firefox Safe mode, your problem is probably caused by an extension, and you need to understand that one.

    http://support.Mozilla.com/en-us/KB/troubleshooting+extensions+and+themes

    When find you what is causing that, please let us know. It might help others who have this problem.

  • How to paste into the text field of the Clipboard with JavaScript?

    I implement the following actions in the form of javascript:

    1. a user clicks on a link on the PDF to open a web page

    2. the user uses the web page to find information and then copy text from the web page

    3. the user clicks a button on the pdf form and it formats the text to the Clipboard and paste them into the text fields.

    I can't find any references for the reading of the data from the Clipboard with javascript in PDF Forms. is it not possible?

    Perhaps 'not possible' was a little too hard. It would be a security hole if she accepts a script in a form to copy the contents of the Clipboard without the user explicitly allowing it. It has been possible to copy the contents of the Clipboard into a form field using the app.execMenuItem method without the user knowing / allowing it, but that hole was closed. The restriction can be overcome, as explained in the documentation: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.143.html

  • I want to copy a picture of the paint and paste it into an email. System always told me that it records to the Clipboard.

    original title: Clipboard

    I want to copy a picture of the paint and paste it into an email.  System always told me that it records to the Clipboard.  Where can I get this Clipboard so that I can paste the photo?   Thank you.

    Hello

    CTRL + C copies to the Clipboard.

    CTRL + V paste it from the Clipboard.

    These FREE utilities will help in the use of the Clipboard.

    InsideClipBoard - free - whenever you have something to copy to the Clipboard to paste in another
    application, the copied data is saved in several formats. The main application of Windows Clipboard
    only display the basic Clipboard, like text and bitmaps formats, but only displays the list of all formats
    which are stored in the Clipboard. InsideClipboard is a small utility that displays the binary content of all
    formats that are currently stored in the Clipboard and allow to save the content of specific format
    in a binary file.
    http://www.NirSoft.NET/utils/inside_clipboard.html

    Another useful utility free allowing you to clear the Clipboard.

    ClipBoard Viewer - free - look inside your Windows Clipboard. See what your favorite
    ask, in four different (TXT, BMP, WMF and DIB) data format. This handy tool can also
    Clears the Clipboard. New version 2.0: now go to the Windows system tray! http://www.KarenWare.com/PowerTools/ptclpvue.asp

    I hope this helps and happy holidays!

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • How can I copy the list of names of files in the finder and set the Clipboard filenames separated by commas?

    Hi guys, I was wonder if anyone can give me a hand with a script.

    I need to be able to paste a list of file names of the files as follows:

    0001.jpg 0002.jpg 0003.jpg 0004.jpg

    At the moment, if I select the files in the Finder, copy to the Clipboard and paste them in TextEdit, they are like this:

    0001.jpg

    0002.jpg

    0003.jpg

    0004.jpg

    I found a similar but slightly different script and I don't know how to change it. Here it is:

    Define extension_list to {"jpg", "" JPG","jpeg","JPEG"}

    the value cbNames (Clipboard text) paragraphs

    Set csvNames to {}

    the tid value delimiters to point to the text of the AppleScript

    the text value of the AppleScript point delimiters ".»

    -now, make a list of names without extensions

    Repeat with the names in cbNames

    If the point 2 of the text names is extension_list then

    copy of text 1 of names at the end of csvNames

    end if

    end repeat

    Journal csvNames

    -now the filenames as comma CONCATENATE string separated

    the text value of the point delimiters AppleScript «»

    csvNames value cross-as text

    the text value of the point AppleScript delimiters tid

    There is an easier way. Open a TextEdit document and paste the list in. Place the cursor at the end of the first item and drag it to the start of the second.

    Press on + command + c to copy and then command + f to bring up find it. Press command + v (do not click in the first search field). Check the 'Replace' box, click in the field replace, and then type a comma and a space.

    Click 'All' and then 'done '.

  • Shift + 2 key combination also paste text to the Clipboard

    I use a Dell Inspiron laptop. About 3 days ago, when I pressed Shift + 2, it not only print symbol @, also paste the text into the Clipboard.

    For example:

    I copy the "cat" text, and then type my email, it is assumed to be @live.com, but prove @catlive.com

    The same problem also happens to other shift-[number key] except number 5 and 6.

    This problem has never happened before, and the only thing I installed recently is driver dell wireless (re - INSTALL a week ago).

    Do you have any idea how to solve this problem?

    Hello Hoang,

    Thanks for posting your question on the Microsoft community.

    I would like to know some information about the problem so that we can help you better.

    You did it all change software on your computer before the show.

    Thank you for details on the issue.

    Sometimes, this problem may occur because of incorrect security software settings.

    I suggest you disable security software and check if that helps.
    Reference:
    Disable the anti-virus software
    http://Windows.Microsoft.com/en-us/Windows/disable-antivirus-software#1TC=Windows-7

    Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    See also:
    Clipboard issues
    http://TechNet.Microsoft.com/en-us/library/cc749442 (v = WS.10) .aspx

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Copied images in the Clipboard, but not paste them, now they lost can be recovered?

    Hello

    I tried to put some pictures on my camera to my laptop.

    I don't know what happened, but the images were copied (Clipboard) but I can't paste them...

    I cannot now find them... Can they be retrieved from the Clipboard?

    Hello

    I tried to put some pictures on my camera to my laptop.

    I don't know what happened, but the images were copied (Clipboard) but I can't paste them...

    I cannot now find them... Can they be retrieved from the Clipboard?

    ==================================
    If the Clipboard was erased, you cannot retrieve
    files of it.

    Might be interesting to try to download the photos again...
    If the photos have been removed from the memory
    Card... There is a possibility that you can find them
    with the following free software:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Recuva - file recovery
    http://www.Recuva.com/

    Introduction of Recuva (tutorials)
    http://docs.Piriform.com/Recuva/introducing-Recuva

    Good luck.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • CS6 is not paste the last text on the Clipboard, but older

    OSX 10.8.2, InDesign CS6

    I can't paste text from Word 2011 mac in Indesign CS6. When I try to paste the text into InDesign text before the current copy is displayed. (although the legal text is on the Clipboard). The problem is that InDesign stops after trying this 3 - 4 times.

    Someone knows this problem and has a solution?

    No, its okay but not the text of the last copy, but the one that precedes it.

    This is how it goes:

    1. I copy text from word

    2. paste in InDesign with no problems

    3 copy text to another word

    4 paste in InDesign to show the text in step 2 and not the text copied in step 3

    5 remove the pasted text

    6 paste times shows the correct text in step 3

    ...

    After repeated 3 - 4 times what InDesign closes

    I hope my explanation is understanable

    Best regards

  • Add icon for 'paste the image to the Clipboard as stamp tool' in the toolbar.

    I had to configure Acrobat 9 all over again after getting a new computer and I swear to you that I remember having a quick access on the toolbar icon for "paste the image to the Clipboard as stamp tool.

    Now I have to go to the dropdown for the tool to access when buffer before having its own icon in the toolbar.

    How to get set up on my old computer?

    Thanks for the help.

    I found the answer.

    RT-click on the comments (I rt-click on the stamp tool) toolbar

    Select Show all the annotation tools.

    There you go, now just to rt - click again in this area and remove the additional tools that came by deselecting them.

    Now you will see him stick the image to the Clipboard as a tool as a quick tool.

  • -Pasting from the Clipboard

    Let me preface this by saying I installed Snow Leopard, but I can't honestly remember if this problem started before or after the installation. I have not had any problems to do this before.

    My problem seems to stick my Clipboard from a source outside of Acrobat 9.1.3. I change the work of other artists done in Illustrator and introduced to me in Acrobat. I sometimes attracted an example of work in Illustrator, copy (usually using command/shift/4 then control/click-drag) to the Clipboard, then just order a v in Acrobat and all goes well. But lately, the work will not stick. What sticks is the text that was before the Clipboard of the work.

    I tried to use the snapshot tool with the same results. I can paste the Clipboard work in Illustrator very well - even MSWord, but not Acrobat. I tried copying and pasting from Acrobat, Acrobat and it won't work. I can copy of Acrobat, Illustrator successfully. Just not in Acrobat.

    With success, I can't copy / paste of text and lines and points and arrows in the markup menu in Acrobat. At I have accidentally trips a switch, that I'm not aware? Or is it a thing of Snow Leopard?

    My (not the best) solution is to save the Illustrator any example in PDF format page, then slide in after the page I am annotating in Acrobat. It works a little, but clumsy. As I said, everything was fine until recently. It has always worked fine before.

    Suggestions?

    No problem. I inherited this very particular character of my father. We might as well say or write something innocent for us and it means go, and he came to another sounding like they were insulting.

    It happens to the best of us.

    (Please note the information is given by an experienced user of Acrobat.) I'm not an Adobe employee).

  • The menu copy paste the text in email on my iPad disappears before I can click on it

    I am able to select text in an email, but the options menu to copy the text and paste it disappears before I can use it. How can I stop it endangered?

    Try a simple Reset: hold down the Home and Power buttons until you see the Apple logo (10 to 20 seconds).

  • Numbers AppleScript: paste the Clipboard as lines below

    New to AppleScript in numbers...

    How to use AppleScript to paste the contents of the Clipboard into an existing document of numbers (3.6.1) and additional lines, please?

    The number of lines varies whenever I need to do that; they are already separated by tabs.

    Thank you!

    Something like this might work:

    -Guess the Clipboard contains data delimited by tabs and the numbers document is open

    the value theText to (Clipboard) as text

    the value newRows to (count the paragraphs of theText)

    point of the value oldDelimiters to AppleScript text delimiters

    the value Text item of AppleScript delimiters

    Repeat with j from 1 to newRows

    j. paragraph set theRecord to text elements of letexte

    say application "Numbers".

    -indicates a reference to the table to which you want to add information

    define will be used in table 1 to sheet 1 of the document 1

    say where

    Add the line below last line

    Repeat with I 1 to the number of columns

    value the value of cell of the last row I've got to the point I of theRecord

    end Repeat

    end say

    end say

    end Repeat

    the value Separators to AppleScript text point oldDelimiters

  • Programmatically paste an image from the Clipboard into the LabVIEW picture control

    Does anyone know how to paste the image residing in the Windows Clipboard in a LabVIEW picture control programmatically?

    There is a method of the Application class that gets the image to the Clipboard. He was deprived in previous versions, but it has been made public in 2012, so I guess that this also works very well in older versions. At least in never gave me problems with my limited experience with it:

  • help sites Web copy to the Clipboard, and then paste it on Facebook

    Hello...

    How can I copy and paste all the web pages I want to paste it into Facebook. In my Touchpad.

    When I click on the address of the Web site, at the top of the page, it, correctly, highlights the entire address, however, in the drop down menu, on the left, there is no option exemplary editing past etc.

    In addition, the only other way I found, is to try to send the link, then try to copy the link in the email send, however, that e-mail is the name of the web page text, providing a link to the page. So I can not stick to Facebook from the email.

    Am I mistaken.

    can I ask function to copy the web address to the Clipboard.

    Also is there an easy way to copy the web address on the Clipboard so you can paste facebook.

    Thank you. :-)

    Here's how:

    Press and hold on the link.  Depending on how long you hold that it can produce two results - for me, this usually points to the whole link then keyboard appears and the cursor go to the link.  Not a problem, now tap and hold your finger there until the bubble 'Select Select all stick them' opens.  Tap "select all" and the link has been copied to the Clipboard.  To where you want that it stuck and just hold your finger on the screen until the bubble even opens.  Choose 'Paste' and the link.

    From time to time, it works as it should - press and hold the link, it becomes yellow, tap again and the 'Copy' option bubble will appear.  I think that it depends on to know if the keyboard is displayed when you press the link.  Keyboard upwards and you touch & hold = "cut copy paste" dialog, keyboard facing downwards = the dialog box "select Select all paste them.

    HTH,

    WyreNut

  • How can I access my copy and paste the clipboard history to return a paragraph?

    I was on Facebook and I cut and paste a few answers to a friends post when Facebook, remove the previous cut and paste on the wall of the person.  How can I go back in the history of the Clipboard and access a previous cut and paste paragraph?

    Rather than write it all over again from memory, it would be much faster and easier if I could recover the previous cut and paste.

    Does make sense?

    Thanks for any help.

    GSY

    Hi Joanne,

    You use Internet Explorer to access Facebook?
     
    It is not possible to recover deleted items. I suggest you
    you contact Facebook support and check if it helps.

Maybe you are looking for