vuRunExistsEx(pFile, WaitSec, PollMS)
vuRunExistsEx(*CSTRING pFile, LONG WaitSec, LONG PollMS), LONG
Description
Attempts to run the specified file if it exists. Optionally waits for the file to appear, polling at the given interval, before running it.
| Function |
Separate File/Params |
Working Folder |
Delay |
Wait |
Notes |
| vuRun |
No |
No |
No |
Yes |
Single command-line string. Good for simple or legacy launches. |
| vuRunDelay |
No |
No |
Yes |
No |
Single command-line string with a startup delay. |
| vuRunEx |
Yes |
Yes |
No |
No |
Preferred modern launch when you want file and parameters passed separately. |
| vuRunExWait |
Yes |
Yes |
No |
Yes |
Preferred modern launch with separate parameters and optional wait. |
| vuRunExDelay |
Yes |
Yes |
Yes |
No |
Modern launch with separate parameters plus startup delay. |
| vuRunExDelayWait |
Yes |
Yes |
Yes |
Yes |
Modern launch with separate parameters, startup delay, and optional wait. |
| vuRunExists |
No |
No |
No |
No |
Runs only if the target file already exists. |
| vuRunExistsEx |
No |
No |
Polls for file |
No |
Waits for a file to appear, then runs it. |
Parameters
| Parameter |
Data Type |
Description |
| pFile |
*CSTRING |
Full path to the file or executable to run. |
| WaitSec |
LONG |
Maximum number of seconds to wait for the file to appear. |
| PollMS |
LONG |
Polling interval in milliseconds while waiting for the file. |
CSTRING size note: CSTRING(1024) in this example is a caller-side declaration, not an unlimited-length guarantee. This function copies the relevant path, parameter, or working-folder text into internal 1,024-byte null-terminated buffer(s), so each copied value must fit (up to 1,023 characters plus its null byte). Longer input may be truncated; Windows can impose additional restrictions. See CSTRING Sizes and Buffer Capacity.
Returns
A LONG value indicating the result:
- 1 if the file appeared and was launched successfully
- 0 if the file never appeared or could not be launched
- Negative values may indicate a Windows shell error
Example
FilePath CSTRING(1024)
Ret LONG
FilePath = 'C:\Temp\Incoming\DailyReport.pdf'
Ret = vuRunExistsEx(FilePath, 10, 200)
Notes
- Use this when another process is expected to create the file shortly.
- WaitSec = 0 means do not wait; the function will only check once.