Archive: Find Doc and Add Text.


Find Doc and Add Text.
Hi,
I am trying to figure out how to make my app find only certain files types ".map" in a dirctory and get name of those files
and make a list with the ".map" removed at the end.
Can some one plaese help me. Thanks


http://forums.winamp.com/showthread....ghlight=Locate

Use "GetBaseName" function from latest versions of headers:
http://forums.winamp.com/attachment....postid=1590305


Im looking for somthing like this.
but this 1 is crashing. and when i does work i get
hi.txt.res or lala.txt.res.......Hellp me. :igor:

Section hello
FindFirst $R0 $R1 $INSTDIR\*.txt
Loop1:
Push $R0 ;store file handle
Push $INSTDIR\$R1 ;current found file
Push addtext
Call addtext
Pop $R0
ClearErrors
FindNext $R0 $R1
IfErrors 0 Loop1
FileClose $R0
SectionEnd


Function addtext
ClearErrors
FileOpen $0 "$INSTDIR\the1.res" "r"
GetTempFileName $R0
FileOpen $1 $R0 "w"
loop:
FileRead $0 $2
IfErrors done
StrCmp $2 "datapaste" 0 +3
FileWrite $1 "Something"
Goto loop
FileWrite $1 $2
Goto loop

done:
FileClose $0
FileClose $1
Delete "$INSTDIR\the1.res"
CopyFiles /SILENT $R0 "$INSTDIR\$R3.res"
Delete $R0
FunctionEnd


ok more in depth.
I am trying to figure out how to make my app find only certain files types ".map" in a dirctory and get name of those files and make a list with the ".map" removed at the end.
and then with thows file names make .res files with this in them.
----------------------------------
"resources"
{
"Some inputted data from insaller"
}
------------------------------------
Can some one plaese help me. Thanks


Somthing like this, but i need more info
http://forums.winamp.com/showthread....light=FindNext


The functions are much better to use:

Search For a File
Search file or directory (alternative)

I think the easier to follow is the first one and it has an example of use. The second one has more options but doesn't have examples.


I will write a simplified function for you today (when I get home!)
It's simpler to do than the code you have.

-Stu


Thx 4 hellp'n the n00b.
Afrow UK, I looked in your profile and at "FindIt: Simple search for file / directory" could not figure it out.


I had time in Computing to do it:
http://nsis.sourceforge.net/archive/...22&instances=0

I haven't tested it, but it should work.

-Stu


works ok, but there is still the file extension at the end.


Change this:


FileWrite $R5 "$R0\$R4$\r$\n"
FindNext $R3 $R4

To this:

StrCpy $R4 $R4 -4
FileWrite $R5 "$R0\$R4$\r$\n"
FindNext $R3 $R4


-Stu

Afrow UK = #1 [NISI] Friend.
Thanks.


Hello.......
Need some more help.
With this, how do i get just the acount name?
==========
ReadRegStr $R0 HKCU "Software\Valve\Steam" ModInstallPath
StrCmp $R0 "" NotPresent Present

NotPresent:
StrCpy $INSTDIR "$PROGRAMFILESC\Valve\Steam\SteamApps\[Find it u'r self.]"
Goto Done

Present:
StrLen $R3 $R0
loop:
IntOp $R1 $R1 - 1
IntCmp $R1 -$R3 exit exit
StrCpy $R2 $R0 1 $R1
StrCmp $R2 "\" exit
Goto loop
exit:
StrCpy $R0 $R0 $R1
StrCpy $INSTDIR "$R0$0"
WriteIniStr "$PLUGINSDIR\main.ini" "Field 2" ListItems "$R0|"

Done:


Use GetParent from the docs (i.e. to strip "half-life" from the end). Then use this function to get the account name.

-Stu


Thanks but can you also help me with this?
I need to be able to new line it but if i do. it craps out
Please help

;------------------------------------------------------
ReadINIStr $R8 "$PLUGINSDIR\main.ini" "Field 6" "State"
Push "$INSTDIR\outputintores.txt" # output file
Push "*.*" # filter
Push "$R8" # folder to search in
;-------------------------------------
Exch $R0 #path
Exch
Exch $R1 #filter
Exch
Exch 2
Push $R3
Push $R4
Push $R5
Push $R9
ClearErrors
FindFirst $R3 $R4 "$R0\$R1"

Loop:
IfErrors Done3

FindNext $R3 $R4
StrCmp $R4 "." loop
StrCmp $R4 ".." loop
WriteINIStr "$PLUGINSDIR\main.ini" "Field 8" "State" "$R6$\r$\n$R4"
GetDlgItem $1 $HWND 1210
ReadINIStr $R6 "$PLUGINSDIR\main.ini" "Field 8" "State"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$R6"

Goto Loop

Done3:
Pop $R9
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
Abort ; Return to the page


is there a way to get MakeFileList work recursively?


This is what you need:
http://nsis.sourceforge.net/archive/...php?pageid=556

-Stu


Hello,

I'm trying to create an uninstall log for a lot of files to get a safe uninstallation routine going (http://forums.winamp.com/showthread.php?t=350538) and came here because of this entry http://nsis.sourceforge.net/MakeFile...files_from_dir

I was successful creating a list with MakeFileList, but it does not include subdirectories.

Originally posted by Yathosho
is there a way to get MakeFileList work recursively?
Does working recursively mean include subdirectories? If so, the following link posted by Stu is not working anymore.
Originally posted by Afrow UK
This is what you need:
http://nsis.sourceforge.net/archive/...php?pageid=556
-Stu
Maybe someone knows what he meant or how I can create the list with subdirectories or has some tip on the topic in my thread posted above. I would really appreciate it.

Greetings,
Seban