Skip to content
⌘ NSIS Forum Archive

doesn't work, but why?

7 posts

mondofan#

doesn't work, but why?

hi there, i need to list the files to the file, something like

nsExec::Exec '"dir" $EXEDIR /B > $EXEDIR\temp.txt'
(there will be $PLUGINSDIR instead of second $EXEDIR, this is just for testing)
how to do it? i put this into .onInit, but it does nothing, please help, i ran out of ideas

thanks in advance
Afrow UK#
This works:

ReadEnvStr $R0 COMSPEC
SetOutPath $EXEDIR
nsExec::Exec '$R0 /C dir /B >"$EXEDIR\temp.txt"'

You should really use NSIS to do it though for compatibility on other Windows platforms (i.e. Longhorn / Vista):

Function .onInit
FileOpen $R0 "$EXEDIR\temp.txt" w
FindFirst $R1 $R2 "$EXEDIR\*.*"
Loop:
IfErrors Done
FileWrite $R0 $R2
ClearErrors
FindNext $R1 $R2
Goto Loop
Done:
FindClose $R1
FileClose $R0
FunctionEnd
-Stu
mondofan#
thanks for reply

ad Vista: yeah, i know, but i need those files sorted by time. i searched in nsis documentation, but found nothing that could do that. probably there is some plugin for this? if anyone knows something about it, please let me know.
deguix#
You'd need to have an array of files and times, and a way to get the times out of the files... NSIS Array + System plugins I think will do. I'm not certain if the Arrray plugin by Afrow UK can sort numbers.
Yathosho#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Afrow UK#
If you're still interested, I put together an example which does this task using my array plugin.
You can get the array plugin here:


The example is called MakeFileList.nsi which is in the Examples\NSISArray folder.

-Stu