/build/static/layout/Breadcrumb_cap_w.png

Make a file visible?

Hello guys I hope you can help me with the following issue...
I'm using Wise Installation Studio 7.3.0.250.

I have file called ".xyz". This file has been saved by a third party application in the CommonAppDataFolder.
It is hidden and has the attrib system.
I want this file get deleted during install and uninstall by my application...

How can I make it visible, make the system attrib vanish and how can I delete it after all that by my msi application?

This must work under win2000 to win7.

Any ideas?

Thanks in advance

Cheers

0 Comments   [ + ] Show comments

Answers (27)

Posted by: emmy12 14 years ago
Senior Yellow Belt
0
Can you try a custom action that uses attib -h command
place thsi custom action before removefiles std action and within contion REMOVE=ALL

cheers,
Emmy
Posted by: McRip 14 years ago
Orange Senior Belt
0
Could ya please provide me with a work-around? I mean how does the , I guess, cmd commandline look like?
Do I have to put it into the execute immediate or into the deferred?

cmd.exe/c ....

Thanks in advance
Posted by: suchi.jigar 14 years ago
Purple Belt
0
May be i am wrong but no need to make that file visible. I have done it without making it visible.

http://itninja.com/question/gnu,-freeware-and-shareware-programs-to-cloning9587&mpage=1&key=&#49660
Posted by: McRip 14 years ago
Orange Senior Belt
0
Thanks,
can I modify this path?
strpath = strprogramfiles & "\.xyz" into "[CommonAppDataFolder].xyz" ???
Cause I never worked with such scripts before...

And if I can do this what kind of script is it? vbscript, wisescript, embedded code or something? sorry for asking anything like this.

Cheers
Posted by: suchi.jigar 14 years ago
Purple Belt
0
wait for some time, i will edit this script according to your requirement, and then i will post it.....by the way this is vbscript
Posted by: McRip 14 years ago
Orange Senior Belt
0
Thank you very much, bro.

I hope it will work on Vista and Win 7, too.

Cheers
Posted by: suchi.jigar 14 years ago
Purple Belt
0
'this script will check the file exists, and then it will delete it.
Option Explicit
On Error Resume NExt
Dim Objshell
Dim Objfso
Dim strallusersfiles
Dim strpath
Dim strpath1
Dim strpath2
Dim objfolder


Set objshell = Createobject("Wscript.shell")
Set Objfso = Createobject("scripting.filesystemobject")
strallusersfiles = objshell.expandenvironmentstrings("%allusersprofile%")

strpath = strallusersfiles & "\Application Data\Suchikant.txt"

If objfso.fileexists (strpath) Then

objfso.deletefile (strpath)

End If
Posted by: McRip 14 years ago
Orange Senior Belt
0
Thanks a lot. I will test it to the acid.

I will reply later on if it works or not...
Posted by: McRip 14 years ago
Orange Senior Belt
0
Sorry but it doesn't work at all. The file doesn't get deleted during install und uninstall sequence.

I don't know what do do now.

??????????????????????????????????????????????????????????????
Posted by: suchi.jigar 14 years ago
Purple Belt
0
on which operating system it is not working? and have you tried to trigger it manually? if manually it is working then, it should work
Posted by: McRip 14 years ago
Orange Senior Belt
0
I was just testing it on xp sp3.

I was not testing it manually
Posted by: suchi.jigar 14 years ago
Purple Belt
0
test it manually 1st just by double clicking on it....and keep file at %allusersprofile%\application data\suchikant.txt
Posted by: dj_xest 14 years ago
5th Degree Black Belt
0
Hello McRip,

Just a piece of advice... Try using the many available standard actions using your Wise tool before using a Custom Action. Your problem is very easy to be fixed by using RemoveFile table...
Posted by: McRip 14 years ago
Orange Senior Belt
0
I was just trying it but does't work.
VBScript is activated
Posted by: suchi.jigar 14 years ago
Purple Belt
0
yes.....it should get solved through removefile table as well......because i have put .gid file entries in removefile table, and it works. .gid files are hidden files
Posted by: McRip 14 years ago
Orange Senior Belt
0
Thanks guys for your efforts here. I solved it by using the remove file table.

Thank you
Posted by: McRip 14 years ago
Orange Senior Belt
0
I was testing a bit more and it is working. The reason why it didn't work before is pretty simple.
I'm testing on a German operating system.

My question now is:
The path variable for english operating systems is %ALLUSERSPROFILE%\Application Data
The path variable for german operating systems is %ALLUSERSPROFILE%\Anwendungsdaten

Is there a global path variable for solving this issue? Because it can not be true that it doesn't work on different operating systems with different languages.

There must be a resolution for it.

Any ideas???????????? Because I want to get it working. Please understand this, guys.

Thanks in advance
Posted by: anonymous_9363 14 years ago
Red Belt
0
Use the CommonAppDataFolder property instead of an environment variable. http://msdn.microsoft.com/en-us/library/aa367992%28VS.85%29.aspx
Posted by: McRip 14 years ago
Orange Senior Belt
0
ORIGINAL: VBScab

Use the CommonAppDataFolder property instead of an environment variable. http://msdn.microsoft.com/en-us/library/aa367992%28VS.85%29.aspx


I knew that this point will be posted...

Thanks VBScab.
Do I have to use it in brackets or not in the embedded vb code?
[CommonAppDataFolder] or CommonAppDataFolder

Thanks in advance
Posted by: anonymous_9363 14 years ago
Red Belt
0
All properties need to be referenced inside square brackets, yes.

How one accesses properties in embedded VBS depends on where the CA is sequenced.

In 'Execute Immediate', use Session.Property("the_name_of_the_property"). In 'Execute Deferred', scripts have access to only a very limited set of properties, one of which is 'CustomActionData'. Use of that special property is tricky to explain but I have a go here http://itninja.com/question/how-do-you-roll-out-new-machines?7008&mpage=1&key=customactiondata榃 and our good friend Owen posts a link to another explanation below my post.
Posted by: McRip 14 years ago
Orange Senior Belt
0
OK, guys, if you are interested, here is my modified code and it works great:

'this script will check the file exists, and then it will delete it.
Option Explicit
On Error Resume next
Const alluser = &H23&
Dim Objshell
Dim oFSO
Dim filetokill
Dim oAlluser
Dim oAlluserItem

Set oFSO = Createobject("scripting.filesystemobject")
Set objShell = CreateObject("Shell.Application")
Set oAlluser = objShell.Namespace(alluser)
Set oAlluserItem = oAlluser.Self

filetokill = oAlluserItem.Path & "\something.txt"

If oFSO.fileexists (filetokill) Then
oFSO.deletefile (filetokill)
End If
on error goto 0


Cheers
Posted by: anonymous_9363 14 years ago
Red Belt
0
Your script (not uncommonly) assumes that everything is going to work. A basic addition would be:
If oFSO.fileexists (filetokill) Then
oFSO.deletefile (filetokill)
If oFSO.fileexists (filetokill) Then
'// Tell the user by your chosen mechanism (e.g. MsgBox or Event Log, preferably both) that the delete failed
End If
End If
on error goto 0
Posted by: suchi.jigar 14 years ago
Purple Belt
0
Why do we use on error go to 0?
Posted by: McRip 14 years ago
Orange Senior Belt
0
GoTo 0
Disables enabled error handler in the current procedure and resets it to Nothing.


http://msdn.microsoft.com/en-us/library/5hsw66as.aspx

Cheers
Posted by: suchi.jigar 14 years ago
Purple Belt
0
is it same like on error resume next?
Posted by: McRip 14 years ago
Orange Senior Belt
0
Resume Next
Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred, and execution continues from that point. Use this form rather than On Error GoTo when accessing objects.

Cheers
Posted by: anonymous_9363 14 years ago
Red Belt
0
The script is a bad example on its use, since it's used here to stop any errors interrupting the program's flow but without any handling of any error which might occur. Thus, if for some reason the Shell object failed to be created, the script would carry on regardless. Of course, it's unlikely that that would happen but, as I'm forever trying to tell people, you should ALWAYS assume that the worst WILL happen. So, taking the Shell object creation as an example, it really ought to look like this:Set objshell = Createobject("Wscript.shell")
If Not IsObject(objshell) Then
'// Tell the user that their machine is seriously broken
WScript.Quit(False)
End If
...and so on.When you've written a few scripts which include object creation, you'll quickly add a function template called, say, ObjectCreation, to which you can add all the error-handling, meaning that the code which does the work isn't cluttered with endless 'If Not IsObject' constructs.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ