Can I use property in my command line add file path? - 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!

wdai@onyxgfx
Posts: 4
Joined: Fri Jul 22, 2011 10:49 pm

Can I use property in my command line add file path?

Hi

Can I use (not define or change or del) property in my command line addfile path?
Here is my folder structure:

-patches(folder)
-patch.aip
-patch01.txt
-patch01_files(folder)
-myfolder(folder)
-helloworld.txt

I plan to make the patch.aip a generic file so that I don't need to modify it every time when I have a new patch.
I plan to do all "AddFile" in my patch01.txt for patch01, then maybe patch02.txt for my later patch02. Then execute patch.aip with patch01.txt to create patch01.msi

I want to know if i can use any command like following in my patch01.txt.

Code: Select all

AddFile APPDIR\myfolder AI_AIP_FOLDER\patch01_file\myfolder\helloworld.txt
(The AI_AIP_FOLDER is predefined property in Advanced Installer. It has been generated by ur software automatically when I create a project)
I dont want to use absolute value in my patch01.txt because we may move it to somewhere else.
I tried to use the relative path but failed, because the relative path is related to the cmd pwd instead of the file folder.

Is there anyway I can use property or any other thing that I can predefined in the command line addfile path?

Thanks
wdai@onyxgfx
Posts: 4
Joined: Fri Jul 22, 2011 10:49 pm

Re: Can I use property in my command line add file path?

I dont know y the folder structure looks so ugly there.

-patches(folder)
-->patch.aip
-->patch01.txt
-->patch01_files(folder)
-->-->myfolder(folder)
-->-->-->helloworld.txt

hope this is better.

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

Re: Can I use property in my command line add file path?

Hi,

I'm afraid that properties are available only inside the project. Even then, this type of dynamic paths are not supported directly. "AI_AIP_FOLDER" is actually a keyword which is interpreted by our command line interface.

An easy solution would be to use an environment variable which stores the main path. If you are using an ANT script, you could also try using a variable which you can set dynamically.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
wdai@onyxgfx
Posts: 4
Joined: Fri Jul 22, 2011 10:49 pm

Re: Can I use property in my command line add file path?

Hi Cosmin,

Thank you for getting back to me.
Can you show me a real example of environment variable?
I know how to set them but I don't know how to use them in the command line .txt file.

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Can I use property in my command line add file path?

Hi,

Here is an example of a command line that references an environment variable:

Code: Select all

AdvancedInstaller.com /edit "%yourEnvironmentVariable%yourAIP.aip" /AddFile APPDIR C:\Test.xml
In this case yourEnvironmentVariable is set to the full path of your .AIP.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
wdai@onyxgfx
Posts: 4
Joined: Fri Jul 22, 2011 10:49 pm

Re: Can I use property in my command line add file path?

Hi,

I tried the environmental variable in your way and I received an error on it:

Code in the command line txt file:

NewEnvironment -name THIS_PATH -value "E:\"
AddFile APPDIR\PSRip "%THIS_PATH%patch_file\PSRip\jawsdll16.dll"

Output received from cmd:

E:\local workspace\X10.1.0.1_Patch_03>"C:\Program Files (x86)\Caphyon\Advanced Installer 8.2\bin\x86\AdvancedInstaller.com" /execute "E:\local workspace\X10.1.0.1_Patch_03\10.1.0.1.aip" "E:\local workspace\X10.1.0.1_Patch_03\10.1.0\10.1.0.1.txt"

SetVersion 10.1.0.1
NewEnvironment -name THIS_PATH -value "E:\"
SetProperty ProductName="ProductionHouse X10.1.0.1 Patch"
AddFile APPDIR\PSRip "%THIS_PATH%patch_file\PSRip\jawsdll16.dll"
Exception - File not found: E:\local workspace\X10.1.0.1_Patch_03\%THIS_PATH%patch_file\PSRip\jawsdll16.dll.

Seems the compiler won't translate the environmental variable to the actual path. Did I make any mistake or misunderstand something here?

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

Re: Can I use property in my command line add file path?

Hi,

I'm afraid that Advanced Installer doesn't support environment variables inside command files. You didn't mention you are using a command file in your first post, so I assumed you are using the command line directly.

However, I added this on our TODO list and it will be available in a future version. Thank you for your suggestion.

Until then we recommend using a script (for example ANT) which sets a variable to your path and uses that variable for adding files dynamically. Command files are for repetitive build tasks, something like increase version, set a debug property and build. For more complex operations a script is much better.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”