View Full Version : Delete Files "%DATAPATH%\*.*"
NewsArchive
10-11-2011, 04:52 AM
Hi Friedrich
Got this script line Delete Files "%DATAPATH%\*.*" but it doesnt delete
anything.
Its in an uninstall script ie a script called when someone uninstalls the
app, the regkeys are deleted fine, the service and runnings app close down
fine which is all called before the above line but the files are not being
deleted.
Any ideas?
I'm wondering if the service and app havent closed down before the delete
files line is called perhaps or does the StopService wait for the service to
close before going onto the next line.
Cheers
Richard
NewsArchive
10-11-2011, 04:53 AM
> Got this script line Delete Files "%DATAPATH%\*.*" but it doesnt delete
> anything.
If it is a per user CSIDL path, then the most likely thing is that the
installer ( running elevated ) would be looking at one location in the
drive and the application ( which normally runs non-elevated ) would be
putting the data in another.
So as a result, there are no data files in the location where the installer
is looking to delete them from.
JAT...
Charles
--
-------------------------------------------------------------------------------------------------------
Charles Edmonds
www.clarionproseries.com - ProScan, ProImage, ProPath and other Clarion
developer tools!
www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
www.setupcast.com - "A revolutionary new publishing system for software
developers - enhanced for SetupBuilder users!"
www.pagesnip.com - "Print and Save the Web, just the way you want it!"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms - Now with PNG support!
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------
NewsArchive
10-11-2011, 04:53 AM
No its in %_CSIDL_COMMON_APPDATA% but the user can change the location and
that is stored.... Might be worth checking if the %DataPath has a value
first. *rollseyes*
..
Richard Rose
NewsArchive
10-11-2011, 04:54 AM
%DataPath% didnt have the value, I had assumed it would have remembered or
picked up the values from when it was installed. Fixed now.
Thanks!
Richard Rose
NewsArchive
10-11-2011, 04:54 AM
> No its in %_CSIDL_COMMON_APPDATA% but the user can change the location and
> that is stored.... Might be worth checking if the %DataPath has a value
> first. *rollseyes*
LOL - been there, done that<g>.
:-)
Charles
--
-------------------------------------------------------------------------------------------------------
Charles Edmonds
www.clarionproseries.com - ProScan, ProImage, ProPath and other Clarion
developer tools!
www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
www.setupcast.com - "A revolutionary new publishing system for software
developers - enhanced for SetupBuilder users!"
www.pagesnip.com - "Print and Save the Web, just the way you want it!"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms - Now with PNG support!
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------
NewsArchive
10-11-2011, 04:54 AM
Hi Richard,
> Got this script line Delete Files "%DATAPATH%\*.*" but it doesnt delete
> anything.
>
> Its in an uninstall script ie a script called when someone uninstalls the
> app, the regkeys are deleted fine, the service and runnings app close down
> fine which is all called before the above line but the files are not being
> deleted.
>
> Any ideas?
>
> I'm wondering if the service and app havent closed down before the delete
> files line is called perhaps or does the StopService wait for the service
> to close before going onto the next line.
First of all, I would make sure that Stop Service really stopped it. You
can check this in a LOOP (perhaps the service needs some time to
close-down). What we do in script writing cosulting projects is, we stop a
service, then check the service again (LOOP 5 times with a 4 seconds delay,
break LOOP if service is not running) to give some time.
Then, what you can do is to see if the files are still "in-use". You can
use the "Check In-use File..." and/or "Check In-use Folder Tree..." script
functions to handle this. "Check In-use Folder Tree..." can even return a
list of filename(s) in use.
Friedrich
NewsArchive
10-12-2011, 02:00 AM
Hi Friedrich
> Then, what you can do is to see if the files are still "in-use". You can
> use the "Check In-use File..." and/or "Check In-use Folder Tree..." script
> functions to handle this. "Check In-use Folder Tree..." can even return a
> list of filename(s) in use.
DeleteTree is what I needed instead of Delete *.*, despite having checks
already in place and I mistakenly thought I hadnt populated the %Datapath%
it was populated right at the very beginning of the script I just hadnt seen
it.
One other problem I have have is the uninstaller window doesnt appear on
screen until after the uninstall script has finished. The taskbar shows the
window button and the popup messages appear on screen from the uninstall
script asking if I want to delete the data files but the main uninstaller
just doesnt show.
Any ideas how I can get the uninstaller window to appear properly before the
uninstall script is started?
Cheers
Richard
NewsArchive
10-12-2011, 02:01 AM
Hi Richard,
> DeleteTree is what I needed instead of Delete *.*, despite having checks
> already in place and I mistakenly thought I hadnt populated the %Datapath%
> it was populated right at the very beginning of the script I just hadnt
> seen it.
>
> One other problem I have have is the uninstaller window doesnt appear on
> screen until after the uninstall script has finished. The taskbar shows
> the window button and the popup messages appear on screen from the
> uninstall script asking if I want to delete the data files but the main
> uninstaller just doesnt show.
>
> Any ideas how I can get the uninstaller window to appear properly before
> the uninstall script is started?
The "Process Uninstall Queue" script function displays the uninstall dialog.
Add your own functions after that function. And of course, make sure you
are using the latest SB75 uninstall!
Friedrich
NewsArchive
10-12-2011, 02:02 AM
I cant move the Process Uninstall Queue becuase its shutting down programs
before it can uninstall them. A catch 22.
Richard Rose
NewsArchive
10-12-2011, 02:02 AM
> I cant move the Process Uninstall Queue becuase its shutting down programs
> before it can uninstall them. A catch 22.
Aha, okay. Then display your own Wait dialog before that standard uninstall
screen. You can use all available functions in the uninstall script
(including wizards, but excluding Install File(s) actions).
Friedrich
NewsArchive
10-12-2011, 02:03 AM
In the help docs it says DeleteTree returns non zero for success
"If the function succeeds, the %_SB_ERRORCODE% return value is nonzero.
If the function fails, the return value is zero. "
yet the code below keeps throwing up a failed delete despite deleting the
folders, sub folders & files.
Delete Tree "%DATAPATH%"
Set Variable %WAITCOUNTER% to "0"
Loop
Sleep for "4" seconds
If %_SB_ERRORCODE% Equals "0" Then
Display Message Box "Unable to delete the data files from
%DATAPATH%" -- "Data File Delete Failed"
Break Loop
ElseIf %_SB_ERRORCODE% Greater Than "0" Then
Break Loop
Else
Display Message Box "Unknown Error trying to delete the data
files from..." -- "Data File Delete Failed"
End
If %WAITCOUNTER% Equals "10" Then
Display Message Box "There is a problem as Uninstaller was
unable to de..." -- "Data File Delete Failed"
Break Loop
Else
Set Variable %WAITCOUNTER% to (Increment by 1)
End
End
End
IF I swap the IF statements around like so:
Delete Tree "%DATAPATH%"
Set Variable %WAITCOUNTER% to "0"
Loop
Sleep for "4" seconds
If %_SB_ERRORCODE% Greater Than "0" Then
Display Message Box "Unable to delete the data files from
%DATAPATH%" -- "Data File Delete Failed"
Break Loop
ElseIf %_SB_ERRORCODE% Equals "0" Then
Break Loop
Else
Display Message Box "Unknown Error trying to delete the data
files from..." -- "Data File Delete Failed"
End
If %WAITCOUNTER% Equals "10" Then
Display Message Box "There is a problem as Uninstaller was
unable to de..." -- "Data File Delete Failed"
Break Loop
Else
Set Variable %WAITCOUNTER% to (Increment by 1)
End
End
I dont get the error message saying it failed to delete and it deletes the
files & folders as required.
Help docs is Documentation Release: 7.5 Build 3378 (July 9, 2011) using the
latest SB I downloaded a moment ago.
I've also noticed in the latest version I'm getting a black toolbar and it
seems to install more slowly as well. Do you want screenshots when it
happens next? I just shut it down when I see them at the moment.
Richard Rose
NewsArchive
10-12-2011, 02:04 AM
Hi Richard,
A black toolbar? I have never ever heard of this, and SetupBuilder is doing
millions of installs per day <g>. Nothing changed in the install procedure
for at least six years!
Could you post a screenshot?
BTW, I think you forgot to "save" the %_SB_ERRORCODE% return value?! and so
the next function overwrites your expected return code. I see that you make
use of %_SB_ERRORCODE%, but it seems to me that you are handling the wrong
return codes.
I would suggest to do something like this:
Delete Tree "%DATAPATH%"
Set Variable %MY_ERRORCODE% to "%_SB_ERRORCODE%" <------- HERE!
Set Variable %WAITCOUNTER% to "0"
Loop
Sleep for "4" seconds
....
Just tested the "Delete Tree" return values. The installer successfully
removed all files and folders and returned "1". Then I locked one file in
the folder tree and tried it again. This time, it returned "0" (and
corretly reported a failed action).
Friedrich
NewsArchive
10-12-2011, 02:05 AM
> Could you post a screenshot?
It just happened again, tabbing from SB to this message I was writing and
back again and the popup window has also changed background colour from the
normal grey.
> BTW, I think you forgot to "save" the %_SB_ERRORCODE% return value?!
Is this just relaying the Win32 api GetLastError()?
If it is then I can see the need to save the errorcode but then I wouldnt
need to wait in a loop and the rest of the functions like display message
dont return a %_SB_ErrorCode% either so bit confused over this one.
Richard Rose
NewsArchive
10-12-2011, 02:06 AM
Hi Richard,
> It just happened again, tabbing from SB to this message I was writing and
> back again and the popup window has also changed background colour from
> the normal grey.
Perhaps your video driver? I remember a similar message from you one year
ago (IIRC, you were running a virtual machine).
>> BTW, I think you forgot to "save" the %_SB_ERRORCODE% return value?!
>
> Is this just relaying the Win32 api GetLastError()?
>
> If it is then I can see the need to save the errorcode but then I wouldnt
> need to wait in a loop and the rest of the functions like display message
> dont return a %_SB_ErrorCode% either so bit confused over this one.
%_SB_ERRORCODE% is only valid for the last executed command. So if you
would like to make use of it later, you have to save it.
Friedrich
NewsArchive
10-12-2011, 02:07 AM
> Perhaps your video driver? I remember a similar message from you one year
> ago (IIRC, you were running a virtual machine).
Could be the video driver, I'm running on VMware so its the VMware SVGA2
driver and it happens on my laptop as well which unlike my custom built
desktop is a semi ruggedised US-Mil spec Dell Latitude which wasnt cheap.
The problem you refer to above is when the VMware screen resizes ie I come
out of full screen and go back to a window which can be any size and then
back to full screen again, the vertical tabs on the right dont resize when
the screen is resized back to full resize, they hover in the position as if
the reduced screen is still in effect. Everything else resizes but the tabs
dont seem to be covered by the resizing.
> %_SB_ERRORCODE% is only valid for the last executed command. So if you
> would like to make use of it later, you have to save it.
Just tested both ways (direct and saved to a var) and they both work so I'll
leave it as is and the wait dialog works a treat.
Delete Tree "%DATAPATH%"
If %_SB_ERRORCODE% Equals "0" Then
/* Set Variable %DELETETREEERRORCODE% to "%_SB_ERRORCODE%" */
/* If %DELETETREEERRORCODE% Equals "0" Then */
Display Message Box "Unable to delete the data files from
%DATAPATH%" -- "Data File Delete Failed"
End
Job Done. :-)
Cheers
Richard
NewsArchive
10-12-2011, 02:08 AM
Hi Richard,
> Could be the video driver, I'm running on VMware so its the VMware SVGA2
> driver and it happens on my laptop as well which unlike my custom built
> desktop is a semi ruggedised US-Mil spec Dell Latitude which wasnt cheap.
The dialogs in the screenshot look strange. But there is nothing in the IDE
code that can do this. It's all native Clarion code and the Clarion runtime
did not change for years. So I fear it's a driver thing :-(
>
> Job Done. :-)
>
Cool :-)
Friedrich
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.