MCP
Posts: 1
Joined: Sat Dec 29, 2007 5:46 pm

Editing text file

Sat Dec 29, 2007 5:51 pm

Hi,

I'm looking for an installer that also makes it possible to edit a text document. I'm not really (really not?) good at programming and stuff, so what I want is an installer that not only 'unzips' files and folders, but also edits a .txt file in the process, that is predefined at a certain location by me.

Is this possible with your installer?

I didn't know where else to post this in your forum, so my apologies if it;s in the wrong section.

Kind Regards

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

Thu Jan 03, 2008 8:59 am

Hi,

I'm afraid that this feature is not supported by Advanced Installer.

However, what you need can be done by using a custom action and a scrollable edit. First, you create a "Scrollable Edit" control on a custom dialog in the "Dialogs" page (this can be done only in an Enterprise project). After this, you create two custom actions:
- the first will insert the text file into the property of the Scrollable Edit control
- the second one will save the text entered in the Scrollable Edit into a file

You can read more about custom actions here:
http://www.advancedinstaller.com/user-g ... -page.html
Also, you can find more information about the Dialog Editor feature here:
http://www.advancedinstaller.com/user-g ... ditor.html

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

navya
Posts: 55
Joined: Thu Jan 05, 2012 6:36 am

Re: Editing text file

Mon Jun 03, 2013 9:38 am

Example.aip
(24.95KiB)Downloaded 1699 times
Hi Team,

I have a requirement like i need to enter a path of one file which is installed in a package to the another file.
Example like, if i have 2 files names called
1)db.csv
2)db.properties
I need to store the path of db.csv file in db.properties file. how can i edit db.properties file and store that db.csv file path in it during installation.
Its really very very urgent , please can any one tell me the process to configure.

Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Editing text file

Mon Jun 03, 2013 12:22 pm

Hello,

An approach to have the path of the “db.csv” is this:
You can store the path of “db.csv” using the “New Text File Update” toolbar option from the “Files and Folders” page. You can use a meaningful name(e.g “db_csvPath.txt” and in the “File Content” from the “Append/Create” option you can have the path of your “db.csv” file. (e.g. [APPDIR]HiveDeveloper\db\db.csv or in the “File Content” you can use the “file” option from the right click mouse and browse for your file).
This means that in this file(in our example: “db_csvPath.txt” ) is written the path of the “db.csv” file.

Another approach can be the following:
You can create a custom action that will write the path of the “db.csv” in the “db.properties”. For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

navya
Posts: 55
Joined: Thu Jan 05, 2012 6:36 am

Re: Editing text file

Mon Jun 03, 2013 12:30 pm

Hi Dan,

Thank you for very quick response. I am waiting for your team response, for second options is there any thing related to java approach. any custom actions configuration using java :)

Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Editing text file

Mon Jun 03, 2013 1:18 pm

Hello,

In order to use a Java custom action you can follow our "Invoke a JAVA PROGRAM during Updating" thread steps.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

navya
Posts: 55
Joined: Thu Jan 05, 2012 6:36 am

Re: Editing text file

Tue Jun 04, 2013 8:06 am

Hi Team,

I have 2 files , i need to store 1file path in another file, As 'Dan' suggested i tried with selecting "New Select Text Update" and stored the path of one file in another file, now my question is when i am storing the path i am getting in the below format

C:\Program Files\....\.....\db\db.csv

I want the path to be stored in that file in

C://Program Files//....//.....//db//db.csv is there is way to change the format of "\" symbol to "//" slash. Thank you for help :)

Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Editing text file

Wed Jun 05, 2013 9:41 am

Hello,

In order to achieve that you can use a replace operation for your text file update. For example you can select your text update file (in our example I named it “db_csvPath.txt”) and in the “Replace” section you can set the "\" in the “Find” label and "//" in the “Replace” label.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

zappbrannigan
Posts: 16
Joined: Tue Jan 21, 2020 5:15 pm

Re: Editing text file

Fri Feb 12, 2021 2:57 pm

Is there any updated recommended method to solve this? Lots of new versions since this post.
I have a config file where I'd like to pass in a path value users will enter/select in the installer, and replace that specific setting in the text file.
Just looking for best practice and method.

Catalin
Posts: 6506
Joined: Wed Jun 13, 2018 7:49 am

Re: Editing text file

Fri Feb 12, 2021 3:50 pm

Hello,

In order to achieve that, you can use a "Text file update" operation.

Let's consider we have the following text file:
test.png
test.png (5.54KiB)Viewed 35328 times

If you want this to be updated during install, you can create in "Files and Folders" page a "Text file update".
TxtFileUpdate.png
TxtFileUpdate.png (287.19KiB)Viewed 35328 times

This way, your file will be updated.
UpdatedFile.png
UpdatedFile.png (45.74KiB)Viewed 35328 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Feature Requests”