Announcement

Collapse
No announcement yet.

Copy Text to Clipboard from currently selection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy Text to Clipboard from currently selection

    Hi all, I need to get the text from a currently selection of text, on notepad, browser or everywhere. Do you know the code to copy it into the clipboard?
    Actually I can do this but only into AMS, by using an input box as following:
    Code:
    Input.SetSelection("Input1", 1, -1);
    Input.Copy("Input1");
    Thanks for help me.

  • #2
    Hi friend, I'm interested in your idea because I use a lot of this things for my disabled community.
    I often use Sendkeys to to something on an external application so I think the problem is the application's window focus.
    For example I use this code followed by a Senkeys command to do almost everything on Firefox.

    Code:
    ---Set Window Focus---
    topwindow = Window.EnumerateTitles(false);
    for handle, title in pairs (topwindow) do
    result = String.Find(title, "Mozilla", 1, false);
    if (result ~= -1) then
    Window.SetOrder(handle, HWND_TOP);
    end
    end
    
    ---Send a Keystroke---
    This code and an UI with very big buttons (xButtons are great because recognized by screen readers) practically resolve all my pupil's problems.

    But in your case you need the focus on all the windows used in a specific moment.

    I hope some experienced users can help you, your is a very good idea, especially for Dyslexia.

    Comment


    • #3
      Hi Drag, thank you for reply, I'm alone!
      You are right, but is simply impossible to create a "Set Window Focus" for all the programs we use. That's why I decided to ask for help here.
      There is a commercial software that can handle all selections on any window, so I think AMS can do this without problems. This would be a beautiful thing because a disabled selects a text and with a simple click on the UI sends it to clipboard, finally and automatically it is read by TTS. Now we can do this but after the selection a "copy" click into Windows Shell is necessary.
      Many guys have trouble doing it because of right click and their fingers problems.
      I would do it all with a click, as you know our mouse is single shot.

      Comment


      • #4
        Oh my friend, I solved!!!
        By reading on this forum I found this code
        Code:
         
         hWnd = Application.GetWndHandle(); strCall = hWnd..",-20,".. Math.HexToNumber("0x08000000"); DLL.CallFunction(_SystemFolder .. "\\user32.dll", "SetWindowLongA", strCall, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
        As the author says: This code sets the application Window NEVER active, neither if you click on it

        So Andrew we will use this code followed by a keystroke to copy the text selection to clipboard.
        Only an help from some experienced user, how to avoid the lag on the application window?
        Using this code, the program moves so slow.

        Thanks in advance.

        Comment


        • #5
          Excuse me, the right code format is this:

          Code:
          hWnd = Application.GetWndHandle();
          strCall = hWnd..",-20,".. Math.HexToNumber("0x08000000");
          DLL.CallFunction(_SystemFolder .. "\\user32.dll", "SetWindowLongA", strCall, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
          Then I added a simple Ctrl+c on the button and all works fine, except for the UI lag.

          Code:
          ---Simulate Ctrl+c to send the text copied to the TTS Clipboard reader---
          SendKeys("^{c}")

          Comment


          • #6
            Wow, it works fine thank you very much.
            It will be perfect without the window lag. I've tried some empiric attempt but no results.
            Anyway I suggest to put the code on preload to avoid window problem after program close.
            Really hope that a master user could solve the lag issue.

            Comment

            Working...
            X