litlmike Posted March 2, 2007 Share Posted March 2, 2007 In the forums if you create a post you can modify text by using the button to insert code. For instance, if the user highlights a word and presses the bold icon the forum inserts the code for bold on each side of the word/phrase. I am trying to do this in a GUI, but I don't know how to get the data that is highlighted. I thought that _GUICtrlEditGetSel would work, but it returns the Position not the data highlighted. What should I look at to accomplish this? I started with this, but this obviously doesn't work: Case $Button2 $Cur_Sel = _GUICtrlEditGetSel($Edit1) $Mod_Sel = "<b>" & $Cur_Sel & "</b>" _GUICtrlEditReplaceSel($Edit1, TRUE, $Mod_Sel) Thanks in Advance. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
tAKTelapis Posted March 2, 2007 Share Posted March 2, 2007 Erm.. what is $Edit1 ? Wanna post code with a full gui in it? As i cannot run that code. Link to comment Share on other sites More sharing options...
BrettF Posted March 2, 2007 Share Posted March 2, 2007 This is a copy function that was made by SmokeN. Func Copy($edit1) Dim $edit1 $a_sel = _GUICtrlEditGetSel($edit1) Local $WholeEdit = GUICtrlRead($edit1) Local $Trim = StringLeft(StringTrimLeft($WholeEdit, $a_sel[1]), $a_sel[2] - $a_sel[1]) ClipPut($Trim) EndFunc ;==>Copy 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...
litlmike Posted March 2, 2007 Author Share Posted March 2, 2007 This is a copy function that was made by SmokeN. Func Copy($edit1) Dim $edit1 $a_sel = _GUICtrlEditGetSel($edit1) Local $WholeEdit = GUICtrlRead($edit1) Local $Trim = StringLeft(StringTrimLeft($WholeEdit, $a_sel[1]), $a_sel[2] - $a_sel[1]) ClipPut($Trim) EndFunc ;==>Copy oÝ÷ Ûú®¢×«b²÷«ÉÉ^½êÈÂ¥v¯zØhºm¶«{ .Ö¥æÉ·~éܶ*'~í+ºÛaȬj ÞjÜÊÚqÊ&¦X¬+Cj¹ÈÂ+!!Ê.ØZ½ëa¢è!¶í«S©ä³}ÀÊ!z·¢²lv¥7r^~Ú*'zâ׫zËS+(}Ê.®Ç¢²z-¶°^±Êâ¦Öî¶ÈhºW[yéèºm¢ÈhÂØ^×jëh×6 Case $Button2 $Cur_Sel = Copy() $Mod_Sel = "<b>" & $Cur_Sel & "</b>" _GUICtrlEditReplaceSel($Edit1, TRUE, $Mod_Sel) Func Copy() $a_sel = _GUICtrlEditGetSel($Edit1) Local $WholeEdit = GUICtrlRead($Edit1) Local $Trim = StringLeft(StringTrimLeft($WholeEdit, $a_sel[1]), $a_sel[2] - $a_sel[1]) Return $Trim EndFunc ;==>Copy _ArrayPermute()_ArrayUnique()Excel.au3 UDF 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