jezzzzy Posted December 21, 2005 Share Posted December 21, 2005 Is it possible to drag a file into a listview and then perform an action based on the filename? I have set the listview extended property ($WS_EX_ACCEPTFILES) as well as called GUICtrlSetState($listview,$GUI_ACCEPTFILES). This allows a file to be dragged into the gui listview (it doesn't give me the circle with a line through it) however, no guimsg is passed ( at least not one that I can see) -- only the control event for mouse up. So, I guess I know how to make it drag-able but I just can't do anything with it. Link to comment Share on other sites More sharing options...
Valuater Posted December 21, 2005 Share Posted December 21, 2005 i made one that checks the link for the exe file then runs the program expandcollapse popup#include "GUIConstants.au3" Dim $tim = 500, $runner = "" $Menu = GUICreate("My menu", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $Create = GUICtrlCreateLabel( "Drop a *link* or an *exe* in the box", 10, 10, 250, 20) $Prog_1A = GUICtrlCreateInput("", 10, 30, 280, 20) GUICtrlSetState(-1, $GUI_ACCEPTFILES) $Btn1 = GUICtrlCreateButton("TEST", 110, 110, 70, 30) GUISetState() While 1 $Msg = GUIGetMsg() If $Msg = $Btn1 Then While 2 ;SoundPlay($Sound_clk) GUICtrlSetData($Create, "***** Reading Program ***** ") Sleep($tim) $Prog_1 = GUICtrlRead($Prog_1A) $result = StringInStr($Prog_1, ".lnk") If $result >= 5 Then $details = FileGetShortcut($Prog_1) $Runner = $details[0] GUICtrlSetData($Create, "*.lnk* Program Launch is accepted") Sleep($tim) ExitLoop EndIf $result2 = StringInStr($Prog_1, ".exe") If $result2 >= 5 Then $Runner = $Prog_1 GUICtrlSetData($Create, "*.exe* Program Launch is accepted") Sleep($tim) ExitLoop EndIf GUICtrlSetData($Create, "*NOTE* Program Launch was *NOT* accepted") Sleep(3000) GUICtrlSetData($Create, "Please DROP a Short-cut (picture) in the box") WEnd EndIf If $Runner <> "" Then MsgBox(0,"", $Runner) Run($Runner) $Runner = "" EndIf If $Msg = $GUI_EVENT_CLOSE then Exit WEnd a listview sounds more difficult for this task.... accourding to what i read and no code provided 8) Link to comment Share on other sites More sharing options...
jpm Posted December 21, 2005 Share Posted December 21, 2005 (edited) Is it possible to drag a file into a listview and then perform an action based on the filename? I have set the listview extended property ($WS_EX_ACCEPTFILES) as well as called GUICtrlSetState($listview,$GUI_ACCEPTFILES). This allows a file to be dragged into the gui listview (it doesn't give me the circle with a line through it) however, no guimsg is passed ( at least not one that I can see) -- only the control event for mouse up.So, I guess I know how to make it drag-able but I just can't do anything with it.Only EDIT or INPUT can received dropped files.listview items can be dropped between listview control under your responsability on recepetion of $GUI_EVENT_DROPPED with @GUI_DRAGID and GUI_DROPID Edit: $GUI_ACCEPFILES has been renamed in $GUI_DROPACCEPTED Edited December 21, 2005 by jpm Link to comment Share on other sites More sharing options...
ReFran Posted December 22, 2005 Share Posted December 22, 2005 listview items can be dropped between listview control under your responsability on recepetion of $GUI_EVENT_DROPPED with @GUI_DRAGID and GUI_DROPID " ... can be dropped between listview control "Means that, that I can drag and drop inside a listview GUI? So if a simple sort is not enough, I can give the user of my GUI the possibility to drag&drop items from position - let's say - 8 to 1.Any example available?Best regards, Reinhard Link to comment Share on other sites More sharing options...
jpm Posted December 22, 2005 Share Posted December 22, 2005 (edited) here you get one example at least working with the 3.1.1.98 I will upload soon Edited December 22, 2005 by jpm Link to comment Share on other sites More sharing options...
ReFran Posted December 22, 2005 Share Posted December 22, 2005 here you get one example at least working with the 3.1.1.98 I will upload soonWouh, is it already christmas?Thank you JPM,Reinhard Link to comment Share on other sites More sharing options...
jpm Posted December 22, 2005 Share Posted December 22, 2005 Wouh, is it already christmas?Thank you JPM,ReinhardYeah it's coming Link to comment Share on other sites More sharing options...
jezzzzy Posted December 23, 2005 Author Share Posted December 23, 2005 Only EDIT or INPUT can received dropped files. listview items can be dropped between listview control under your responsability on recepetion of $GUI_EVENT_DROPPED with @GUI_DRAGID and GUI_DROPID Edit: $GUI_ACCEPFILES has been renamed in $GUI_DROPACCEPTED Bummer. Maybe I can accomplish my end with another solution. Is it possible to drag a file onto the shortcut of an AutoIt exe (like as "open with")? I'm hoping the dragged file will get passed to the exe as a command line parameter ($CmdLine[1])? This would give me what I need. Link to comment Share on other sites More sharing options...
jpm Posted December 23, 2005 Share Posted December 23, 2005 Bummer. Maybe I can accomplish my end with another solution. Is it possible to drag a file onto the shortcut of an AutoIt exe (like as "open with")? I'm hoping the dragged file will get passed to the exe as a command line parameter ($CmdLine[1])? This would give me what I need.I don't fully understand your question . But if you drag and drop a .au3 on a shortcut to the install AutoIt3.exe you get the execution of the script without any parameter passed. if you compile your script and drag&drop on a shortcut to your compiled script you get what you drag&drop as the parameter to your compiled script. Does that answer your question? Link to comment Share on other sites More sharing options...
jezzzzy Posted December 23, 2005 Author Share Posted December 23, 2005 I don't fully understand your question .But if you drag and drop a .au3 on a shortcut to the install AutoIt3.exe you get the execution of the script without any parameter passed.if you compile your script and drag&drop on a shortcut to your compiled script you get what you drag&drop as the parameter to your compiled script.Does that answer your question?Yes. Excellent. I just tested and it returns the full path of the dropped file. Perfect. Thank you. Link to comment Share on other sites More sharing options...
jezzzzy Posted December 23, 2005 Author Share Posted December 23, 2005 (edited) Only EDIT or INPUT can received dropped files.listview items can be dropped between listview control under your responsability on recepetion of $GUI_EVENT_DROPPED with @GUI_DRAGID and GUI_DROPID Edit: $GUI_ACCEPFILES has been renamed in $GUI_DROPACCEPTEDOk. I'm a little closer. What I need is for this gui to be able to change directories based on the file that is dragged into it. Initially I thought I would have the user drag into the listview but JPM shot down that idea. How about dragging an external file into the gui somewhere else? Maybe the combo box or just in the gui (not on a control)? Any of this possible? Edited December 23, 2005 by jezzzzy Link to comment Share on other sites More sharing options...
HardCopy Posted December 23, 2005 Share Posted December 23, 2005 (edited) Out of curiosity Jezzzy What is your programs function? May assist us in offering alternative ideas to help you along. Merry Xmas HardCopy Edited December 23, 2005 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
jezzzzy Posted December 23, 2005 Author Share Posted December 23, 2005 ... What is your programs function?It serves to send .plt files to a large format plotter. I work for a contruction company and I was the only one here with the appropriate software to plot them. I made this so that others could be self sufficient.I am trying to implement a 'quick browse' function so the user can just drag a file to the app instead of having to browse to the location. IE. if they have the location open already in explorer, they can just drag the file to wPlot and then the combo would change to that files directory circumventing the browse button. 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