Giving a directory as an argument to a process

Thoth

Freshman
Joined
Jun 27, 2003
Messages
26
I have a program that calls a Photoshop droplet with a process. I want this droplet to do some work on all the files in a directory, so I want to call the directory with:

'proc is declared as New Process

proc.StartInfo.Arguments = "c:\letspretendthisisthefolder"

Is that fine? Or do I need to do something like "c:\letspretendthisisthefolder\*" to tell it to take everything inside that directory?
 
I don't know much about Photoshop droplets, but Id assume that you would just pass the directory argument as a c:\path, rather than with a *, because what else is it going to do with a directory other than look inside it....
 
The Photoshop droplet is just an .exe. So that looks like it will work, but I'll try both things just to be safe.
 
It looks like I'm still having this problem... when I pass the pathname as an Argument with Process.StartInfo.Arguments, the droplet loads, but says that the droplet could not be run because the file could not be found, the file in this case being a directory.

What is the proper way to pass a folder as an argument in a Process?
 
There shouldnt be anything wrong with your code, are you sure that is the only argument that the exe accepts or maybe you need something else. Are you sure you can pass in the directory? Maybe you could try passing in a file name.
 
I need to load multiple files into a Photoshop droplet.

Here is my code:

Dim runDroplet As New Process

'Name of the droplet.
runDroplet.StartInfo.FileName = "PHAction.exe"
'Folder where droplet is located.
runDroplet.StartInfo.WorkingDirectory = CStr(regKey.GetValue("DropletLocation", System.Reflection.Assembly.GetExecutingAssembly.Location.ToString))
'Directory where files are located, the Remove method removes the last '\' character in the folder.
Dim DropletDirectory As String = strDropletInputFolder.Remove(strDropletInputFolder.Length - 1, 1)
runDroplet.StartInfo.Arguments = DropletDirectory
runDroplet.Start()
'Wait for Photoshop to do work on the files before continuing the process.
runDroplet.WaitForExit()

I guess I could a For Each loop for every file in the directory.
 
The For Each loop doesn't solve the problem. I get this error message every time the Droplet is called with an argument:

Cannot run droplet because file cannot be found.

This error message comes from inside Photoshop, which means the droplet itself is opening properly.

However, dragging the files manually onto the droplet works just fine.

Agh, I don't understand.
 
Back
Top