PDA

View Full Version : Checking For In Use



NewsArchive
06-05-2023, 02:07 PM
I am way back in SetupBuilder 10 to which we just moved from SB4 -
yeah, I know.

I am trying to check for in-use files. I must not be doing this is the
right place within the script because it isn't working for me.
Example, I have the following in my script:

Set Variable %APPFILES_LOCKED% to FUNCTION:Check In-use Folder Tree
("%_SB_INSTALLDIR%", 2) [IgnoreSelf]
Display Message Box ("%APPFILES_LOCKED%", "Folder In Use")

The function always assigns 0 to %APPFILES_LOCKED% evenb with multiple
files opened and in use.


I have also tried an individual single file like:

Set Variable %INUSE% to FUNCTION:Check In-use File
("%_SB_INSTALLDIR%\shared.txt")
Display Message Box ("%INUSE%", "Warning")


It doesn't matter what I do with this file shared.txt - It can be
opened, it can in fact be in edit mode with changes etc... But the
function never returns that the file is in-use and always returns 0

These are straight out of the manual - what am I missing?? Help!!

Andy Morgan

NewsArchive
06-05-2023, 02:07 PM
PS: SB overwrites the shared.txt file anyway - even when in an edited
and open state. If I close it after running the SB script - the file
new file was saved.

Andy Morgan

NewsArchive
06-05-2023, 02:08 PM
what are you using to "hold" the .txt file? Are you sure that the file
is actually locked when open in your editor?

Jeff Slarve

NewsArchive
06-05-2023, 02:08 PM
Hi Jeff,

It doesn't matter what I try to test. This also fails for me:

Set Variable %INUSE% to FUNCTION:Check In-use File
("%_SB_INSTALLDIR%\inv.exe")

The inv.exe application is running with a browse open.

I went through all the SB examples and found Detect Active Application
and tried this:

Set Variable %ACTIVEAPP% to FUNCTION:Detect Active Application
("inv.exe") [File Name]

But that only works if the exe is running on THAT particular pc. A
client pc with the application open does not return true.

SB4 just did this and basically exited if files were in use.

But I cannot see the script in SB4 - there is a file menu option but
its greyed out. UGH

Andy

NewsArchive
06-05-2023, 02:09 PM
Hi Jeff,

Nevermind I have it all working now. I was trying to use the variables
BEFORE their values were set. Earlier I had it in the right place but
mistakes in code. By the time I got the code right - I was in the
wrong place LOL

Thanks for trying to help

Andy