Jump to content

Copy


NewBe
 Share

Recommended Posts

Hello, I want a copy function but this do not work proper.

I wants it to only copy the selected text :)

#include <GUIConstants.au3>
$Form1 = GUICreate("Form1", 460, 328)
$Edit1 = GUICtrlCreateEdit("copy me", 0, 0, 457, 297)
$Button1 = GUICtrlCreateButton("copy", 0, 296, 75, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ClipPut(GUICtrlRead($Edit1))
            MsgBox(0 , "test" , ClipGet())
    EndSwitch
WEnd
Link to comment
Share on other sites

#include <GUIConstants.au3>
$Form1 = GUICreate("Form1", 460, 328)
$Edit1 = GUICtrlCreateEdit("copy me", 0, 0, 457, 297)
$Button1 = GUICtrlCreateButton("copy", 0, 296, 75, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GuiCtrlSetState($Edit1, $GUI_FOCUS)
            Send('^c')
            MsgBox(0 , "test" , ClipGet())
    EndSwitch
WEnd

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

This is how to get selection position

but I don't know how to get text from this positions.

#include <GUIConstants.au3>
#include <GuiEdit.au3>

$Form1 = GUICreate("Form1", 460, 328)
$Edit1 = GUICtrlCreateEdit("copy me", 0, 0, 457, 297)
$Button1 = GUICtrlCreateButton("copy", 0, 296, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $aSel = _GUICtrlEdit_GetSel ($Edit1)
            MsgBox(0 , "selection position" , "Start: " & $aSel[0] & @CRLF & "End: " & $aSel[1])
                        $text = GUICtrlRead($Edit1)
            ClipPut($text)
            MsgBox(0 , "test" , ClipGet())
    EndSwitch
WEnd
Link to comment
Share on other sites

$text = ControlCommand($Form1, '', $Edit1, 'GetSelected', '')

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 460, 328)
$Edit1 = GUICtrlCreateEdit("copy me", 0, 0, 457, 297)
$Button1 = GUICtrlCreateButton("copy", 0, 296, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$text = ControlCommand($Form1, '', $Edit1, 'GetSelected', '')
            ClipPut($text)
            MsgBox(0 , "test" , ClipGet())
    EndSwitch
WEnd
Edited by Zedna
Link to comment
Share on other sites

$text = ControlCommand($Form1, '', $Edit1, 'GetSelected', '')

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 460, 328)
$Edit1 = GUICtrlCreateEdit("copy me", 0, 0, 457, 297)
$Button1 = GUICtrlCreateButton("copy", 0, 296, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$text = ControlCommand($Form1, '', $Edit1, 'GetSelected', '')
            ClipPut($text)
            MsgBox(0 , "test" , ClipGet())
    EndSwitch
WEnd
Always have to do it the professional way... :)

Jk, I learned from this too...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...