James Posted January 14, 2007 Share Posted January 14, 2007 Like the title says. If I had an edit box, and I was making a text editor. How could I make it, so that when a *.txt file is dragged on to it, it opens. Thanks Secure Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 $file = GUICtrlCreateInput ( "", 10, 5, 300, 20) GUICtrlSetState(-1,$GUI_DROPACCEPTED) MsgBox (4096, "drag drop file", GUICtrlRead($file)) Just have it open $file [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 (edited) Ahh thats it. Thanks Ba-LaSecureEdit: How can I make that work with an edit box? When I drag a file, nothing happens. If you goto my topic you can look through all the source code and find out why. Edited January 14, 2007 by Secure_ICT Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GaryFrost Posted January 14, 2007 Share Posted January 14, 2007 AFAIK it doesn't work with Edit control might try something like expandcollapse popup#include <GuiConstants.au3> ; GUI ;Note GUI Created with the Extended Windows Style ACCEPTFILES GUICreate("Drag/Drop Demo", 220, 220, -1, -1, -1, $WS_EX_ACCEPTFILES) GUISetIcon(@SystemDir & "\mspaint.exe", 0) ; INPUT ;string for default status of InputBox Global $txtInput = "Input Box Accepts Files" ;Create handle for Input Box. Global $hInput = GUICtrlCreateInput($txtInput, 10, 10, 200, 200, BitOR($ES_MULTILINE, $ES_LEFT, $ES_AUTOHSCROLL));Specify that the control can respond to ACCEPTFILES messages GUICtrlSetState(-1, $GUI_ACCEPTFILES) Global $hEdit = GUICtrlCreateEdit("",10,10,200,200) GUICtrlSetState($hEdit, $GUI_HIDE) GUISetState() ;Initialize Message Status Local $msg = "" ; GUI MESSAGE LOOP While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() ;UDF to Monitor Controls that Accept Drag / Drop ;This is necessary becuase the drop operation does NOT send a message to the control, ;It simply dumps the CRLF separated list of files in the control, appending them to what went before. _MonitorFiles() WEnd Exit $msg ;=============================================================================== ; ; Function Name: _MonitorFiles ; Description: Demonstrate Looping to Monitor the change of a drag/drop file operation ; Parameter(s): None ; Requirement(s): Autoit3.1.0 ; Return Value(s): None ; Author(s): FlyingBoz ; Date: 20 Feb 2005 Func _MonitorFiles() ;FlyingBoz - monitor contents of $hinput control, ;display and reset when triggered. Local $text = GUICtrlRead($hInput) If $text <> $txtInput Then;Something has changed ;strip the default text $text = StringReplace($text, $txtInput, "") ;display what's left. $text = StringReplace($text, "|", @CRLF) ;~ MsgBox(0, "Change In Input Box!", $text, 0) ;NOTE: Obviously, more sophisticated handling ;should occur here - You will see when Files are ;dropped, this @CRLF separated list ;can be parsed, tested with If FileExists(), etc. $txtInput = GUICtrlRead($hInput) If FileExists($txtInput) Then $s_text = FileRead($txtInput) GUICtrlSetData($hEdit, $s_text) GUICtrlSetState($hEdit, $GUI_SHOW) GUICtrlSetState($hInput, $GUI_HIDE) EndIf EndIf EndFunc ;==>_MonitorFiles ;=============================================================================== SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Thats a great example. But I don't know how to make it into BetaPad. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 Where will you be dropping the file, directly into the place where you type? [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Erm.. Yes. Thats the idea anyway Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 How about using a dummy [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 ? You mean something that sits on top? But then I would have to re-code everything. You see for BetaPad, the Edit box is where all the text goes. I just wanted to add the drop files so that it woule be quicker. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 (edited) Well, like gafrost said, I don't think it's possible with an Edit control Edited January 14, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Well that script uses an edit box. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 (edited) Oh, so it does, must've missed that part EDIT: Actually, I think what it does is have an invisible input behind the edit box, and it updates the edit box with GUISetData with the text inside the file specified by the input. (Sorta what I suggested, except using an input instead of a dummy.) EDIT EDIT: Sorry, it's the other way around XP Edited January 14, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Meh? I sort of understand, but that confuses me at the end. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 (edited) What's actually happening is that there's a hidden input that takes the path of the file. The program then reads the text inside the file and then sends it to the edit control. Wow, I sure wish I could program some more of your BetaPad Edited January 14, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 XD. Pm me, you can help if you want XD Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GaryFrost Posted January 14, 2007 Share Posted January 14, 2007 Works with 3.2.2.0 and 3.2.1.14 expandcollapse popup#include <GuiConstants.au3> #include <GuiEdit.au3> ; GUI ;Note GUI Created with the Extended Windows Style ACCEPTFILES GUICreate("Drag/Drop Demo", 220, 220, -1, -1, -1, $WS_EX_ACCEPTFILES) GUISetIcon(@SystemDir & "\mspaint.exe", 0) ; INPUT ;string for default status of InputBox Global $txtInput = "Input Box Accepts Files" ;Create handle for Input Box. Global $hEdit = GUICtrlCreateEdit($txtInput, 10, 10, 200, 200) GUICtrlSetState(-1, $GUI_ACCEPTFILES) _GUICtrlEditSetSel($hEdit, 0, -1) GUISetState() ;Initialize Message Status Local $msg = "" ; GUI MESSAGE LOOP While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() ;UDF to Monitor Controls that Accept Drag / Drop ;This is necessary becuase the drop operation does NOT send a message to the control, ;It simply dumps the CRLF separated list of files in the control, appending them to what went before. _MonitorFiles() WEnd Exit ;=============================================================================== ; ; Function Name: _MonitorFiles ; Description: Demonstrate Looping to Monitor the change of a drag/drop file operation ; Parameter(s): None ; Requirement(s): Autoit3.1.0 ; Return Value(s): None ; Author(s): FlyingBoz ; Date: 20 Feb 2005 Func _MonitorFiles() ;FlyingBoz - monitor contents of $hinput control, ;display and reset when triggered. Local $text = GUICtrlRead($hEdit) If $text <> $txtInput Then;Something has changed ;strip the default text $text = StringReplace($text, $txtInput, "") ;display what's left. $text = StringReplace($text, @CRLF, "") ;NOTE: Obviously, more sophisticated handling ;should occur here - You will see when Files are ;dropped, this @CRLF separated list ;can be parsed, tested with If FileExists(), etc. If FileExists($text) Then $s_text = FileRead($text) GUICtrlSetData($hEdit, "") GUICtrlSetData($hEdit, $s_text) $txtInput = GUICtrlRead($hEdit) EndIf EndIf EndFunc ;==>_MonitorFiles ;=============================================================================== SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Yes that does work Right, I have it all setup to work with BetaPad, but it still wont work. It wont let me drag files. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GaryFrost Posted January 14, 2007 Share Posted January 14, 2007 Yes that does work Right, I have it all setup to work with BetaPad, but it still wont work. It wont let me drag files. Have to make sure to $WS_EX_ACCEPTFILES when creating the gui GUICreate("Drag/Drop Demo", 220, 220, -1, -1, -1, $WS_EX_ACCEPTFILES)oÝ÷ Ù©ÝÓ~PCÓÄJíç×(Úè«¢+Ù±½°ÀÌØí¡¥ÐôU% Ñɱ ÉѥРÀÌØíÑáÑ%¹ÁÕаÄÀ°ÄÀ°ÈÀÀ°ÈÀÀ¤)U% ÑɱMÑMÑÑ ´Ä°ÀÌØíU%} AQ%1L¤( SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
James Posted January 14, 2007 Author Share Posted January 14, 2007 Yes, when I do: $BetaPad = GUICreate("BetaPad | Untitled", 626, 466, @DesktopHeight / 3, @DesktopWidth / 5, $WS_EX_ACCEPTFILES) The X button dissapears. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GaryFrost Posted January 14, 2007 Share Posted January 14, 2007 Yes, when I do: $BetaPad = GUICreate("BetaPad | Untitled", 626, 466, @DesktopHeight / 3, @DesktopWidth / 5, $WS_EX_ACCEPTFILES) oÝ÷ Ù8^]»¶Ý˥櫳ú®¢×ºÚ"µÍÌÍÐ]TYHÕRPÜX]J ][ÝÐ]TY[]Y ][ÝË ÚÝÜZYÚÈËÚÝÜÚYÈ K]Ô ÌÍÕÔ×ÑVÐPÐÑTSTË ÌÍÕÔ×ÑVÐTÒSÕÊJB SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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