Floppy Posted December 22, 2008 Share Posted December 22, 2008 (edited) Hello, sorry for my bad english, but I'm italian... I'm wrote the following script, but I receive an error on red line #include <GuiConstantsEx.au3> GUICreate("Html Editor",500,500) GUICtrlCreateEdit("",10,50,480,440) [color=red]GUICtrlCreateCheckbox("B",10,10,30,30,$BS_PUSHLIKE)[/color] GUISetState(@SW_SHOW) While 1 $m=GUIGetMsg() Select Case $m=$gui_event_close ExitLoop EndSelect WEnd The log says: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\FSoft\Desktop\Mailer\Html Editor.au3" C:\Users\FSoft\Desktop\Mailer\Html Editor.au3 (15) : ==> Variable used without being declared.: GUICtrlCreateCheckbox("B",10,10,30,30,$BS_PUSHLIKE) GUICtrlCreateCheckbox("B",10,10,30,30,^ ERROR >Exit code: 1 Time: 0.225 Please, can you help me? Thanks in advance! Edited December 22, 2008 by FSoft Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2008 Developers Share Posted December 22, 2008 #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> GUICreate("Html Editor", 500, 500) GUICtrlCreateEdit("", 10, 50, 480, 440) GUICtrlCreateCheckbox("B", 10, 10, 30, 30, $BS_PUSHLIKE) GUISetState(@SW_SHOW) While 1 $m = GUIGetMsg() Select Case $m = $gui_event_close ExitLoop EndSelect WEnd Ciao SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Floppy Posted December 22, 2008 Author Share Posted December 22, 2008 Another question: How can I get the selected text in the editbox? I'm tried with _GUICtrlEdit_GetSel($edit), but doesn't work...Can you help me, please? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2008 Developers Share Posted December 22, 2008 Another question:How can I get the selected text in the editbox? I'm tried with _GUICtrlEdit_GetSel($edit), but doesn't work...Can you help me, please?Have a look at the helpfile how to specify the Control Handle. The example for GUICtrlEdit() shows that.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ProgAndy Posted December 22, 2008 Share Posted December 22, 2008 GetSel returns the startpos and the endpos. You have to get the selection with GUICtrlRead and StringMid: #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> #include <GuiEdit.au3> GUICreate("Html Editor", 500, 500) $Edit = GUICtrlCreateEdit("", 10, 50, 480, 440) $btn = GUICtrlCreateButton("GetSel", 100, 10, 90, 30) GUICtrlCreateCheckbox("B", 10, 10, 30, 30, $BS_PUSHLIKE) GUISetState(@SW_SHOW) While 1 $m = GUIGetMsg() Select Case $m = $gui_event_close ExitLoop Case $m = $btn $Selection = _GUICtrlEdit_GetSel($Edit) If IsArray($Selection) Then $Selection[0] += 1 ; startpos -- getsel is o-based, stringMid 1 based $Selection[1] += 1 ; endpos $SelLength = $Selection[1]-$Selection[0] $text = StringMid(GUICtrlRead($Edit),$Selection[0],$SelLength) MsgBox(0, "", $text) EndIf EndSelect WEnd *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Floppy Posted December 23, 2008 Author Share Posted December 23, 2008 thank you!!! 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