NewBe Posted February 6, 2008 Share Posted February 6, 2008 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 More sharing options...
Achilles Posted February 6, 2008 Share Posted February 6, 2008 #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 More sharing options...
Zedna Posted February 6, 2008 Share Posted February 6, 2008 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 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted February 6, 2008 Share Posted February 6, 2008 (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 February 6, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
NewBe Posted February 6, 2008 Author Share Posted February 6, 2008 Perfect it works great. Link to comment Share on other sites More sharing options...
Achilles Posted February 7, 2008 Share Posted February 7, 2008 $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 WEndAlways 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now