Jump to content

Recommended Posts

Posted (edited)

Hello

This Func Drag File and Drop :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Func Drag File and Drop", 256, 53, -1, -1,-1, $WS_EX_ACCEPTFILES)
$Input1 = GUICtrlCreateInput("[ ... ]", 8, 24, 241, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

While 1

        $nMsg = GUIGetMsg()

        Switch $nMsg

                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd

i Need When Drop File Do Something Like Copy Or Rename This File.

Tnx.

Edited by ahmeddzcom
Posted (edited)

Well your drag and drop works, do you want to rename or copy selected file?

Here is some starting point for you:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $gui_choose
Global $btn_copy = 9999
Global $btn_rename = 9999

Global $Form1 = GUICreate("Func Drag File and Drop", 256, 53, -1, -1, -1, $WS_EX_ACCEPTFILES)
Global $Input1 = GUICtrlCreateInput("[ ... ]", 8, 24, 241, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

While 1

 $nMsg = GUIGetMsg()

 Switch $nMsg

  Case $GUI_EVENT_CLOSE
   Exit

  Case $Input1
   WhatNext()

  Case $btn_copy
   CopyFile()

  Case $btn_rename
   RenameFile()

 EndSwitch
WEnd


Func WhatNext() ;Create new GUI to select the next action
 $gui_choose = GUICreate("What to do?", 200, 60, -1, -1, -1, $WS_EX_TOPMOST)
 $btn_copy = GUICtrlCreateButton("Copy", 10, 10, 80, 40)
 $btn_rename = GUICtrlCreateButton("Rename", 100, 10, 80, 40)

 GUISetState()
EndFunc   ;==>WhatNext

Func CopyFile() ;<<<<<<<=========== Edit this anyway you want
 GUIDelete($gui_choose)
 MsgBox(0, "", "Create function for copying the file somewhere")
EndFunc   ;==>CopyFile

Func RenameFile() ;<<<<<<<=========== Edit this anyway you want
 GUIDelete($gui_choose)
 MsgBox(0, "", "Create function for renaming the file")
EndFunc   ;==>RenameFile

 

Edited by Bester
Posted
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Func Drag File and Drop", 456, 53, -1, -1,-1, $WS_EX_ACCEPTFILES)
$Input1 = GUICtrlCreateInput("[ ... ]", 8, 24, 441, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
                Exit
        Case $GUI_EVENT_DROPPED
                 Msgbox(0,"", @GUI_DragFile)
               ; do here whatever you want:
                GuiCtrlSetData($Input1, @GUI_DragFile & ".renamed")
    EndSwitch
WEnd

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...