cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tongxj
Level 2

How to auto add product version on executable file name while executable file generated.

I'm using Installshield 2013 professional, script project. Everytime when executable file is generated, I should add version in file name manually then put it to a disk to backup. I want to know how to set file name that auto add product version on executable file name while executable file generated.

Labels (1)
0 Kudos
(2) Replies
varul
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @Tongxj 

If you know the product version, you can try using automation layer objects to automate the product name

 

sample code to edit the single file name in installscript project:

NOTE: sample code is created for IS2021, you need to change the 

pProject = CreateObject("ISWiAuto27.ISWiProject") to ISAIAuto20.ISWiProject

 

Dim pProject, ProjectPath

'Create project object for InstallShield 2021
Set pProject = CreateObject("ISWiAuto27.ISWiProject")

'for IS2013 automation layer support

'Set pProject = CreateObject("ISWiAuto20.ISWiProject")


'path to Project created 
ProjectPath = "C:\test\Installscript\Installscript_test.ism"

'-1 = ISMSI Project Type, 9 = installscript pro, 1 = msi
pProject.CreateProject ProjectPath, 9 
'change the -1 to 1 for BMSI project


'Open project
pProject.OpenProject "C:\InstallShield 2021 Projects\Installscript_Test.ism"

' Set the Product Version
pProject.ProductVersion = "3.2.1"

'Selecting Existing Component
Set pTestComp = pProject.ISWiComponents.Item("DefaultComponent")

pTestComp.AddFile("C:\Windows\Explorer.exe")


Dim pFeature
Set pFeature = pProject.AddFeature("New_Feature")

Dim pComponent
Set pComponent = pProject.AddComponent("New_Component")


Dim pFile
Set pFile = pComponent.AddFile("C:\Windows\Notepad.exe")

pFeature.AttachComponent (pComponent)


'Set an existing product configuration
Set Release = pProject.ISWiProductConfigs.Item("Media").AddRelease("Test")

Release.SingleEXEFileName="MyTest[3.2.1].exe"


'Save the project:
 pProject.SaveProject

'Build the release
 Release.Build()

0 Kudos

Dear varul,

Thank you for your quick reply. Your reply has opened a new door for me to implement automatic compilation in the future. But now I have some questions need your help.

Where is the sample code added in? Is the setup.rul  of the current IS project?

If so, in which event is it added?OnSetTargetDir()?

If not, on which software perform this sample code?

Currently, I perform the following steps manually

1. open exists IS script project;

2. modify the product version;

3. bulild release;

4. open release folder and rename exe files's name.

0 Kudos