Sign in to follow this  
Followers 0
trung0407

got 2 questions

5 posts in this topic

1. How can i make my program recognize a file path as argument when i drop that file on to my program (my program is not executed yet, it's just an .exe)

2. How can i make my program executed automatically (after some dl it from the internet, for exemple) ?

Share this post


Link to post
Share on other sites



#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $file, $btn, $msg
    
    GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
    $file = GUICtrlCreateInput("", 10, 5, 300, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateInput("", 10, 35, 300, 20)     ; will not accept drag&drop files
    $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                ExitLoop
        EndSelect
    WEnd

    MsgBox(4096, "drag drop file", GUICtrlRead($file))
EndFunc   ;==>Example

Straigt from the help file :P

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

AlmarM,

Compile what your posted.

Move the EXE to your desktop.

Drag another file onto that EXE and drop it.

See what you get :-)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

:P Did I miss something?

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

:P Did I miss something?

AlmarM

The OP said that his/her script "my program" is not running during the drag/drop operation.

The code you posted has to be running in order for it to get the path dropped onto it.

1. How can i make my program recognize a file path as argument when i drop that file on to my program (my program is not executed yet, it's just an .exe) ...

I was stating the OP's problem a different way and outlining a set of steps that people can try before posting solutions. I may have misunderstood the OP... but I don't think so.

The solution may use $CmdLine but I'm too tired to work on it.


[size="1"][font="Arial"].[u].[/u][/font][/size]

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