Error message

Access denied. You may need to login below or register to access this page.

Access Denied / User log in

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!

Quick login

Use your existing social account to login without registration: no confirmation mail to wait for, no new password to remember, quick, easy, safe.

...or use your CoolSoft account

Enter your CoolSoft username.
Enter the password that accompanies your username.
Add reply | CoolSoft

Add reply

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!
(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.

Warning!

You're posting your message as anonymous user.

By registering you'll be allowed to receive notifications of post replies and new threads.
Registration is really quick and only requires you to choose an username and provide a valid email address.

Click here to to register.

A confirmation mail will be sent to this address.
Your email address won't be published.

More information about text formats

Filtered HTML

  • Allowed HTML tags: <a> <blockquote> <br> <cite> <code> <dd> <del> <dl> <dt> <em> <img> <li> <ol> <p> <pre> <s> <span> <strike> <strong> <ul>
    Allowed Style properties: background-color, color, font-size, font-style, height, text-align, text-decoration, text-transform, width
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>, <c>, <cpp>, <csharp>, <drupal5>, <drupal6>, <javascript>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Cancel
Posts: 10
Joined: June 9, 2014 - 21:07
Re: How to modify files question

I had it in a section and it didn't work, I changed it to a function, put it after the show (like in your sample) and it did, thanks for the sample man.

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: How to modify files question

Here's a sample script.
Compile, run the installer, choose a directory then press Close: you'll receive a MessageBox with the path you choosed + "\file.txt".

Attachments
1 file(s) attached
Posts: 10
Joined: June 9, 2014 - 21:07
Re: How to modify files question

I tried that but all I saw in the MessageBox was "\myfile.txt" no path from the DirRequest control.

Any idea why?

Thanks.

Posts: 1972
Joined: March 25, 2012 - 01:19
Re: How to modify files question
jfha73 wrote:

FileOpen $4 "$hCtl_MyDialog_MyCtrl_Text\file.txt" w

DirRequest control is a composite control: a TextBox and a Button.
Variable $hCtl_dialog1_DirRequest1_Txt is not the selected path but the handle of the textbox control.

Take a look at the NSISDesigner generated script.
There should be function, executed by the button when pressed, called fnc_hCtl_MyDialog_MyCtrl_Click (on your side).

This function calls reads current textbox content and stores it into $R0

${NSD_GetText} $hCtl_dialog1_DirRequest1_Txt $R0

shows the browser selection dialog, then reads the selected folder and set it back to the textbox with

${NSD_SetText} $hCtl_dialog1_DirRequest1_Txt "$R0"

so your code should first read the content of textbox into a variable, then concatenate it with your filename (the MessageBox is just for debugging):

${NSD_GetText} $hCtl_dialog1_DirRequest1_Txt $R0
StrCpy $R0 "$R0\file.txt"
MessageBox MB_OK "$R0"
FileOpen $4 "$R0" w
...

Hope this helps...

Posts: 10
Joined: June 9, 2014 - 21:07
Re: How to modify files question

Also, I just created a Dialog with a ListBox on it, the listbox contains a list of lines commented in an INI file, can somebody tell me how can I uncomment the lines selected in the ListBox?

Thanks.

Posts: 10
Joined: June 9, 2014 - 21:07
How to modify files question

Hey guys,

I created a Dialog with NSIS Dialog Designer that has a DirRequest control in it.

I'm calling FileOpen like this in the NSIS Script file:

FileOpen $4 "$hCtl_MyDialog_MyCtrl\file.txt" w
FileWrite $4 "Blah, Blah..."

I also tried

FileOpen $4 "$hCtl_MyDialog_MyCtrl_Text\file.txt" w

But I get no text added to the text file.

What am I doing wrong? and how can I get the file to open so I can write to it?

Thanks,