Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

ShellExecute fails with $CmdLine parameters filled by drag & drop

$
0
0

Hi,

I'd liked to pass a list of files by dragging and dropping them over a first script which, in turn, pass them as parameters of a ShellExecute() to a second script.

Total operation looks like:

Drag & drop of file_path_list -> CallTarget.au3 -> Target1.au3

Code of CallTarget.au3 is straightforward:

  1. Const $STOP_ICON = 0x10
  2.  
  3. Dim $sParam = ""
  4. If ($CmdLine[0] > 0) Then $sParam = $CmdLine[1]
  5.  
  6. ; The same path, but put in the text code, works!
  7. ;$sParam = "C:\TMP\PROGRAM\AutoIt\BugRun\File1.txt"
  8.  
  9. Dim $nCodeShellExec
  10. $nCodeShellExec = ShellExecute("Target1.au3", $sParam)
  11. If NOT $nCodeShellExec Then MsgBox($STOP_ICON, @ScriptName, "ShellExecute() error #" & @error)

but it throws a system error in a modal dialog box:

   "The file "Target1.au3" cannot be found"

Followed by the AutoIt error:

   "ShellExecute() error #1"

I rewrote the script in VBScript to get the same error:

   "Error: The system cannot find the file specified.
   Code: 80070002"

It's incredible, but if I write out the path in the text code, it works!

After some search on the Net, I only found that:

https://bugs.kde.org/show_bug.cgi?id=292381

"Bug 292381 - Calligra StartApp.vbs"

 

Has anyone already heard something about this "bug"? Thanks for your reply.

PS.

Code for Target1.au3:

  1. Const $INFO_ICON = 0x40
  2.  
  3. If ($CmdLine[0] > 0) Then MsgBox($INFO_ICON, @ScriptName, $CmdLine[1])

To experiment with the "bug", you need those three files in a temp. directory:
   CallTarget.au3
   Target1.au3
   File1.txt
Drag and drop File1.txt over CallTarget.au3.
 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>