Skip to content
⌘ NSIS Forum Archive

WordFunc.nsh + TextFunc.nsh + FileFunc.nsh

49 posts

Comperio#
Thanks for the link, Instructor. Looks exactly what I was looking for!

So tell me, why is this not included with NSIS itself like you've your other functions? (Just curious)
Instructor#
So tell me, why is this not included with NSIS itself like you've your other functions? (Just curious)
I think this is not my question 🙂
Comperio#
OK, I found an odd problem:
I'm using the Locate function from NSIS ver 2.15.

I'm using it to search for all files/directies. I found that if I push two items to the stack, then locate will stop. But, if I just push one item to the stack, it works as expected.

I also noticed that when i push the text "blah" to the stack the 2nd time (instead of "continue"), I get a Windows error.

Here's a short sample showing the error:

name "test"
outfile "test.exe"
!define ROOT "C:\TEMP"
!include FileFunc.nsh
!insertmacro Locate

Page instfiles

Section
${Locate} "${ROOT}" "/L=FD /M=*.* /G=1 /B=0" "AddToList"
SectionEnd

Function AddToList
MessageBox MB_OK "$$R7=$R7"
Push "$R7"
Push "continue" ### if I remove this line, it works fine
FunctionEnd
Is this an NSIS error or a problem with ${locate}?
Instructor#edited
You can not use NSIS stack in the callback function, because it is used by function. Only one push requered in the callback.

P.S.
You can call another function from the callback, on condition that this function don't change the stack after completion.
Comperio#
hmmm... I see. I'll have to keep that in mind.

I didn't see this this info in the NSIS manuals. Are you the one that manages those, or do I need to post a separate request on the NSIS sourceforge site?
Comperio#
*sigh* 🙁
I may have opened a big can of worms with this. In my example script above, I changed the sample script above to write the file names to a text file instead of pushing to the stack using the command FileWrite $myHandle "$R7$\r$\n". (my hope was to bypass the stack completely and then retrieve the values one at a time later.) Unfortunately, I find that it didn't work, either. 😢

However, using a WriteIniStr command WriteIniStr "$myFileName" "General" "$R7" "" did work, so I guess I have a workaround.

But, I'd still like to understand why the FileWrite did not work. My only guess is that some NSIS functions (like FileWrite) must also use the NSIS stack. Is this correct? (If so, would perhaps using regular variables work better?)
Instructor#edited
See example in manual "Write results to a text file"

My only guess is that some NSIS functions (like FileWrite) must also use the NSIS stack. Is this correct?
FileOpen-FileWrite-FileClose don't use NSIS stack.
Comperio#
Thanks, Instructor. As always, your suggestion worked perfectly!
(I guess I can just chalk this up as a bad day.) 🤪
Guest#
Hi. I test this:

${VersionCompare} "2.3" "2.29" $0

And it tells me that $0 is 2. That means that 2.29 is a higher version than 2.3, which is wrong. Same goes with:

${VersionCompare} "2.29" "2.3" $0

it tells me that $0 is 1.

I'll try to fix it, but I'm a newbie in NSIS...
dienjd#
GetOptions doesn't work correctly when it finds a URL because of the "/" in the URL value (example: /url=http://nsis.sf.net)

Maybe a check can be added for "//" ?
dienjd#
I have a situation where I don't have control over what is passed in, so I can't have quotes put around the value itself. I got everything working by using a different routine to get the value. It's no problem, probably a very uncommon situation.
Instructor#
Word Functions Header v3.3
Text Functions Header v2.4
File Functions Header v3.2


Changes:

1. "GetFileAttributes" v1.2
   -Some corrections

2. Prevent error in case of including headers several times.
Instructor#
Word Functions Header v3.3
Text Functions Header v2.4
File Functions Header v3.3


Changes:

1. "Locate" v1.8
   -Handles were not getting closed properly.

2. "GetSize" v2.0
   -Handles were not getting closed properly.
dbyron#
Any chance to get the day and number of seconds returned from GetTime as a 0-padded string if it's less than 10? In other words "08" instead of "8" for seconds and day-of-month?

Thanks much.

-DB
Johnm312#edited
Edit. nevermind. I found the readme and i overlooked something.