billthecreator Posted March 6, 2009 Share Posted March 6, 2009 (edited) If i select more than one file and drag it to a list, what are the files separated by so that I can add every selected item to the list. I've tried.. '|' and @CRLF and @CR this is what i have so far... Case $GUI_EVENT_DROPPED If @GUI_DropId = $hListView Then If StringInStr(@GUI_DragFile, @CR) Then $array1 = StringSplit(@GUI_DragFile, @CR) For $r = 1 to $array1 -1 If Not StringInStr(FileGetAttrib($array1[$r]), "D") Then GUICtrlSetData($hListView, $array1[$r]) EndIf Next Else GUICtrlSetData($hListView, @GUI_DragFile) EndIf EndIf Edited March 6, 2009 by billthecreator [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 6, 2009 Share Posted March 6, 2009 If i select more than one file and drag it to a list, what are the files separated by so that I can add every selected item to the list. I've tried.. '|' and @CRLF and @CR this is what i have so far... expandcollapse popupCase $GUI_EVENT_DROPPED If @GUI_DropId = $hListView Then If StringInStr(@GUI_DragFile, @CR) Then $array1 = StringSplit(@GUI_DragFile, @CR) For $r = 1 to $array1 -1 If Not StringInStr(FileGetAttrib($array1[$r]), "D") Then GUICtrlSetData($hListView, $array1[$r]) EndIf Next Else GUICtrlSetData($hListView, @GUI_DragFile) EndIf EndIfoÝ÷ Ûú®¢×Pëjbç(Ö¢åÊÞ~*ìµø¥yÚ覶ayÊ'¶º%Nµ©e~)^²Ø^è¬ç¶Þ+-zµ ÄJg¬±¨jëh×6#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> Global Const $WM_DROPFILES = 0x0233 Global $aDroppedFiles[1] GUICreate("Drop Multiple Files to LV Demo", 500, 400, -1, -1, -1, $WS_EX_ACCEPTFILES+$WS_EX_TOPMOST) GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") GUICtrlCreateLabel("Drag to the List View some file(s)", 60, 20) $ListView = GUICtrlCreateListView("Col1|Col2|Col3", 50, 50, 400, 300, -1, $WS_EX_CLIENTEDGE) GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case $GUI_EVENT_DROPPED For $i = 1 To UBound($aDroppedFiles)-1 GUICtrlCreateListViewItem($aDroppedFiles[$i], $ListView) Next GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) EndSwitch WEnd Func WM_DROPFILES($hWnd, $msgID, $wParam, $lParam) Local $nSize, $pFileName Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255) $aDroppedFiles = 0 Dim $aDroppedFiles[$nAmt[0]+1] For $i = 0 To $nAmt[0] - 1 $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $nSize = $nSize[0] + 1 $pFileName = DllStructCreate("char[" & $nSize & "]") DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", _ DllStructGetPtr($pFileName), "int", $nSize) $aDroppedFiles[0] += 1 $aDroppedFiles[$aDroppedFiles[0]] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ReDim $aDroppedFiles[$aDroppedFiles[0]+1] EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
billthecreator Posted March 6, 2009 Author Share Posted March 6, 2009 This helped a lot. but im only using a list, not a listview, and not columns... I will work around this.. Thank you [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 6, 2009 Share Posted March 6, 2009 This helped a lot. but im only using a list, not a listview, and not columns...I will work around this..Thank youI only showed to you how to get all dropped files, it's your choice how to use it Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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