Marc Lacrosse Posted July 28, 2008 Share Posted July 28, 2008 I would like the user of a compiled script to be allowed to drag a file in windows explorer and drop it on the icon or name of my compiled script . this would launch the script with the dragged file path as a parameter. There are languages where such a case is dealt with the same syntax as retrieving a pure command line parameter (as if the script had been launched with the following command : "Myscript.exe myfile.txt"). This does not seem to be the case with auto-it : a simple script like the following does not work if I drag a file on the resulting exe : if $CmdLine[0] < 1 then MsgBox(0,"Test CL & Drag'n Drop", "No file on CL or DnD") Else MsgBox(0,"Selected File : ",$CmdLine[1] EndIf Would you please tell me how I may retrieve the path of a file that has been dropped on my compiled script's name ? Thanks in advance Marc PS sorry if this has been answered yet : I was not able to find the answer in the docs or in the forum. Link to comment Share on other sites More sharing options...
smashly Posted July 28, 2008 Share Posted July 28, 2008 Works for me as long as you add the missing end bracket to the msgbox.MsgBox(0,"Selected File : ",$CmdLine[1]) Link to comment Share on other sites More sharing options...
martin Posted July 28, 2008 Share Posted July 28, 2008 I would like the user of a compiled script to be allowed to drag a file in windows explorer and drop it on the icon or name of my compiled script . this would launch the script with the dragged file path as a parameter. There are languages where such a case is dealt with the same syntax as retrieving a pure command line parameter (as if the script had been launched with the following command : "Myscript.exe myfile.txt"). This does not seem to be the case with auto-it : a simple script like the following does not work if I drag a file on the resulting exe : if $CmdLine[0] < 1 then MsgBox(0,"Test CL & Drag'n Drop", "No file on CL or DnD") Else MsgBox(0,"Selected File : ",$CmdLine[1] EndIf Would you please tell me how I may retrieve the path of a file that has been dropped on my compiled script's name ? Thanks in advance Marc PS sorry if this has been answered yet : I was not able to find the answer in the docs or in the forum. Apart from a missing closing bracket, there is nothing wrong with your code. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Marc Lacrosse Posted July 28, 2008 Author Share Posted July 28, 2008 Works for me as long as you add the missing end bracket to the msgbox. MsgBox(0,"Selected File : ",$CmdLine[1]) Oooops .... Sorry ... and thanks to all Marc 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