IsFileLockedExclusive

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Commands Reference > File >

IsFileLockedExclusive

available from build: 20150423

Description

This command checks if a file is locked exclusively by another application (for example by Adobe Acrobat Reader when viewing a PDF file, or by Windows Explorer when previewing a PDF file).

Syntax

call DBWShell("IsFileLockedExclusive FilePathName")

Parameters

FilePathName

the full file path name

Return values

@IS_LOCKED_EXCLUSIVE

0: the file is not locked
1:the file is locked

Remarks

If the file is selected in windows explorer and the preview is enabled (or the file is opened in a viewer), then it results locked:

IsFileLockedExclusively03 IsFileLockedExclusively02  

 

while if the file is selecte in windows explores but the preview is not enabled (and the file is closed), the it results not locked:

IsFileLockedExclusively04 IsFileLockedExclusively01  

See also

IsFileLocked command

Example

sub main()

 filepath = DBWInput("@DOCUMENT_PATHNAME")
 DBWShell ("IsFileLockedExclusive " & replace((filepath)," ", "|"))
 isLocked = DBWResult("@IS_LOCKED_EXCLUSIVE")
 if isLocked = 1 then
  DBWMsgBox2 "the file is locked",16,"Check file lock exclusively"
 else
  DBWMsgBox2 "the file is not locked",64,"Check file lock exclusively"
 end if
end sub