Filename containing property value - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

srini
Posts: 81
Joined: Mon Sep 14, 2009 4:22 pm

Filename containing property value

Hi,

I would like to create a file containing a property value. For example if I have defined a property MYPROPERTY and if I want to create a file called Something_<Value of MYPROPERTY>.ext how can I do this?

Thanks
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Filename containing property value

Hi,

Please note that the name of a file is a pseudo-formatted string so you can use a property when defining it.
Just double click the file from the Files and Folders page , in the Properties tab from the dialog go to Name field. Here you can write something like this:

Code: Select all

Something_[|MYPROPERTY]
Please note that the property must be enclosed into square brackets and preceded by the '|' character.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
srini
Posts: 81
Joined: Mon Sep 14, 2009 4:22 pm

Re: Filename containing property value

Thanks Bogdan. I was trying to use [|ComputerName] as the name of a folder. Therefore it was failing. How to get the computer name when creating a folder?

Thanks
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Filename containing property value

Hi,

Please note that the PseudoFormatted type is resolved at build time. Not at install time. Therefore only the properties that appear in the
dialog "Select a Property" can be used. The same is valid for the filename.

The property "ComputerName" is resolved during installation, not during the build of the package.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
srini
Posts: 81
Joined: Mon Sep 14, 2009 4:22 pm

Re: Filename containing property value

Hi Bogdan,

One of the requirements of my installer is to create a folder and a file with the computer name that the software was installed, in the APPDIR. As you have mentioned [|ComputerName] will not be solved at build time. Is there a way to work this around?

Thanks
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Filename containing property value

Hi,

You can try installing the folder and the file with a custom name and the use the move (for folder) and ren (for file) commands as custom actions to rename them.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
srini
Posts: 81
Joined: Mon Sep 14, 2009 4:22 pm

Re: Filename containing property value

Hi Cosmin,

Thanks for the solution. But I could not figure out how to perform the move and ren (I could not find anything related in the context menu). Can you please let me know how to perform a move?

Thanks
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Filename containing property value

Hello,

The "move" and "ren" are cmdlets. You would use a "Launch File 0r Open URL" custom action, and you would use something like:

Code: Select all

cmd /c move <source> <target>
The syntaxes of the move and ren cmdlets are described at the links posted by Cosmin.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
srini
Posts: 81
Joined: Mon Sep 14, 2009 4:22 pm

Re: Filename containing property value

Thanks Gabriel. I will try your solution and let you know.

Return to “Common Problems”