PDA

View Full Version : How to warn if file is in use?



NewsArchive
06-20-2007, 04:59 AM
I make quite a lot of services that run on a server. I would like to avoid a
restart of the server when installation is finished. How can I force the
user to close my programs before continuing installation?

Thanks
Bjarne

NewsArchive
06-20-2007, 04:59 AM
Bjarne,

You can use the "Check In-use File" and/or "Check In-use Folder Tree"
functions to handle this.

You can even use the above function(s) in a Loop to make sure the user
really closed the applications.

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-20-2007, 07:48 AM
Yes, it helped - forced me to learn how to work with scripts there...
Tried Check In-Use Folder tree too, but I am unable to display the result
%_SB_RETURNEX%



[ Install Files ]
Loop (3 Times)
Set Variable %INUSE% to FUNCTION:Check In-use File
"%_SB_INSTALLDIR%\ADIBARSCAN.EXE"
If %INUSE% Equals "1" Then
Display Message Box "AdiBarscan.exe is reported in use.\nClose the
appl..." -- "File In Use"
Else
Break Loop
End
End
If %INUSE% Equals "1" Then
Exit Installation 0
End

Bjarne Havnen

NewsArchive
06-20-2007, 07:48 AM
%_SB_RETURNEX% returns a list of filename(s) in use. You can display it in
a List Box dialog. Or you can use "Handle String Function" -> Count List
Items / Get List Item, etc. to do specific things with specific file items.

Friedrich

NewsArchive
06-20-2007, 07:48 AM
For example (see attached screenshot).

I'll also attach the project to this thread. The project will check the
c:\clarion6\bin folder for in-use files. Start Clarion and compile/run the
SetupBuilder project.

Does this help?

Friedrich

NewsArchive
06-20-2007, 07:49 AM
SetupBuilder 6.5 Developer Edition demo script.

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-20-2007, 07:59 AM
I was struggling a little to find the correct place for the code when
checking directory. If I want to check my install directory, I can't place
it before installing files. I belive this might be because the installation
logfile is created and opened by setup. So I need the location after
selecting directory, but before using files. Seems that before creating the
uninstall log is ok.

I'll look into the rest of your suggestions a little later.

Bjarne

NewsArchive
06-20-2007, 08:01 AM
Do it in the "Loop Wizard" that displays your Welcome, License, Select
Dialog, etc. dialogs. This is before you modify anything on the target
machine!

If you need help, just let me know.

Friedrich

NewsArchive
06-20-2007, 08:29 AM
I'm sorry, but I think I have to read some more docs. I don't understand
how to position the code in the right place
This is my dialogs. I should have the code after #3 or #5, but you say in
Loop Wizard. Where in the docs can I find it explained how to know which
dialog is finished?

! Wizard dialog definition(s)
Define Wizard Dialog "#1" (Welcome)
Define Wizard Dialog "#2" (Password)
Define Wizard Dialog "#3" (Select Install Folder) (%_SB_INSTALLDIR%)
Define Wizard Dialog "#4" (Custom Install)
Define Wizard Dialog "#5" (Ready to Install)

! The Wizard Loop displays the dialog screens that the user sees in the
installation
Loop Wizard (Abort Dialog Active)
!should I place code within here???
End

Bjarne Havnen

NewsArchive
06-20-2007, 08:29 AM
I would suggest to check the "Dialog 2.sb6" demo script in the Examples
package. A script says more than 100 pages in the manual <g>.

You'll end doing something like that:

Loop Wizard (Abort Dialog Active)
!should I place code within here???
If %_SB_DIALOGID% Equals "3" Then
!yadayada
END
End

Just add the dialog that displays the in-use files to the list of your
dialogs. Then hide it and only display it when you have detected in-use
files.

Very easy to do with only 6-8 lines of code. If you need help, just shout.

Friedrich

NewsArchive
06-20-2007, 08:30 AM
The dialog worked perfect, looks very professional.

Bjarne Havnen