RazerM Posted April 1, 2006 Share Posted April 1, 2006 is it possible to have an input box, and when certain text is highlighted and the user clicks a button, it is wrapped in tags such as: this is some text (lets say 'some' is highlighted) user clicks bold the text becomes this is [bold]some[/bold] text My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Lazycat Posted April 1, 2006 Share Posted April 1, 2006 (edited) It's possible - of course. Very little that you can't do in Autoit #include <GUIConstants.au3> Global $EM_GETSEL = 0x00B0 Global $EM_REPLACESEL = 0x00C2 ; == GUI generated with Koda ==); $Form1 = GUICreate("AForm1", 622, 448, 192, 125) $Edit1 = GUICtrlCreateEdit("", 8, 8, 401, 273) GUICtrlSetData($Edit1, "this is some text (lets say 'some' is highlighted)") $Button1 = GUICtrlCreateButton("Bold", 8, 304, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 WrapToTag($Edit1, "bold") Case Else ;;;;;;; EndSelect WEnd Func WrapToTag($control, $tag) Local $editpos = GUICtrlRecvMsg($control, $EM_GETSEL) If UBound($editpos) = 0 Then Return Local $selection = StringMid(GUICtrlRead($control), $editpos[0]+1, $editpos[1]-$editpos[0]) GUICtrlSendMsg($control, $EM_REPLACESEL, 0, StringFormat("[%s]%s[/%s]", $tag, $selection, $tag)) EndFunc Edited April 1, 2006 by Lazycat Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
RazerM Posted April 1, 2006 Author Share Posted April 1, 2006 thanks for the reply, it works My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 1, 2006 Moderators Share Posted April 1, 2006 It's possible - of course. Very little that you can't do in Autoit #include <GUIConstants.au3> Global $EM_GETSEL = 0x00B0 Global $EM_REPLACESEL = 0x00C2 ; == GUI generated with Koda ==); $Form1 = GUICreate("AForm1", 622, 448, 192, 125) $Edit1 = GUICtrlCreateEdit("", 8, 8, 401, 273) GUICtrlSetData($Edit1, "this is some text (lets say 'some' is highlighted)") $Button1 = GUICtrlCreateButton("Bold", 8, 304, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 WrapToTag($Edit1, "bold") Case Else ;;;;;;; EndSelect WEnd Func WrapToTag($control, $tag) Local $editpos = GUICtrlRecvMsg($control, $EM_GETSEL) If UBound($editpos) = 0 Then Return Local $selection = StringMid(GUICtrlRead($control), $editpos[0]+1, $editpos[1]-$editpos[0]) GUICtrlSendMsg($control, $EM_REPLACESEL, 0, StringFormat("[%s]%s[/%s]", $tag, $selection, $tag)) EndFuncThat's awesome LC!! 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...
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