Sign in to follow this  
Followers 0
NewBe

Copy

6 posts in this topic

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

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$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

Share this post


Link to post
Share on other sites

Perfect it works great. :)

Share this post


Link to post
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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0