- NSIS Discussion
- WordFunc.nsh + TextFunc.nsh + FileFunc.nsh
Archive: WordFunc.nsh + TextFunc.nsh + FileFunc.nsh
Instructor
28th December 2004 11:23 UTC
WordFunc.nsh + TextFunc.nsh + FileFunc.nsh
I have thought :) more convenient to update one topic than three topics
Word Functions Header v2.52
Text Functions Header v1.4
File Functions Header v1.21
1. Function GetParameters moved from WordFunc.nsh to FileFunc.nsh
2. Text Functions LineFind and LineRead
-now last line "-1" instead of "0"
These headers are included with NSIS. See: http://nsis.sourceforge.net/Docs/AppendixE.html#E
Instructor
18th January 2005 00:53 UTC
Word Functions Header v2.6
Text Functions Header v1.4
File Functions Header v1.3
1. "GetDrives" v1.1
-Fixed: depended on drives order
2. "WordFind2X" v2.1
-Loops sorted
3. New: "WordFind3X" v1.0
-Find word, that contain string, between two delimiters.
(Based on Afrow UK idea of Function "StrSortLR" 2003-06-18)
4. "WordFuncExample.nsi" updated.
Instructor
1st February 2005 08:05 UTC
Word Functions Header v2.6
Text Functions Header v1.5
File Functions Header v1.3
"LineFind" v1.3
-Added "/NUL" option: No output text file (only read InputFile).
Instructor
13th February 2005 02:50 UTC
Word Functions Header v2.6
Text Functions Header v1.5
File Functions Header v1.4
1. New: "GetBaseName"
-Get file name without extension.
(Based on comperio idea of Function "GetBaseName" 2005-01-28)
2. New: "GetFileVersion"
-Gets the version information from executable file.
3. New: "VersionCompare" v1.0
-Compare version numbers.
(Based on Afrow UK Function "VersionCheckNew2" 2005-01-24)
His original function isn't included because of wrong results:
${VersionCheckNew2} "2.5.9" "2.5.01" $R0 -Ver2 newer
${VersionCheckNew2} "2.5.09" "2.5" $R0 -equal
kichik
13th February 2005 04:33 UTC
Why is 2.5.09 equal to 2.5? Just a typo or does the function behave that way?
Instructor
13th February 2005 09:29 UTC
No. It isn't a typo.
Comm@nder21
13th February 2005 14:12 UTC
@kichik:
His original function isn't included because of wrong results:
${VersionCheckNew2} "2.5.9" "2.5.01" $R0 -Ver2 newer
${VersionCheckNew2} "2.5.09" "2.5" $R0 -equal
read it another time :)
Afrow UK
13th February 2005 18:16 UTC
Thanks for letting me know :hang:
Fixed my function.
-Stu
Instructor
21st March 2005 08:24 UTC
Word Functions Header v2.6
Text Functions Header v1.6
File Functions Header v1.4
1. "LineFind" v1.4
-Output file will not be updated if no changes made
-Error flag if output file path isn't exists
-Added: "{No}" callback this line and don't write others
-Variables in callback function changed
2. Added script to simple install WordFunc.nsh, TextFunc.nsh, FileFunc.nsh
Instructor
26th March 2005 20:53 UTC
Word Functions Header v2.7
Text Functions Header v1.7
File Functions Header v1.5
1. "ClbSet", "ClbGet" removed from WordFunc.nsh
2. "LineRead" v1.2, "LineSum", "FileJoin" v1.4, "TextCompare" v1.2
-Added IfErrors after FileOpen
3. "GetDrives" v1.2
-Added "ALL" along with ""
4. New: "FileReadFromEnd" v1.0
-Read text file from end line by line.
5. New: "DriveSpace" v1.0
-Get total, occupied or free space of the drive.
6. Added: "GetRoot"
(Based on KiCHiK Function "GetRoot")
-Get the root directory.
7. Added: "GetParent"
(Based on sunjammer Function "GetParent")
-Get parent directory.
8. Added: "GetFileName"
(Based on KiCHiK Function "GetFileName")
-Get last part from directory path.
9. Many minor code and documentation improvements
Instructor
27th March 2005 09:49 UTC
Word Functions Header v2.7
Text Functions Header v1.7
File Functions Header v1.6
"DriveSpace", "DirState", "GetFileVersion"
-Missing ClearErrors at the beginning.
Instructor
28th March 2005 11:56 UTC
Word Functions Header v2.7
Text Functions Header v1.8
File Functions Header v1.7
In order to avoid exiting from connected functions,
changed exit value in callback function to "Stop<FunctionName>":
-"LineFind" Stop -> StopLineFind
-"FileReadFromEnd" Stop -> StopFileReadFromEnd
-"TextCompare" StopCompare -> StopTextCompare
-"GetDrives" Stop -> StopGetDrives
Instructor
1st April 2005 18:45 UTC
Word Functions Header v2.8
Text Functions Header v1.8
File Functions Header v1.8
1. "Locate" v1.5
-Added "/B=" parameter (when used banner with function)
2. "StrFilter" v1.2
-Missing ClearErrors at the beginning.
Instructor
11th April 2005 12:31 UTC
Word Functions Header v2.8
Text Functions Header v1.8
File Functions Header v1.9
Changes:
"Locate" v1.6
-Fixed: if error appeared in the callback, function don't restore stack after exit.
Instructor
14th April 2005 11:01 UTC
Word Functions Header v2.8
Text Functions Header v1.8
File Functions Header v2.0
Changes:
New: "GetOptions"
-Get options from command line parameters.
Instructor
20th April 2005 12:53 UTC
Word Functions Header v2.9
Text Functions Header v2.0
File Functions Header v2.3
Changes:
1. Verbosity added (faster compilation time)
2. "Locate" v1.7
-Fixed: Banner support
3. "GetOptions"
-Now required only 2 arguments:
${GetOptions} "[Parameters]" "[Option]" $var
4. "GetTime" v1.2
-Now convert day and month in DD and MM format
5. "TextCompare" v1.4
-Rewrited all code
6. "FileReadFromEnd" v1.2
-Now if the text file cannot be opened, the error flag is set
Instructor
24th May 2005 19:05 UTC
Word Functions Header v3.0
Text Functions Header v2.1
File Functions Header v2.4
Changes:
1. "VersionCompare" moved from FileFunc.nsh to WordFunc.nsh
2. New: "VersionConvert" v1.0
-Convert version in the numerical format which can be compared.
3. New: "ConfigRead" v1.0
-Read value from entry name in config file.
4. New: "ConfigWrite" v1.1
-Write value from entry name in config file.
5. New: "FileRecode"
-Recode text file from DOS to Windows format and vice-versa.
6. New: "GetFileAttributes" v1.1
-Get attributes of file or directory.
7. New: "BannerTrimPath"
-Trim string path for banner.
Instructor
12th July 2005 12:35 UTC
Word Functions Header v3.0
Text Functions Header v2.1
File Functions Header v2.5
Changes:
1. "GetDrives" v1.4
-Fixed: Alloc/Free (Thanks nechai)
2. "GetOptions"
-Better option search (complite ignoration in quotes)
3. Renamed example scripts (like in CVS):
...FuncTest.nsi -> ...Func.nsi
...FuncTest.ini -> ...Func.ini
Instructor
21st July 2005 00:49 UTC
Word Functions Header v3.0
Text Functions Header v2.1
File Functions Header v2.6
Changes:
1. "GetTime" v1.3
-Fixed: Free structures
2. "GetExeName" and "GetExePath"
-Simplification with "GetLongPathNameA"
3. "BannerTrimPath"
-Added D mode
Instructor
23rd August 2005 13:20 UTC
Word Functions Header v3.1
Text Functions Header v2.1
File Functions Header v2.7
Changes:
1. "WordReplace" v2.1
-Fixed: Incorrect rule for return errorlevel 1 in situation when string beginning with word to replace and its only one word in string and when uses option - deletes all founded words (thanks hemancuso)
2. "GetExeName" and "GetExePath"
-Fixed: Return empty string in Windows 95 (thanks kichik)
Instructor
21st October 2005 19:22 UTC
Word Functions Header v3.1
Text Functions Header v2.1
File Functions Header v2.8
Changes:
1. Now "GetRoot" returns not only root drive or UNC:
${GetRoot} "Program Files\NSIS" $R0 # $R0="Program Files" instead of ""
${GetRoot} "\Program Files\NSIS" $R0 # $R0="\Program Files" instead of ""
2. Some typos corrected (thanks Jamyn)
MikeSchinkel
23rd December 2005 08:47 UTC
What about UTC (Coordinated Universal Time?)
I need to use UTC (Coordinated Universal Time) instead of Local Time which can be gotten from kernel32::GetSystemTime. Any chance of updating the "official" version of Text Functions Header to incorporate that functionality?
My other option is to hack GetTime() and include it directly in my code. Yuck.
Instructor
24th December 2005 14:16 UTC
Word Functions Header v3.1
Text Functions Header v2.1
File Functions Header v2.9
Changes:
"GetTime" v1.4
-Added support for system time (UTC)
-Added example how to convert time to 12-hour format AM/PM
TonyDS
3rd February 2006 14:01 UTC
Has the getdrives function been tested on windows 98,
If so does it work?
Instructor
3rd February 2006 14:30 UTC
Has the getdrives function been tested on windows 98
Yes
If so does it work?
:) Yes
TonyDS
3rd February 2006 14:37 UTC
Thanks
Instructor
5th February 2006 18:37 UTC
Word Functions Header v3.2
Text Functions Header v2.2
File Functions Header v3.0
Changes:
1. "WordReplace" v2.2
-Added options "{", "}", "{*", "}*"
2. "GetOptions"
-Now sets error flag if option does not found
3. "ConfigRead"
-Now sets error flag if entry does not found
4. New case sensitive functions (NSIS 2.14 required):
"WordFindS", "WordFind2XS", "WordFind3XS", "WordReplaceS",
"WordAddS", "WordInsertS", "StrFilterS", "TextCompareS",
"ConfigReadS", "ConfigWriteS", "GetOptionsS"
5. Added program for simple headers install
Instructor
6th February 2006 09:19 UTC
Word Functions Header v3.2
Text Functions Header v2.3
File Functions Header v3.1
Changes:
-Added /NOUNLOAD flag for the system plugin. Functions that uses system plugin calls several times, now 25-75% faster ("GetSize", "DriveSpace", "GetDrives", "GetTime", "ConfigWrite", "FileRecode").
Comm@nder21
6th February 2006 19:48 UTC
kichik, plz update the CVS :)
Comperio
9th March 2006 01:46 UTC
Hey Instructor,
I have to say that your functions are very cool. I find that I use them almost every chance I get!
Here's an enhancement suggestion for the Locate function:
Currently, there is an option /M=[mask] to add options of what to search for. A cool option might be something like /!M=[mask] to specify what to EXCLUDE.
For example /!M=*.EXE would mean to exclude all dat files from the search.
Using both together, one might use
/M=*.DAT /!M=doofus.dat
which would translate to:
"Include all *.DAT files except the file named 'doofus.dat'"
That's all I have for now. Keep up the great work!:up:
Instructor
9th March 2006 03:17 UTC
Many filters implemented in Locate plugin
Comperio
9th March 2006 03:53 UTC
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
9th March 2006 05:34 UTC
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
9th March 2006 15:26 UTC
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
9th March 2006 16:27 UTC
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
9th March 2006 19:42 UTC
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
9th March 2006 23:24 UTC
*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. :cry:
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
10th March 2006 04:00 UTC
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
10th March 2006 14:37 UTC
Thanks, Instructor. As always, your suggestion worked perfectly!
(I guess I can just chalk this up as a bad day.) :weird:
Ary Manzana
22nd March 2006 13:25 UTC
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...
- NSIS Discussion
- WordFunc.nsh + TextFunc.nsh + FileFunc.nsh
Archive: WordFunc.nsh + TextFunc.nsh + FileFunc.nsh
Ary Manzana
22nd March 2006 13:27 UTC
Sorry, I had a lapsus there. Just ignore my last post. :-P
dienjd
1st April 2006 00:29 UTC
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 "//" ?
Instructor
1st April 2006 04:40 UTC
Use quotes /url="http://nsis.sf.net"
dienjd
1st April 2006 05:19 UTC
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
22nd May 2006 17:29 UTC
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
23rd September 2006 07:20 UTC
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.
Animaether
23rd September 2006 08:23 UTC
*zap* I was on an old page when I commented - d'oh!
dbyron
16th November 2008 23:51 UTC
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
8th April 2009 17:47 UTC
Edit. nevermind. I found the readme and i overlooked something.