I'm using FileMaker Pro and would like to be able to open a folder in Windows Explorer given a folder path that isn't 100% complete.
We have a Contracts drive where our jobs get saved = X:\
in that folder there is 100 or so folders that all start with a unique number, but also have a job description after the number.
I want to send the command from FMP that opens the folder just given the number (e.g. X:\1234*).
From FMP I can use a Send Event function that can run command prompt. It could also run BAT files. I have this at the moment:
"cmd /c explorer Y:" & Jobs::JobNumber & "*"
(the parts in quotes are literal and outside returns the value stored in a field)
but that just opens Explorer at My Computer.
So I need a way to find the full folder path given the job number and then open that full folder path.
Any help would be awesome.
Thanks
Answer
In cmd
it is up to individual commands to interpret wild-cards, and explorer
doesn't do this. When launched with an invalid directory name, explorer
starts in the default directory, as you observed.
You can get cmd
to expand a wild-card by using a for
statement, as in:
for /d %d in (X:\1234*) do explorer %d
So your run string needs to be created with something like:
"cmd /c for %d in (Y:\" & Jobs::JobNumber & "*) do explorer %d"
I don't know how FileMaker Pro schedules system commands, but it's possible that you may need to double the %
signs, as in a batch file. If there are spaces in the expanded directory name, you will need to generate quotes around the explorer
parameter.
No comments:
Post a Comment