/build/static/layout/Breadcrumb_cap_w.png

Regarding VBScript for Custom Action

[left][font="courier new"]How should i write a script if I want to replace "abc" to "pqr" and my path is[/left][left] C:\Program Files\Common files\XYZ\abc\[/left][left] [/left][left]which is my Destination folder in Installshield i.e where my binaries will go . Want to write a custom action in vbscript . So how should i proceed?[/left]

0 Comments   [ + ] Show comments

Answers (6)

Posted by: anonymous_9363 16 years ago
Red Belt
0
What are you trying to achieve? It's not clear if you want to change the destination folder in your InstallShield project or on the target workstation. If the former, just edit the relevant 'Directory' table entry. If the latter, you would use the FileSystemObject object's MoveFolder method to rename the folder. There are a gazillion examples on the web. Here's a simple one http://activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/folders/#RenameFolder.htm If it were me, I'd add lots of error-trapping to this code but YMMV.
Posted by: yshariff 16 years ago
Orange Senior Belt
0
Hello,


As per my knowledge,there is no option in VB Script of Replacing a file or folder, however you can delete the existing folder and create a new folder in its place and get your contents written to that folder.
On Error Resume Next
Set fso = CreateObject("Scripting.FilesSystemObject")
if fso.FolderExists ("C:\Program Files\Common files\XYZ\abc") Then
fso.DeleteFolder "C:\Program Files\Common files\XYZ\abc"
fso.CreateFolder "C:\Program Files\Common files\XYZ\pqr\
end If
Posted by: vilobh_meshram 16 years ago
Yellow Belt
0
I would Clarify my question . In Installshield , in the Property table under Direct Editor I have a propety with name "Consumer" who's value is "VM" now when I use this property in setting the registry value it gets reflected correctly i.e
HKLM\SOFTWARE\[Consumer]\ gets replaced to HKLM\SOFTWARE\VM but the Destination where the binaries will go i.e the Destination Directory is not getting the value i.e when I use C:\Program Files\Common Files\[Consumer]\abc
is not getting replaced with C:\Program Files\Common Files\VM\abc which I want.It shows as C:\Program Files\Common Files\[Consumer]\abc i.e "[Consumer]" thing. so now I want to replace this "[Consumer]" thing from the Destination Directory path and replcae it with the value which i have set in the Property table . How should I got about writing a Custom action in vbscript for this as I being a newbie in this area ????
Posted by: aogilmor 16 years ago
9th Degree Black Belt
0

[align=left][font="courier new"]How should i write a script if I want to replace "abc" to "pqr" and my path is[/align][align=left] C:\Program Files\Common files\XYZ\abc\[/align][align=left]which is my Destination folder in Installshield i.e where my binaries will go . Want to write a custom action in vbscript . So how should i proceed?[/align]

No time to read all the responses but I think Ian alluded to editing the Directory table. First you should find out what directory table entry corresponds to
C:\Program Files\Common Files\\abc and why the vm is not getting in there. Look in the directory table and see if there's an entry for
C:\Program Files\Common Files\vm\abc. If there is, you can use that directory name as a property in your reg value.
Posted by: AngelD 16 years ago
Red Belt
0
You should also be able to use a Set Directory or Property custom action.
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: vilobh_meshram
the Destination where the binaries will go i.e the Destination Directory is not getting the value i.e when I use C:\Program Files\Common Files\[Consumer]\abc is not getting replaced with C:\Program Files\Common Files\VM\abc which I want.It shows as C:\Program Files\Common Files\[Consumer]\abc i.e "[Consumer]" thing.
Got it, I think.

Owen (aogilmor) is on the right track. It's bad practice to use single properties in paths in the way you have done.

Look in your projects 'Directory' table and find the directory name which corresponds to 'C:\Program Files\Common Files\VM\ABC'. If I know the two major authoring tools, that Directory which be called 'ABC'. Use that directory name, i.e. 'ABC' as the property. Thus, instead of using

C:\Program Files\Common Files\[Consumer]\abc

use

[abc]
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