Include header:

    Call functions:

    1. Section Install
    2. ${GetFileExt} "C:\My Downloads\Index.html" $R0
    3. ; $R0="html"
    4. SectionEnd
    1. Section un.Install
    2. ${GetParent} "C:\My Downloads\Index.html" $R0
    3. ; $R0="C:\My Downloads"
    4. SectionEnd

    E.1.2 Locate

    • Find files, directories and empty directories with mask and size options.

    Syntax:

    1. ${Locate} "[Path]" "[Options]" "Function"
    1. "[Path]" ; Disk or Directory
    2. ;
    3. "[Options]" ; /L=[FD|F|D|DE|FDE]
    4. ; /L=FD - Locate Files and Directories (default)
    5. ; /L=F - Locate Files only
    6. ; /L=D - Locate Directories only
    7. ; /L=DE - Locate Empty Directories only
    8. ; /L=FDE - Locate Files and Empty Directories
    9. ; /M=[mask]
    10. ; /M=*.* - Locate all (default)
    11. ; /M=*.doc - Locate Work.doc, 1.doc ...
    12. ; /M=Pho* - Locate PHOTOS, phone.txt ...
    13. ; /M=win???.exe - Locate winamp.exe, winver.exe ...
    14. ; /M=winamp.exe - Locate winamp.exe only
    15. ; /S=No:No[B|K|M|G]
    16. ; /S= - Don't locate file size (faster) (default)
    17. ; /S=0:0B - Locate only files of 0 Bytes exactly
    18. ; /S=5:9K - Locate only files of 5 to 9 Kilobytes
    19. ; /S=:10M - Locate only files of 10 Megabyte or less
    20. ; /S=1G - Locate only files of 1 Gigabyte or more
    21. ; /G=[1|0]
    22. ; /G=1 - Locate with subdirectories (default)
    23. ; /G=0 - Locate without subdirectories
    24. ; /B=[0|1]
    25. ; /B=0 - Banner isn't used (default)
    26. ; /B=1 - Banner is used. Callback when function
    27. ; start to search in new directory
    28. "Function" ; Callback function when found
    29.  
    30. Function "Function"
    31. ; $R9 "path\name"
    32. ; $R8 "path"
    33. ; $R7 "name"
    34. ; $R6 "size" ($R6="" if directory, $R6="0" if file with /S=)
    35.  
    36. ; $R0-$R5 are not used (save data in them).
    37. ; ...
    38.  
    39. Push $var ; If $var="StopLocate" Then exit from function
    40. FunctionEnd

    Note:- Error flag if disk or directory isn't exist - Error flag if syntax error - See also:

    Example (Find one file):

    1. Section
    2. ${Locate} "C:\ftp" "/L=F /M=RPC DCOM.rar /S=1K" "Example1"
    3. ; 'RPC DCOM.rar' file in 'C:\ftp' with size 1 Kb or more
    4.  
    5. IfErrors 0 +2
    6. MessageBox MB_OK "Error" IDOK +2
    7. MessageBox MB_OK "$$R0=$R0"
    8. SectionEnd
    9.  
    10. Function Example1
    11. StrCpy $R0 $R9
    12. ; $R0="C:\ftp\files\RPC DCOM.rar"
    13.  
    14. MessageBox MB_YESNO '$R0$\n$\nFind next?' IDYES +2
    15. StrCpy $0 StopLocate
    16.  
    17. Push $0
    18. FunctionEnd

    Example (Write results to a text file):

    1. Section
    2. GetTempFileName $R0
    3. FileOpen $R1 $R0 w
    4. ${Locate} "C:\ftp" "/S=:2M /G=0" "Example2"
    5. ; folders and all files with size 2 Mb or less
    6. ; don't scan subdirectories
    7. FileClose $R1
    8.  
    9. IfErrors 0 +2
    10. MessageBox MB_OK "Error" IDOK +2
    11. Exec '"notepad.exe" "$R0"'
    12. SectionEnd
    13.  
    14. Function Example2
    15. StrCmp $R6 '' 0 +3
    16. FileWrite $R1 "Directory=$R9$\r$\n"
    17. goto +2
    18. FileWrite $R1 "File=$R9 Size=$R6 Mb$\r$\n"
    19.  
    20. Push $0
    21. FunctionEnd

    Example (Write results to an INI file):

    1. Section
    2. GetTempFileName $R0
    3. ${Locate} "C:\ftp" "/L=F /S=0K" "Example3"
    4. ; all files in 'C:\ftp' with size detect in Kb
    5.  
    6. IfErrors 0 +2
    7. MessageBox MB_OK "Error" IDOK +2
    8. Exec '"notepad.exe" "$R0"'
    9. SectionEnd
    10.  
    11. Function Example3
    12. WriteINIStr $R0 "$R8" "$R7" "$R6 Kb"
    13.  
    14. Push $0
    15. FunctionEnd

    Example (Delete empty directories):

    1. Section
    2. StrCpy $R2 0
    3. StrCpy $R3 0
    4.  
    5. loop:
    6. StrCpy $R1 0
    7. ${Locate} "C:\ftp" "/L=DE" "Example4"
    8. IntOp $R3 $R3 + 1
    9. IntOp $R2 $R2 + $R1
    10. StrCmp $R0 StopLocate +2
    11. StrCmp $R1 0 0 loop
    12.  
    13. IfErrors 0 +2
    14. MessageBox MB_OK 'error' IDOK +2
    15. MessageBox MB_OK '$R2 directories were removed$\n$R3 loops'
    16. SectionEnd
    17.  
    18. Function Example4
    19. MessageBox MB_YESNOCANCEL 'Delete empty "$R9"?' IDNO end IDCANCEL cancel
    20. RMDir $R9
    21. IntOp $R1 $R1 + 1
    22. goto end
    23.  
    24. cancel:
    25. StrCpy $R0 StopLocate
    26.  
    27. end:
    28. Push $R0
    29. FunctionEnd

    Example (Move all files into one folder):

    1. Section
    2. StrCpy $R0 "C:\ftp" ;Directory move from
    3. StrCpy $R1 "C:\ftp2" ;Directory move into
    4.  
    5. StrCpy $R2 0
    6. StrCpy $R3 0
    7. ${Locate} "$R0" "/L=F" "Example5"
    8.  
    9. IfErrors 0 +2
    10. MessageBox MB_OK 'error' IDOK +4
    11. StrCmp $R3 0 0 +2
    12. MessageBox MB_OK '$R2 files were moved' IDOK +2
    13. MessageBox MB_OK '$R2 files were moved$\n$R3 files were NOT moved'
    14. SectionEnd
    15.  
    16. Function Example5
    17. StrCmp $R8 $R1 +6
    18. IfFileExists '$R1\$R7' +4
    19. Rename $R9 '$R1\$R7'
    20. IntOp $R2 $R2 + 1
    21. goto +2
    22. IntOp $R3 $R3 + 1
    23.  
    24. Push $0
    25. FunctionEnd

    Example (Copy files with log):

    1. Section
    2. StrCpy $R0 "C:\ftp" ;Directory copy from
    3. StrCpy $R1 "C:\ftp2" ;Directory copy into
    4. StrLen $R2 $R0
    5.  
    6. GetTempFileName $0
    7. FileOpen $R3 $0 w
    8. ${Locate} "$R0" "/L=FDE" "Example6"
    9. FileClose $R3
    10.  
    11. IfErrors 0 +2
    12. MessageBox MB_OK 'error'
    13.  
    14. Exec '"notepad.exe" "$0"' ;view log
    15. SectionEnd
    16.  
    17. Function Example6
    18. StrCpy $1 $R8 '' $R2
    19.  
    20. StrCmp $R6 '' 0 +3
    21. CreateDirectory '$R1$1\$R7'
    22. goto end
    23. CreateDirectory '$R1$1'
    24. CopyFiles /SILENT $R9 '$R1$1'
    25. IfFileExists '$R1$1\$R7' 0 +3
    26. FileWrite $R3 "-old:$R9 -new:$R1$1\$R7 -success$\r$\n"
    27. goto +2
    28. FileWrite $R3 "-old:$R9 -new:$R1$1\$R7 -failed$\r$\n"
    29.  
    30. end:
    31. Push $0
    32. FunctionEnd

    Example (Recreate directory structure):

    1. Section
    2. StrCpy $R0 "C:\ftp" ;Directory structure from
    3. StrCpy $R1 "C:\ftp2" ;Directory structure into
    4. StrLen $R2 $R0
    5.  
    6. ${Locate} "$R0" "/L=D" "Example7"
    7.  
    8. IfErrors 0 +2
    9. MessageBox MB_OK 'error'
    10. SectionEnd
    11.  
    12. Function Example7
    13. StrCpy $1 $R9 '' $R2
    14. CreateDirectory '$R1$1'
    15.  
    16. Push $0
    17. FunctionEnd

    Example (Locate with banner - NxS plugin required):

    1. Section
    2. nxs::Show /NOUNLOAD `$(^Name) Setup` /top \
    3. `Setup searching something$\r$\nPlease wait... If you can..` \
    4. /h 1 /can 1 /end
    5. ${Locate} "C:\WINDOWS" "/L=F /M=*.inf /B=1" "Example8"
    6. nxs::Destroy
    7. SectionEnd
    8.  
    9. Function Example8
    10. StrCmp $R0 $R8 abortcheck
    11. StrCpy $R0 $R8
    12. nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end
    13.  
    14. abortcheck:
    15. nxs::HasUserAborted /NOUNLOAD
    16. Pop $0
    17. StrCmp $0 1 0 +2
    18. StrCpy $0 StopLocate
    19.  
    20. StrCmp $R9 '' end
    21. ;...
    22.  
    23. end:
    24. Push $0
    25. FunctionEnd

    E.1.3 GetSize

    • Find the size of a file, files mask or directory.
    • Find the sum of the files, directories and subdirectories.

    Syntax:

    1. ${GetSize} "[Path]" "[Options]" $var1 $var2 $var3
    1. "[Path]" ; Disk or Directory
    2. ;
    3. "[Options]" ; /M=[mask]
    4. ; /M=*.* - Find all (default)
    5. ; /M=*.doc - Find Work.doc, 1.doc ...
    6. ; /M=Pho* - Find PHOTOS, phone.txt ...
    7. ; /M=win???.exe - Find winamp.exe, winver.exe ...
    8. ; /M=winamp.exe - Find winamp.exe only
    9. ; /S=No:No[B|K|M|G]
    10. ; /S= - Don't find file size (faster) (default)
    11. ; /S=0:0B - Find only files of 0 Bytes exactly
    12. ; /S=5:9K - Find only files of 5 to 9 Kilobytes
    13. ; /S=:10M - Find only files of 10 Megabyte or less
    14. ; /S=1G - Find only files of 1 Gigabyte or more
    15. ; /G=[1|0]
    16. ; /G=1 - Find with subdirectories (default)
    17. ; /G=0 - Find without subdirectories
    18. ;
    19. $var1 ; Result1: Size
    20. $var2 ; Result2: Sum of files
    21. $var3 ; Result3: Sum of directories

    Note:- Error flag if disk or directory isn't exist - Error flag if syntax error - See also:

    Examples:

    1. Section 'Find file size of "$WINDIR\Explorer.exe" in KiB'
    2.  
    3. ${GetSize} "$WINDIR" "/M=Explorer.exe /S=0K /G=0" $0 $1 $2
    4. ; $0="220" KiB
    5. ; $1="1" files
    6. ; $2="" directories
    7.  
    8. IfErrors 0 +2
    9. MessageBox MB_OK "Error"
    10. SectionEnd
    1. Section 'Find folder size of "C:\Installs\Drivers" in MiB'
    2.  
    3. ${GetSize} "C:\Installs\Drivers" "/S=0M" $0 $1 $2
    4. ; $0="132" MiB
    5. ; $1="555" files
    6. ; $2="55" directories
    7.  
    8. IfErrors 0 +2
    9. MessageBox MB_OK "Error"
    10. SectionEnd
    1. Section 'Find sum of files and folders in "$WINDIR" (no subfolders)'
    2.  
    3. ${GetSize} "$WINDIR" "/G=0" $0 $1 $2
    4. ; $0="" size
    5. ; $1="253" files
    6. ; $2="46" directories
    7.  
    8. IfErrors 0 +2
    9. MessageBox MB_OK "Error"
    10. SectionEnd

    E.1.4 DriveSpace

    • Get total, occupied or free space of the drive.

    Syntax:

    1. ${DriveSpace} "[Drive]" "[Options]" $var
    1. "[Drive]" ; Disk to check
    2. ;
    3. "[Options]" ; /D=[T|O|F]
    4. ; /D=T - Total space (default)
    5. ; /D=O - Occupied space
    6. ; /D=F - Free space
    7. ; /S=[B|K|M|G]
    8. ; /S=B - size in Bytes (default)
    9. ; /S=K - size in Kilobytes
    10. ; /S=M - size in Megabytes
    11. ; /S=G - size in Gigabytes
    12. ;
    13. $var ; Result: Size

    Note:- Error flag if disk isn't exist or not ready - Error flag if syntax error

    Example:

    1. Section
    2. ${DriveSpace} "C:\" "/D=F /S=M" $R0
    3. ; $R0="2530" megabytes free on drive C:
    4. SectionEnd

    E.1.5 GetDrives

    • Find all available drives in the system.

    Syntax:

    1. ${GetDrives} "[Option]" "Function"
    1. "[Option]" ; [FDD+HDD+CDROM+NET+RAM]
    2. ; FDD Floppy Disk Drives
    3. ; HDD Hard Disk Drives
    4. ; CDROM CD-ROM Drives
    5. ; NET Network Drives
    6. ; RAM RAM Disk Drives
    7. ;
    8. ; [ALL]
    9. ; Find all drives by letter (default)
    10. ;
    11. "Function" ; Callback function when found
    12.  
    13. Function "Function"
    14. ; $9 "drive letter" (a:\ c:\ ...)
    15. ; $8 "drive type" (FDD HDD ...)
    16.  
    17. ; $R0-$R9 are not used (save data in them).
    18. ; ...
    19.  
    20. Push $var ; If $var="StopGetDrives" Then exit from function
    21. FunctionEnd

    Example1:

    Example2:

    1. Section
    2. ${GetDrives} "ALL" "Example2"
    3. SectionEnd
    4.  
    5. Function Example2
    6. MessageBox MB_OK "$9 ($8 Drive)"
    7.  
    8. Push $0
    9. FunctionEnd

    Example3 (Get type of drive):

    1. Section
    2. StrCpy $R0 "D:\" ;Drive letter
    3. StrCpy $R1 "invalid"
    4.  
    5. ${GetDrives} "ALL" "Example3"
    6.  
    7. MessageBox MB_OK "Type of drive $R0 is $R1"
    8. SectionEnd
    9.  
    10. Function Example3
    11. StrCmp $9 $R0 0 +3
    12. StrCpy $R1 $8
    13. StrCpy $0 StopGetDrives
    14.  
    15. Push $0
    16. FunctionEnd

    E.1.6 GetTime

    • Get local or system time.
    • Get file time (access, creation and modification).

    Syntax:

    1. ${GetTime} "[File]" "[Option]" $var1 $var2 $var3 $var4 $var5 $var6 $var7
    1. "[File]" ; Ignored if "L" or "LS"
    2. ;
    3. "[Option]" ; [Options]
    4. ; L Local time
    5. ; A last Access file time
    6. ; C Creation file time
    7. ; M Modification file time
    8. ; LS System time (UTC)
    9. ; AS last Access file time (UTC)
    10. ; CS Creation file time (UTC)
    11. ; MS Modification file time (UTC)
    12. ;
    13. $var1 ; Result1: day
    14. $var2 ; Result2: month
    15. $var3 ; Result3: year
    16. $var4 ; Result4: day of week name
    17. $var5 ; Result5: hour
    18. $var6 ; Result6: minute
    19. $var7 ; Result7: seconds

    Note:- Error flag if file isn't exist - Error flag if syntax error - See also:

    Examples:

    1. Section 'Get local time'
    2. ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
    3. ; $0="01" day
    4. ; $1="04" month
    5. ; $2="2005" year
    6. ; $3="Friday" day of week name
    7. ; $4="16" hour
    8. ; $5="05" minute
    9. ; $6="50" seconds
    10.  
    11. SectionEnd
    1. Section 'Get file time'
    2. ${GetTime} "$WINDIR\Explorer.exe" "C" $0 $1 $2 $3 $4 $5 $6
    3. ; $0="12" day
    4. ; $1="10" month
    5. ; $2="2004" year
    6. ; $3="Tuesday" day of week name
    7. ; $4="2" hour
    8. ; $5="32" minute
    9. ; $6="03" seconds
    10.  
    11. IfErrors 0 +2
    12. MessageBox MB_OK "Error" IDOK +2
    13. MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
    14. SectionEnd
    1. Section 'Get system time'
    2. ${GetTime} "" "LS" $0 $1 $2 $3 $4 $5 $6
    3. ; $0="01" day
    4. ; $1="04" month
    5. ; $2="2005" year
    6. ; $3="Friday" day of week name
    7. ; $4="11" hour
    8. ; $5="05" minute
    9. ; $6="50" seconds
    10.  
    11. MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
    12. SectionEnd
    1. Section 'Convert time to 12-hour format AM/PM'
    2. ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
    3.  
    4. StrCmp $4 0 0 +3
    5. StrCpy $4 12
    6. goto +3
    7. StrCmp $4 12 +5
    8. IntCmp $4 12 0 0 +3
    9. StrCpy $7 AM
    10. goto +3
    11. IntOp $4 $4 - 12
    12. StrCpy $7 PM
    13.  
    14. MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6 $7'
    15. SectionEnd

    E.1.7 GetFileAttributes

    • Get attributes of file or directory.

    Syntax:

    1. ${GetFileAttributes} "[File]" "[Attributes]" $var
    1. "[File]" ; File or directory
    2. ;
    3. "[Attributes]" ; "ALL" (default)
    4. ; -all attributes of file combined with "|" to output
    5. ;
    6. ; "READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE|
    7. ; DEVICE|NORMAL|TEMPORARY|SPARSE_FILE|REPARSE_POINT|
    8. ; COMPRESSED|OFFLINE|NOT_CONTENT_INDEXED|ENCRYPTED"
    9. ; -file must have specified attributes
    10. ;
    11. $var ; Result:
    12. ; $var=attr1|attr2|... (if used "ALL")
    13. ; $var=1 file has specified attributes
    14. ; $var=0 file has no specified attributes

    Note:- Error flag is set if file doesn't exist

    Example:

    1. Section
    2. ${GetFileAttributes} "C:\MSDOS.SYS" "ALL" $R0
    3. ; $R0=READONLY|HIDDEN|SYSTEM|ARCHIVE
    4.  
    5. ${GetFileAttributes} "C:\MSDOS.SYS" "SYSTEM|HIDDEN" $R0
    6. ; $R0=1
    7.  
    8. ${GetFileAttributes} "C:\MSDOS.SYS" "NORMAL" $R0
    9. ; $R0=0
    10. SectionEnd

    • Get version information from executable file.

    Syntax:

    1. ${GetFileVersion} "[Executable]" $var
    1. "[Executable]" ; Executable file (*.exe *.dll ...)
    2. $var ; Result: Version number

    Note:- Error flag if file doesn't exist - Error flag if file doesn't contain version information

    Example:

    1. ${GetFileVersion} "C:\ftp\program.exe" $R0 ; $R0="1.1.0.12"

    E.1.9 GetExeName

    • Get installer filename (with valid case for Windows 98/Me).

    Syntax:

    1. ${GetExeName} $var

    Example:

    1. ${GetExeName} $R0 ; $R0="C:\ftp\program.exe"

    E.1.10 GetExePath

    • Get installer pathname ($EXEDIR with valid case for Windows 98/Me).

    Syntax:

    1. ${GetExePath} $var

    Example:

    1. ${GetExePath} $R0 ; $R0="C:\ftp"

    E.1.11 GetParameters

    • Get command line parameters.

    Syntax:

    1. ${GetParameters} $var

    Example:

    1. ${GetParameters} $R0 ; $R0="[parameters]"

    E.1.12 GetOptions

    • Get options from command line parameters.

    Syntax:

    1. ${GetOptions} "[Parameters]" "[Option]" $var
    1. "[Parameters]" ; command line parameters
    2. ;
    3. "[Option]" ; option name
    4. ;
    5. $var ; Result: option string

    Note:- The error flag is set if the option is not found - The first character in the option string is treated as a parameter delimiter

    Example1:

    Example2:

    1. Section
    2. ${GetOptions} "-INSTDIR=C:\Program Files\Common Files -SILENT=yes" "-INSTDIR=" $R0
    3. ;$R0=C:\Program Files\Common Files
    4. SectionEnd

    Example3:

    1. Section
    2. ${GetOptions} '/SILENT=yes /INSTDIR="C:/Program Files/Common Files" /ADMIN=password' "/INSTDIR=" $R0
    3. ;$R0=C:/Program Files/Common Files
    4. SectionEnd
    1. Section
    2. ${GetOptions} `-SILENT=yes -INSTDIR='"C:/Program Files/Common Files"' -ADMIN=password` "-INSTDIR=" $R0
    3. ;$R0="C:/Program Files/Common Files"
    4. SectionEnd

    E.1.13 GetOptionsS

    • Same as , but case sensitive.

    E.1.14 GetRoot

    • Get root directory.

    Syntax:

    1. ${GetRoot} "[FullPath]" $var

    Examples:

    1. ${GetRoot} "C:\Program Files\NSIS" $R0 ; $R0="C:"
    2. ${GetRoot} "\\SuperPimp\NSIS\Source\exehead\Ui.c" $R0 ; $R0="\\SuperPimp\NSIS"

    • Get parent directory.

    Syntax:

    1. ${GetParent} "[PathString]" $var

    Example:

    1. ${GetParent} "C:\Program Files\Winamp\uninstwa.exe" $R0 ; $R0="C:\Program Files\Winamp"

    E.1.16 GetFileName

    • Get last part from directory path.

    Syntax:

    1. ${GetFileName} "[PathString]" $var

    Example:

    1. ${GetFileName} "C:\Program Files\Winamp\uninstwa.exe" $R0 ; $R0="uninstwa.exe"

    E.1.17 GetBaseName

    • Get file name without extension.

    Syntax:

    1. ${GetBaseName} "[FileString]" $var

    Example:

    1. ${GetBaseName} "C:\ftp\program.exe" $R0 ; $R0="program"

    E.1.18 GetFileExt

    • Get extension of file.

    Syntax:

    1. ${GetFileExt} "[FileString]" $var

    Example:

    1. ${GetFileExt} "C:\ftp\program.exe" $R0 ; $R0="exe"

    E.1.19 BannerTrimPath

    • Trim string path for banner.

    Syntax:

    1. ${BannerTrimPath} "[PathString]" "[Option]" $var
    1. "[PathString]" ;
    2. ;
    3. "[Option]" ; [Length][A|B|C|D]
    4. ;
    5. ; Length -Maximum string length
    6. ; A -Trim center path (default)
    7. ; (C:\root\...\third path)
    8. ; If A mode not possible Then will be used B mode
    9. ; B -Trim right path
    10. ; (C:\root\second path\...)
    11. ; If B mode not possible Then will be used C mode
    12. ; C -Trim right string
    13. ; (C:\root\second path\third p...)
    14. ; D -Trim right string + filename
    15. ; (C:\root\second p...\third path)
    16. ; If D mode not possible Then will be used C mode
    17. ;
    18. $var ; Result: Trimmed path

    Example:

    1. Section
    2. ${BannerTrimPath} "C:\Server\Documents\Terminal\license.htm" "35A" $R0
    3. ;$R0=C:\Server\...\Terminal\license.htm
    4. SectionEnd

    Example (Banner plugin):

    1. !include "WinMessages.nsh"
    2. !include "FileFunc.nsh"
    3.  
    4. Section
    5. Banner::show "Starting..."
    6. Banner::getWindow
    7. Pop $R1
    8. ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
    9. Banner::destroy
    10. SectionEnd
    11.  
    12. Function LocateCallback
    13. StrCmp $R0 $R8 code
    14. StrCpy $R0 $R8
    15. ${BannerTrimPath} "$R8" "38B" $R8
    16. GetDlgItem $1 $R1 1030
    17. SendMessage $1 ${WM_SETTEXT} 0 "STR:$R8"
    18.  
    19. code:
    20. StrCmp $R9 '' end
    21. ;...
    22.  
    23. end:
    24. Push $0
    25. FunctionEnd

    Example ():

    1. !include "FileFunc.nsh"
    2.  
    3. Section
    4. nxs::Show /NOUNLOAD `$(^Name) Setup`\
    5. /top `Setup searching something$\nPlease wait$\nIf you can...`\
    6. /h 1 /can 1 /end
    7. ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
    8. nxs::Destroy
    9. SectionEnd
    10.  
    11. Function LocateCallback
    12. StrCmp $R0 $R8 abortcheck
    13. StrCpy $R0 $R8
    14. ${BannerTrimPath} "$R8" "55A" $R8
    15. nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end
    16.  
    17. abortcheck:
    18. nxs::HasUserAborted /NOUNLOAD
    19. Pop $0
    20. StrCmp $0 1 0 +2
    21. StrCpy $0 StopLocate
    22.  
    23. StrCmp $R9 '' end
    24. ;...
    25.  
    26. end:
    27. Push $0
    28. FunctionEnd

    E.1.20 DirState

    • Check directory full, empty or not exist.

    Syntax:

    1. ${DirState} "[path]" $var
    1. "[path]" ; Directory
    2. $var ; Result:
    3. ; $var=0 (empty)
    4. ; $var=1 (full)
    5. ; $var=-1 (directory not found)

    Example:

    1. ${DirState} "$TEMP" $R0 ; $R0="1" (directory is full)

    E.1.21 RefreshShellIcons

    Syntax:

    1. ${RefreshShellIcons}

    Example: