At 06:51 AM 6/8/2016, [email protected] wrote:

Good morning R:BASE Community:

Is there a way within R:BASE to check to see if an external file is currently locked
before an attempt is made to update it?

Example: An UNLOAD routine attempts to update a CSV file but another program currently
has the CSV file open.

I need to check for this situation so I can add a PAUSE loop in my program to wait
until the destination file is no longer locked.


Mike,

Use the recently introduced Plugin GetFileLockStatus function to capture the lock status of a specified file. The Plugin can capture the file status for a user's ability to read, write, and read and write for a file, and also the "exclusive" capability for each.

Here's how ...

PLUGIN GetFileLockStatus vStatus|FileName.ext|<parameter>

Where:

vStatus is the variable to return the value of "Yes", "No", or "File does not exist." if
the specified file does not exist.

FileName.ext is the actual name and extension of the file, preceding with the full path.

Parameters:

CAN_READ captures status if user can read a shared file
CAN_WRITE captures status if user can write to a shared file
CAN_READ_WRITE captures status if user can read and write to a shared file
CAN_READ_EXCLUSIVE captures status if user can read from a file and not allow anyone
else to read
CAN_WRITE_EXCLUSIVE captures status if user can write to a file and not allow anyone
else to write
CAN_READ_WRITE_EXCLUSIVE (default value) captures status if user has exclusive access
to a file (nothing is shared)

Notes:

Returned variable name, exact file name with path, and third parameter must be separated
by a "|" pipe character.

The CAN_READ_WRITE_EXCLUSIVE parameter is the default value for the third parameter.

-- Example (check if a PDF has exclusive read/write status)

PLUGIN GetFileLockStatus vResult|D:\Documents\Customers.pdf|CAN_READ_WRITE_EXCLUSIVE

If the user has exclusive rights to read and write, the vResult value will be "Yes".

Plugin GetFileLockStatus is part of R:BASE Plugin Power Pack 9.5 and X (Version 10).

That's all there is to it!

Very Best R:egards,

Razzak



--
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to