Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 3rd August 2012, 16:40   #1
mike_123
Junior Member
 
Join Date: Jun 2012
Posts: 5
Set the environment variable to the app folder

Hi,

I'm new user to Nsis ;]

Sometimes you have to copy files For example: to %programdata% (C:\ProgramData)
before you launch the main program (executable file).

How to Set the environment variable to the app folder location so all

files and folders the program creates are redirected to the app folder location.


In other words, in place of copying a file to Windows directory, just redirected to the app folder and then lunch the executable file.



Thanks in advance.
mike_123 is offline   Reply With Quote
Old 3rd August 2012, 19:42   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,839
I don't understand what you're trying to say. If you're asking how to change the directory where NSIS extracts its files: That's what SetOutPath is for.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.9
MSG is offline   Reply With Quote
Old 3rd August 2012, 21:52   #3
mike_123
Junior Member
 
Join Date: Jun 2012
Posts: 5
MSG thank you very much for your quick reply.

I trying to make a launcher for program called Kleptomania( http://www.structurise.com/kleptomania/index.shtml)
which allows you to capture and process images and text.

To run the program you should first copy the k-mania.Ini to C:\Windows and then you can
launch the program.

So what I'm trying to do is. In place of copying a file to Windows directory, I want to

redirected k-mania.Ini to the app folder and then lunch the executable file.



This is an example of the script.

Section "Main"

CopyFiles /SILENT "$EXEDIR\Appdata\k-mania.Ini" "$WINDIR"
Sleep 300

ExecWait "$EXEDIR\Appdata\k-mania.exe"

CopyFiles /SILENT "$WINDIR\k-mania.Ini" "$EXEDIR\Appdata\"
Sleep 500

Delete "$WINDIR\k-mania.Ini"

SectionEnd


Here is an example from autohotkey community (http://www.autohotkey.com/community/...ic.php?t=56697


Thank you for your patience.


Mike
mike_123 is offline   Reply With Quote
Old 4th August 2012, 04:48   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,839
Ah, so you want to redirect your application's read/write calls to another directory? I don't know any way to do this, but I don't think this is really an NSIS question. You might be better off hacking the application's exe to look for the ini file in another directory.

(Note that you should never change the value of %WINDIR%, as that would break lots of applications massively.)
MSG is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump