BrettF Posted February 5, 2007 Share Posted February 5, 2007 My _GUICtrlEditTextClipboard function will copy/cut text from an edit to the clipboard. The problem- it wont cut. COuld some one please tell me why?? #Include <GuiEdit.au3> Func _GUICtrlEditTextClipboard($Edit, $type = "Copy") $a_sel = _GUICtrlEditGetSel($Edit) If ($a_sel == $EC_ERR) Then Return 2 ;Error Getting Selection Pos EndIf Local $WholeEdit = GUICtrlRead($Edit) Local $Trim = StringLeft(StringTrimLeft($WholeEdit, $a_sel[1]), $a_sel[2] - $a_sel[1]) If $type = "Copy" Then ClipPut($Trim) Return 0 ;Sucsessful Copy ElseIf $type = "Cut" Then ClipPut($Trim) _GUICtrlEditReplaceSel($Edit, 1, "") Return 1 ;Sucsessful Cut Else Return 3 ; Error with type of clipboard EndIf EndFunc ;==>_GUICtrlEditTextClipboard Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 5, 2007 Share Posted February 5, 2007 Hi, it does the cut for me. expandcollapse popup#Include <GuiEdit.au3> #include <GUIConstants.au3> GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL)) $b = GUICtrlCreateButton("ok", 10, 160, 40, 20) GUISetState() ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "Second line" & @CRLF & " Hallo", 1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $b Then _GUICtrlEditTextClipboard($myedit, "Cut") WEnd Func _GUICtrlEditTextClipboard($Edit, $type = "Copy") $a_sel = _GUICtrlEditGetSel($Edit) If ($a_sel == $EC_ERR) Then Return 2 ;Error Getting Selection Pos EndIf Local $WholeEdit = GUICtrlRead($Edit) Local $Trim = StringLeft(StringTrimLeft($WholeEdit, $a_sel[1]), $a_sel[2] - $a_sel[1]) If $type = "Copy" Then ClipPut($Trim) Return 0 ;Sucsessful Copy ElseIf $type = "Cut" Then ClipPut($Trim) _GUICtrlEditReplaceSel($Edit, 1, "") Return 1 ;Sucsessful Cut Else Return 3 ; Error with type of clipboard EndIf EndFunc ;==>_GUICtrlEditTextClipboard So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 5, 2007 Moderators Share Posted February 5, 2007 (edited) That function could be shrunk a tad:expandcollapse popupFunc _GUICtrlEditTextClipboard($nCID, $sType = '') Local $aSel = _GUICtrlEditGetSel($nCID) If $aSel = -1 Then Return SetError(1, 0, -1) Local $sText = StringMid(GUICtrlRead($nCID), $aSel[1] + 1, ($aSel[2] - $aSel[1]) + 1) If $sType = 'copy' Then Return ClipPut($sText) ClipPut($sText) Return _GUICtrlEditReplaceSel($nCID, 1, "") EndFunc ;==>_GUICtrlEditTextClipboardoÝ÷ ØGb´k²Â,¥vè¾'^jw±jjezíá!(§q쨹Øm=«¢+Ø¥¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíÕ¥¥Ð¹ÔÌÐì)¥´ÀÌØíµå¥Ð°ÀÌØíMÑÑÕÌ°ÀÌØíµÍ°ÀÌØí ѹ}P°ÀÌØí}Í°)U% ÉÑ ÅÕ½Ðí¥ÐÐ1¥¹ ½Õ¹ÐÅÕ½Ðì°ÌäÈ°ÈÔФ(ÀÌØíµå¥ÐôU% Ñɱ ÉѥРÅÕ½Ðí¥ÉÍб¥¹ÅÕ½ÐìµÀì I1°ÄÐÀ°ÌÈ°ÄÈÄ°äÜ° ¥Ñ=H ÀÌØíM}UQ=YM I=10°ÀÌØí]M}YM I=10°ÀÌØíM}5U1Q%1%9¤¤)U% ÑɱMÑ1¥µ¥Ð ÀÌØíµå¥Ð°ÄÔÀÀ¤(ÀÌØíMÑÑÕÌôU% Ñɱ ÉÑ1° ÅÕ½ÐìÅÕ½Ðì°À°ÈÌаÌäÈ°ÈÀ° ¥Ñ=H ÀÌØíMM}MU9-8°ÀÌØíMM} 9QH¤¤(ÀÌØí ѹ}PôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐíÐM°ÅÕ½Ðì°ÄÔÀ°ÄÌÀ°äÀ°ÐÀ°ÀÌØí M}5U1Q%1%9¤(ìÝ¥±°ÁÁ¹½¹ÐÌäì½ÉÐÍÉÁɵÑÈ)U% ÑɱMÑÑ ÀÌØíµå¥Ð°ÅÕ½Ðìɹ±¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìÍɱ¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìÑÑ ±¥¹ÅÕ½ÐìµÀì I1µÀì|(ÅÕ½ÐìÕÑ ±¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìÙÑ ±¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìÝÑ ±¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìáÑ ±¥¹ÅÕ½ÐìµÀì I1µÀìÅÕ½ÐìåÑ ±¥¹ÅÕ½Ðì°Ä¤)U%MÑMÑÑ ¤(ìIոѡU$չѥ°Ñ¡¥±½¥Ì±½Í)]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤(M±Ð( ÍÀÌØíµÍôÀÌØíU%}Y9Q} 1=M(á¥Ñ1½½À( ÍÀÌØíµÍôÀÌØí ѹ}P($$%}U% Ñɱ¥ÑQáÑ ±¥Á½É ÀÌØíµå¥Ð¤(¹M±Ð)]¹)Õ¹}U% Ñɱ¥ÑQáÑ ±¥Á½É ÀÌØí¹ %°ÀÌØíÍQåÁôÌäìÌäì¤(1½°ÀÌØíM°ô}U% Ñɱ¥ÑÑM° ÀÌØí¹ %¤(%ÀÌØíM°ô´ÄQ¡¸IÑÕɸMÑÉÉ½È Ä°À°´Ä¤(1½°ÀÌØíÍQáÐôMÑÉ¥¹5¥¡U% ÑɱI ÀÌØí¹ %¤°ÀÌØíM±lÅt¬Ä° ÀÌØíM±lÉt´ÀÌØíM±lÅt¤¬Ä¤(%ÀÌØíÍQåÁôÌäí½ÁäÌäìQ¡¸IÑÕɸ ±¥ÁAÕÐ ÀÌØíÍQáФ( ±¥ÁAÕÐ ÀÌØíÍQáФ(IÑÕɸ}U% Ñɱ¥ÑIÁ±M° ÀÌØí¹ %°QÉÕ°ÅÕ½ÐìÅÕ½Ðì¤)¹Õ¹ìôôÐí}U% Ñɱ¥ÑQáÑ ±¥Á½É Edited February 5, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
BrettF Posted February 6, 2007 Author Share Posted February 6, 2007 Ok, Thanks... I'll post the UDF now... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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