Jump to content

Search the Community

Showing results for tags 'drag'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 12 results

  1. Generally speaking, the support for autoit AU3 file drag and drop is not perfect AU3 built-in GUI $WS_ EX_ ACCESSFILES, Control $GUI_ DROPACCEPTED, then @ GUI_ DropId distinguishes the control that occurs, but @ GUI_ DragFile does not support multiple files, only the first file is recognized! And dragging into the window means dragging and dropping the cursor, without distinguishing the display of controls. Common WM_DROPFILES_FUNC, DllCall shell32.dll DragQueryFile, GUI window also $WS_ EX_ ACCESSFILES, supports multiple files, but requires GUI event mode 1, and cannot distinguish which control occurred, making it difficult to handle when there are multiple different drag and drop destinations. Similarly, dragging the cursor into the window does not distinguish the display of controls. Here is an example of AU3 source code that can determine which control triggers the drag, and can support multiple files being dragged in at once, which can be processed one by one without setting GUIOnEventMode to 1 Running under WIN11 has passed. The image shows the system wallpaper of WIN11 or WIN7. If you don't have it, please replace it yourself Select multiple files in the system file browser, then drag them into the program window. When pointing to the blank space, cursor as disabled. When pointing to the Input input box and image, you can release the mouse to complete the drag and drop. The effect is that the input box displays all the file names that were dragged and dropped, and displays the recently dragged control hWnd,for easy differentiation ================== #include <GUIConstants.au3> #include <WinAPI.au3> #include <Array.au3> Global $aFileList, $lastDragID $hGUI = GUICreate("Independent control multi file drag", 565, 247, -1, -1, -1, $WS_EX_WINDOWEDGE) $Input1 = GUICtrlCreateInput("", 32, 16, 505, 121) ; Now only here the drop sign appears $defpic1 = "C:\Windows\Web\Wallpaper\Spotlight\img50.jpg" ;win11壁纸1 $defpic2 = "C:\Windows\Web\Wallpaper\Windows\img19.jpg" ;win11壁纸2 $defpic = "" For $i = 1 To 5 If Random(0, 1, 1) Then $defpic = $defpic1 Else $defpic = $defpic2 EndIf Assign("Pic" & $i & "Handle", GUICtrlCreatePic($defpic, 20 + (($i - 1) * 100), 180, 90, 50, -1, $WS_EX_ACCEPTFILES)) GUICtrlSetState(Eval("Pic" & $i & "Handle"), $GUI_DROPACCEPTED) Next GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $idDummy = GUICtrlCreateDummy() GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") For $i = 1 To 5 Assign("gchp" & $i, GUICtrlGetHandle(Eval("Pic" & $i & "Handle"))) Assign("wProcOld" & $i, _WinAPI_SetWindowLong(Eval("gchp" & $i), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idDummy For $i = 1 To $aFileList[0] ConsoleWrite($aFileList[$i] & @CRLF) ;拖放处理文件段 Next GUICtrlSetData($Input1, $lastDragID & "##" & _ArrayToString($aFileList, "|", 1)) For $i = 1 To 5;提示哪个控件响应 If Eval("gchp" & $i) = $lastDragID Then MsgBox(0, "idP-" & $i, _ArrayToString($aFileList, @CRLF, 1)) Next EndSwitch WEnd GUIDelete($hGUI) DllCallbackFree($wProcHandle) Func _WindowProc($hWnd, $Msg, $wParam, $lParam) For $j = 1 To 5 ;拖放识别控件段 If $hWnd = GUICtrlGetHandle(Eval("Pic" & $j & "Handle")) Then isDrag($hWnd, $Msg, $wParam, $lParam, Eval("wProcOld" & $j)) Next EndFunc ;==>_WindowProc Func isDrag($hWnd2, $Msg2, $wParam2, $lParam2, $wProcOldx) If $Msg2 = $WM_DROPFILES Then $lastDragID = $hWnd2 ConsoleWrite($lastDragID & @CRLF) $aFileList = _WinAPI_DragQueryFileEx($wParam2) If Not @error Then GUICtrlSendToDummy($idDummy) _WinAPI_DragFinish($wParam2) Return 0 Else Return _WinAPI_CallWindowProc($wProcOldx, $hWnd2, $Msg2, $wParam2, $lParam2) ;放行相应控件的其它消息 EndIf EndFunc ;==>isDrag ================= 单控件多文件拖放22.au3
  2. Hello all I have a question please I've searched a lot on how to make a GUI for programs designed by Autoit to accepts dragging files from Windows File Explorer Unfortunately, however, it failed Is there any way to do this? Where I am making a audio player and I want to activate the feature of dragging files from Windows Explorer to a program window to play them I hope to find a simple solution here in this wonderful forum Thank you very much in advance
  3. Hello. Drag option works only on parent window but as we can see on the parent gui is showed up child gui (on the right side with the color). Desired action is when we want to drag whole program we can also drag child gui and child gui will drag with parent gui. How to do this? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> GUIRegisterMsg($WM_NCHITTEST, "_NCHITTEST") $hGUI = GUICreate("Test", 500, 500, -1, -1) $cButton_0 = GUICtrlCreateButton("Child 0", 10, 10, 80, 30) $cButton_1 = GUICtrlCreateButton("Child 1", 10, 50, 80, 30) $cButton_2 = GUICtrlCreateButton("Child 2", 10, 90, 80, 30) GUISetState(@SW_SHOW, $hGUI) ; guis Global $hChild_[3] Global $countGUI = UBound($hChild_) - 1 ;MsgBox("","",$countGUI) ; licznik dla GUI Global $gui = 0 $hChild_[0] = GUICreate("Child 0", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFF0000) GUISetState(@SW_SHOW, $hChild_[0]) $hChild_[1] = GUICreate("Child 1", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x00FF00) GUISetState(@SW_HIDE, $hChild_[1]) $hChild_[2] = GUICreate("Child 2", 350, 300, 150, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0x0000FF) GUISetState(@SW_HIDE, $hChild_[2]) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_0 _All_Hide() GUISetState(@SW_SHOW, $hChild_[0]) $gui = 0 Case $cButton_1 _All_Hide() GUISetState(@SW_SHOW, $hChild_[1]) $gui = 1 Case $cButton_2 _All_Hide() GUISetState(@SW_SHOW, $hChild_[2]) $gui = 2 EndSwitch WEnd Func _All_Hide() GUISetState(@SW_HIDE, $hChild_[0]) GUISetState(@SW_HIDE, $hChild_[1]) GUISetState(@SW_HIDE, $hChild_[2]) EndFunc Func _NCHITTEST($hWnd, $uMsg, $wParam, $lParam) If $hWnd = $hGUI Then Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16),0xFFFF)- $aPos[1]) < 500 Then Return $HTCAPTION EndIf Return $GUI_RUNDEFMSG EndFunc
  4. Send "Drag & Drop File(s)" Message I was looking for this functionality before, and couldn't figure out the correct method for using the WM_DROPFILES message. Thankfully today I came across the thread ' and found working, but flawed, code for doing exactly this. Specifically, (his 'DoDragDrop' function). I cleaned up the code, added error checking, Unicode & x64 support, and fixed the Global memory management issues. The result is down below. Also, see ProgAndy's COM implementation of Drag&Drop: ' Another good reference, besides those in the thread above, is this article at CodeProject: 'How to Implement Drag and Drop Between Your Program and Explorer' Examples of usage: TeraCopy _FileDragDrop(WinGetHandle("[REGEXPTITLE:TeraCopy.*]"),@ScriptFullPath&'|'&@AutoItExe) Notepad++: $hNPPlus=WinGetHandle("[CLASS:Notepad++]") $aNPPPos=WinGetPos($hNPPlus) ;~ WinActivate($hNotePad) $sProgramFiles=@ProgramFilesDir If @AutoItX64 Then $sProgramFiles&=' (x86)' $iRet=_FileDragDrop($hNPPlus,@ScriptFullPath&'|'&$sProgramFiles&"\AutoIt3\Include\Memory.au3",$aNPPPos[2]/2,$aNPPPos[3]/2) ConsoleWrite("Return: "&$iRet&" @error="&@error&", @extended="&@extended&@CRLF) Be sure to credit the original authors, or leave the headers intact, if you use the code *edit: for some friggin reason I can't post the code in the post - I get a 'You must enter a post' error message - wtf. Attaching it for now.. UPDATES: 2010-12-4 (yup, today!): Fixed ANSI implementationChanged Memory allocation type to 'Fixed' (thanks trancexx)Added X, Y position parameters - actually needed for some programs (Notepad++ for example)_FileDragDrop.au3
  5. Hi all, I got a quick question regarding Drag&Drop with GUIs. I made a little script that does something with files and I need a way to get the name/path of the file when I drag&drop it into the GUI. Is there a quick way to do this? Tyvm in advance! Neo
  6. Hello to all autoit coders, I'm not a pro dev but I've recently made a few automatisation programs. I met a program SplashTop which allows user to control their PC from android phone and play games through it (e.g. Skyrim or any other game with first person camera). The program is perfect but it's totally missing one thing - mouse move. It only allows mouse click&drag as user moves their finger on the touch screen.I was thinking about using physical phone keyboard <>^(and down) to mouse move but not many ppl have got qwerty phones such motorola droid 4 or similar and I can transfer <>^ into mousemove. The question is if any of you know a way to disable mouse click&drag and convert it into mousemove. Thanks for responses, I'm sorry but I can't make paragraphs on mobile version
  7. Hello Great AutoIt Members I want to drag and drop a file from 1st window to a 2nd window of an application. I use the MouseClickDrag() function, and it's working good if I specified the X,Y coordinates manually of the file to be dragged and dropped my problem now is how I can get the file position (X,Y coords) in the screen automatically? I've tried this code by browsing the file location in an IE browser object (since the GUI window will be empty other than my file and it'll be easy to get file position relative to the GUI window) but it's not working in win8 #include <IE.au3> $oIE = _IECreateEmbedded() $exp_hwnd = GUICreate("", 200, 200, 0, 0) GUICtrlCreateObj( $oIE, 0, 0 , 200, 200 ) GUISetState () _IENavigate($oIE, @DesktopDir, 0) sleep(1000) MouseClickDrag( "left", 50, 50, 300, 300) I hope anyone has any other solution to this simple problem. thanks for any help
  8. Puzzle Game v1.0.1.4 Just for Fun, a tiny Puzzle game using >ImageSplitter functions ! Load any image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose the Pieces number you want. No sliding piece, just move Puzzle pieces where you want by drag&drop as a real puzzle. Sounds indicate if well or misplaced. Buttons were made online with chimply.com the easy and free buttons generator ! Compatible with AutoIt, and Beta Versions. Previous downloads : 67 Downloads available in the download section Have fun !
  9. I am currently trying to make a program but don't know where to start with a drag and drop function. Basically, I wish to drag an image onto my compiled program, and it displays the information of the image. I'm looking for a way to start my program by dragging an image over it and accept the image's location detail.. I'd really appreciate some help on this, for I'm not fully sure how to go about this.
  10. Morning.. I have searched the forums high and low and can't find an answer to my issue. I have two list views: The source has 3 columns and the target has 5 columns. I would like the capability to drag an item from source to target(which is easy) but modify the source item by adding a value to the start of the item and a value to the end of the item so it marries with the target listview columns... ..also the dropped modified item should be inserted at a row where the cursor is released in the target. Any ideas? Thanks.
  11. Hello, don't worry I don't inted to hack anything. I'm trying to make app that gathers information real time info from pokerstars (what everyone has done etc.) and when I normally try to select the text, which automatic dealer says, it works all fine. But when I make my script do that nothing happens, I bet pokerstars somehow blocks my autoit mousecommands. What to do? Ps. it works fine with other windows than pokerstars..
  12. I'm trying to put together a gui to be able to drag an item from one listview into another. I've found some very nice examples on the forum. However, I'm having a bit of an issue. When I drag an item from either of the listview controls to the other, artifacts appear from the child gui that appears when dragging. The funny thing is that the artifacts only appear when dragging upward! There's got to be something I'm missing here. I've been looking at the code from both of these links to try to figure something out. For the example of what I'm talking about, the code from JonnyThunder from the top link with the fancy drag gui from ReFran in the bottom link is below. They did some really great work and my combining the code is just lacking something that I can't figure out. I've attached a pic of what I'm witnessing. How can I eliminate these artifacts? Here's the code that I'm working with: ; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> ; Switch on the 'onEvent' notifications Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ; Generate the GUI! Ahoy there. Global $gw = 16 Global $gh = 16 Global $Startx, $Starty, $Endx, $Endy, $aM_Mask, $aMask, $nc Global $MainForm, $list_source, $list_target, $drag_gui $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = GUICtrlCreateListView("Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Target list box $list_target = GUICtrlCreateListView("Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $LVS_SORTASCENDING)) ; Populate box with some test stuff For $x = 1 To 6 GUICtrlCreateListViewItem( _makeJunkName() & "|" & _makeJunkName(), $list_source) Next GUISetState(@SW_SHOW, $MainForm) ; Handle GUI events GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_dragHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_formEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "_formEvents") $position = WinGetPos($MainForm) $client = WinGetClientSize($MainForm) $light_border = ($position[2] - $client[0]) / 2 $thick_border = $position[3] - $client[1] - $light_border $x_coord = $position[0] + $light_border $y_coord = $position[1] + $thick_border $drag_gui = GUICreate("Drag", $gw, $gh, $x_coord, $y_coord, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $MainForm) $cursor_icon = GUICtrlCreateIcon("Shell32.dll", -147, 0, 0, 16, 16) GUISetState(@SW_SHOW, $drag_gui) setTrans() GUISetState(@SW_HIDE, $drag_gui) ; Main program loop While 1 ; Don't really do much in here at all... Sleep(10) WEnd ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 To 10 $labelout &= Chr(Random(65, 90, 1)) Next Return $labelout EndFunc ;==>_makeJunkName ; Function to handle drag and drop Func _dragHandler() ; Define some stuff Local $source, $desc Local $cinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) Local $direction = 0 ; Check we are dragging from one or the other boxes If $cinfo[4] = $list_source Or $cinfo[4] = $list_target Then ; Are we moving from source to destination If $cinfo[4] = $list_source Then $direction = 1 EndIf ; Or are we moving from destination to source If $cinfo[4] = $list_target Then $direction = 2 EndIf ; Doublecheck we're pressing mouse button If _IsPressed(1) Then If $direction = 1 Then $selecteditems = _GUICtrlListView_GetSelectedCount($list_source) $idx = _GUICtrlListView_GetSelectedIndices($list_source, False) $item_txt = _GUICtrlListView_GetItemText($list_source, Int($idx)) Else $selecteditems = _GUICtrlListView_GetSelectedCount($list_target) $idx = _GUICtrlListView_GetSelectedIndices($list_target, False) $item_txt = _GUICtrlListView_GetItemText($list_target, Int($idx)) EndIf ; Check we actually have selected an item If $selecteditems >= 1 Then ; Wait for keypress! _WinAPI_ShowCursor(False) GUISetState(@SW_SHOW, $drag_gui) While _IsPressed(1) chase($item_txt) WEnd GUISetState(@SW_HIDE, $drag_gui) _WinAPI_ShowCursor(True) ToolTip("") ; Get new position Local $newcinfo = GUIGetCursorInfo(WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = $list_target Then ConsoleWrite("Moved " & $selecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_source), $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = $list_source Then ConsoleWrite("Moved " & $selecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems(GUICtrlGetHandle($list_target), $list_source, 1) EndIf EndIf EndIf EndIf EndFunc ;==>_dragHandler ; Function to handle other form events Func _formEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>_formEvents Func chase($moving_txt) $mp = MouseGetPos() WinMove($drag_gui, "", $mp[0] + 1, $mp[1] + 0) ToolTip($moving_txt, $mp[0] + 18, $mp[1]) EndFunc ;==>chase Func setTrans() $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 460, "long", 460) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $TestCol = PixelGetColor(0, 0) $Startx = -1 $Starty = -1 $Endx = 0 $Endy = 0 For $i = 0 To $gw For $j = 0 To $gh If PixelGetColor($i, $j) = $TestCol And $j < $gh Then If $Startx = -1 Then $Startx = $i $Starty = $j $Endx = $i $Endy = $j Else $Endx = $i $Endy = $j EndIf Else If $Startx <> -1 Then addRegion() $Startx = -1 $Starty = -1 EndIf Next Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1) EndFunc ;==>setTrans Func addRegion() $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $Startx, "long", $Starty, "long", $Endx + 1, "long", $Endy + 1) $nc += 1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 3) EndFunc ;==>addRegionArtifacts.bmp
  • Create New...