torels Posted September 30, 2008 Posted September 30, 2008 Hi there How do I get the selected text in a _GuiCtrlEdit ? thaks in advance Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
Minikori Posted September 30, 2008 Posted September 30, 2008 (edited) Hi thereHow do I get the selected text in a _GuiCtrlEdit ?thaks in advance If you mean an edit control, then GUICtrlRead() will do it.EDIT: Oh selected text, my bad. Edited October 1, 2008 by Minikori For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com
PsaltyDS Posted September 30, 2008 Posted September 30, 2008 Hi there How do I get the selected text in a _GuiCtrlEdit ? thaks in advance >_< You get the selection by start/stop character offsets with _GuiCtrlEdit_GetSel(). Then just use StringMid() to pick it out. Demo: expandcollapse popup#include <GuiEdit.au3> #include <GuiStatusBar.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Global $avSelection[2], $sText Global $StatusBar, $hEdit, $hGUI Global $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & _ "\include\changelog.txt" Global $aPartRightSide[3] = [190, 378, -1], $aSel ; Create GUI $hGUI = GUICreate("Edit Get Sel", 400, 300) $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL)) $StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide) _GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll") GUISetState() ; Set Margins _GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10) ; Set Text _GUICtrlEdit_SetText($hEdit, FileRead($sFile)) ; Set Sel _GUICtrlEdit_SetSel($hEdit, 15, 20) ; Loop until user exits Do ; Get Sel $aSel = _GUICtrlEdit_GetSel($hEdit) If ($aSel[0] <> $avSelection[0]) Or ($aSel[1] <> $avSelection[1]) Then $avSelection = $aSel _GUICtrlStatusBar_SetText($StatusBar, "Start: " & $aSel[0]) _GUICtrlStatusBar_SetText($StatusBar, "End: " & $aSel[1], 1) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE $sText = StringMid(_GUICtrlEdit_GetText($hEdit), $avSelection[0], $avSelection[1] - $avSelection[0] + 1) MsgBox(64, "Selection", $sText) GUIDelete() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
torels Posted October 1, 2008 Author Posted October 1, 2008 Thanks PsaltyDS =D Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
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