Sign in to follow this  
Followers 0
jezzzzy

$GUI_ACCEPTFILES

13 posts in this topic

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.

Share this post


Link to post
Share on other sites



i made one that checks the link for the exe file then runs the program

#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)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 :P

Edit: $GUI_ACCEPFILES has been renamed in $GUI_DROPACCEPTED

Edited by jpm

Share this post


Link to post
Share on other sites

listview items can be dropped between listview control under your responsability on recepetion of $GUI_EVENT_DROPPED with @GUI_DRAGID and GUI_DROPID :P

" ... 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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

here you get one example at least working with the 3.1.1.98 I will upload soon

Edited by jpm

Share this post


Link to post
Share on other sites

here you get one example at least working with the 3.1.1.98 I will upload soon

Wouh,

is it already christmas?

Thank you JPM,

Reinhard

Share this post


Link to post
Share on other sites

Wouh,

is it already christmas?

Thank you JPM,

Reinhard

Yeah it's coming :P

Share this post


Link to post
Share on other sites

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 :P

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 :P

Edit: $GUI_ACCEPFILES has been renamed in $GUI_DROPACCEPTED

Ok. 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?

Posted Image

Edited by jezzzzy

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 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

Share this post


Link to post
Share on other sites

... 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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0