Is File in Use

Verb: isFileInUse

Checks whether the selected file is in use and returns two Booleans: one indicating success of the action and the other indicating whether the file is in use or not.

Syntax

isFileInUse --file(String) (Boolean)=success (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--file File Path Required Text File path to check.

Outputs

Script Designer AcceptedTypes Description
success Success Boolean Indicates whether the action was performed successfully. "True" when the action is performed correctly, or "False" when it is not.
value Result Boolean Indicates whether the file is in use. "True" for when the file is in use, or "False" for when it is not.

Example

The command checks to see if the file in question is in use, also showing the success of the execution.

defVar --name documentsPath --type String
defVar --name filesFolder --type String
defVar --name fileToVerify --type String
defVar --name executionSuccess --type Boolean
defVar --name fileIsInUse --type Boolean
// Prepare the directory with the file to check.
getSpecialFolder --folder "MyDocuments" documentsPath=value
createDir --path "${documentsPath}\\fileInUse" filesFolder=value
writeToFile --value "File to check!!!" --file "${documentsPath}\\fileInUse\\fileToVerify.txt" --overwrite  fileToVerify=value
// Check if the file "${fileToVerify}" is in use.
isFileInUse --file "${fileToVerify}" executionSuccess=success fileIsInUse=value
logMessage --message "Execution Success: ${executionSuccess}\r\nFile is in use: ${fileIsInUse}" --type "Info"
// After the script has been executed, it is flagged if the file is in use and if the command was successfully executed.