Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 28th February 2005, 23:08   #1
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
Question 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
WiLdWoLfStray is offline   Reply With Quote
Old 1st March 2005, 00:38   #2
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 655
http://forums.winamp.com/showthread....ghlight=Locate

Use "GetBaseName" function from latest versions of headers:
http://forums.winamp.com/attachment....postid=1590305
Instructor is offline   Reply With Quote
Old 1st March 2005, 01:29   #3
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
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.

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

Last edited by WiLdWoLfStray; 1st March 2005 at 01:58.
WiLdWoLfStray is offline   Reply With Quote
Old 1st March 2005, 01:51   #4
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
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

Last edited by WiLdWoLfStray; 1st March 2005 at 02:55.
WiLdWoLfStray is offline   Reply With Quote
Old 1st March 2005, 03:50   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,350
Send a message via ICQ to deguix
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.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 1st March 2005, 08:10   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 6,950
I will write a simplified function for you today (when I get home!)
It's simpler to do than the code you have.

-Stu
Afrow UK is offline   Reply With Quote
Old 1st March 2005, 12:04   #7
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
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.
WiLdWoLfStray is offline   Reply With Quote
Old 1st March 2005, 13:34   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 6,950
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
Afrow UK is offline   Reply With Quote
Old 1st March 2005, 17:05   #9
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
works ok, but there is still the file extension at the end.
WiLdWoLfStray is offline   Reply With Quote
Old 1st March 2005, 17:42   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 6,950
Change this:
code:

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


To this:
code:

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



-Stu
Afrow UK is offline   Reply With Quote
Old 1st March 2005, 19:10   #11
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
Afrow UK = #1 [NISI] Friend.
Thanks.
WiLdWoLfStray is offline   Reply With Quote
Old 2nd March 2005, 01:33   #12
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
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:
WiLdWoLfStray is offline   Reply With Quote
Old 2nd March 2005, 13:08   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 6,950
Use GetParent from the docs (i.e. to strip "half-life" from the end). Then use this function to get the account name.

-Stu
Afrow UK is offline   Reply With Quote
Old 2nd March 2005, 22:58   #14
WiLdWoLfStray
Junior Member
 
Join Date: Feb 2005
Location: USA, IL
Posts: 12
Send a message via AIM to WiLdWoLfStray
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
WiLdWoLfStray is offline   Reply With Quote
Old 20th March 2005, 15:22   #15
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 2,736
Send a message via ICQ to Yathosho
is there a way to get MakeFileList work recursively?
Yathosho is offline   Reply With Quote
Old 12th April 2005, 20:16   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 6,950
This is what you need:
http://nsis.sourceforge.net/archive/...php?pageid=556

-Stu
Afrow UK 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


All times are GMT. The time now is 02:20.