Old 30th August 2005, 09:09   #1
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Locate plugin

Features:
1. Search for directories or empty directories and/or files
    -search with wildcard
    -search with extensions filter (include/exclude)
    -search with times filter
    -search with size filter
    -search with attributes filter
    -sort files and/or directories by name, type, size, date (with reverse or not)
    -output first files or directories
    -search with subdirectories or not
    -search with banner support
    -return path\name
    -return path
    -return name
    -return size of file
    -return date of file or directory
    -return attributes of file or directory
2. Find the size of a file, files wildcard or directory (locate::GetSize)
3. Find the sum of the files, directories and subdirectories (locate::GetSize)
4. Remove empty directories and/or subdirectories (locate::RMDirEmpty)

This plugin is the replacement for Locate and GetSize functions.


"Locate" plugin v1.0
Attached Files
File Type: zip locate.zip (25.4 KB, 1511 views)
Instructor is offline   Reply With Quote
Old 17th September 2005, 14:48   #2
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changes:
-Option /X and /-X - Separated by "|" instead of "," (locate::Open)
-New: option /P - Additional paths to "[Path]" (locate::Open)
-New: option /-PF - Don't locate in these paths (locate::Open)
-New: option /-PN - Don't locate in these directories (locate::Open)


"Locate" plugin v1.1
Attached Files
File Type: zip locate.zip (25.8 KB, 1241 views)

Last edited by Instructor; 17th September 2005 at 15:09.
Instructor is offline   Reply With Quote
Old 17th September 2005, 19:23   #3
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changes:
-New: options /N and /-N - names filter (locate::Open)
-Readme improvement


"Locate" plugin v1.2
Attached Files
File Type: zip locate.zip (26.3 KB, 1268 views)
Instructor is offline   Reply With Quote
Old 20th November 2005, 14:57   #4
mgillespie
Member
 
mgillespie's Avatar
 
Join Date: Jul 2003
Posts: 83
Does anyone have any example ModernUI code that uses this locate plugin?

I want to locate several files, and present the user with a way of selecing one of them.

How would I go about doing this?
mgillespie is offline   Reply With Quote
Old 21st November 2005, 14:34   #5
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Here you go. Script also using Takhir's nxs plugin
Attached Files
File Type: zip example.zip (1.6 KB, 1725 views)
Instructor is offline   Reply With Quote
Old 21st November 2005, 19:00   #6
mgillespie
Member
 
mgillespie's Avatar
 
Join Date: Jul 2003
Posts: 83
Perfect. Thanks.
mgillespie is offline   Reply With Quote
Old 28th November 2005, 14:08   #7
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: Case sensitive sort of files and directories (if used sort by "NAME" or "TYPE"). Now case insensitive.
Fixed: Accepted only uppercased sort type "NAME|TYPE|SIZE|DATE". Now case insensitive.


"Locate" plugin v1.3
Attached Files
File Type: zip locate.zip (26.3 KB, 1292 views)
Instructor is offline   Reply With Quote
Old 14th December 2005, 08:32   #8
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: CRT function "tolower" in StrFunc.h didn't return correct national character. "tolower", ("islower", "setlocale" ...) replaced with "CharLower" (user32.dll).


"Locate" plugin v1.4
Attached Files
File Type: zip locate.zip (26.4 KB, 1166 views)

Last edited by Instructor; 14th December 2005 at 08:47.
Instructor is offline   Reply With Quote
Old 24th December 2005, 22:21   #9
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changed: Now plugin is msvcrt.dll independed -> work on Win95 (thanks kichik)
Updated: "ConvFunc.h" to v1.3


"Locate" plugin v1.5
Attached Files
File Type: zip locate.zip (32.8 KB, 1116 views)
Instructor is offline   Reply With Quote
Old 9th February 2006, 11:06   #10
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Changed: Removed option "/P=", now plugin can accept multi-path in first parameter
Updated: "ConvFunc.h" to v1.5
Updated: "StrFunc.h" to v1.6
Changed: Now plugin used header "Locate.nsh" for custom user variables and
              better compile errors check.

Update from previous versions:
         - Insert line in script:
            !include "Locate.nsh"
         - Replace:
            locate::Open -> ${locate::Open} ...
         - Replace:
            .r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ...

"Locate" plugin v1.6
Attached Files
File Type: zip locate.zip (37.1 KB, 1190 views)
Instructor is offline   Reply With Quote
Old 27th May 2006, 11:38   #11
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: ignore files/directories names which began with "."
Fixed: error, if file had more then 16 characters extension
Fixed: "/SF=DATE" <=> "/-SF=DATE"
Updated: "StrFunc.h" to v1.7
Updated: "StackFunc.h" to v1.9
Updated: "ConvFunc.h" to v1.7
Changed: Now if files has same date or size they sorted by name
Added: handles for search

"Locate" plugin v1.7
Attached Files
File Type: zip locate.zip (46.3 KB, 1046 views)
Instructor is offline   Reply With Quote
Old 28th May 2006, 09:58   #12
rxs2k5
Member
 
Join Date: Apr 2006
Posts: 66
Hi instructor,

How do I use this syntax

${locate::Find} "[handle]" $var1 $var2 $var3 $var4 $var5 $var6

1. I need to find the directory or file exist in C:\Program Files\
2. I need it to change the InstallDIR or setoutpath to the found dir or file in it.

could u create a function for me to perform the task.
rxs2k5 is offline   Reply With Quote
Old 1st June 2007, 14:25   #13
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Fixed: locate::Open failed to open paths ended with backslash
Updated: "StrFunc.h" to v1.9
Updated: "StackFunc.h" to v2.0
Updated: "ConvFunc.h" to v2.0


"Locate" plugin v1.8
Attached Files
File Type: zip locate.zip (45.2 KB, 762 views)
Instructor is offline   Reply With Quote
Old 2nd March 2010, 00:39   #14
zeeh3
Senior Member
 
Join Date: Aug 2005
Posts: 121
Hi, many of our users are having problems when NSIS uses locate plugin inside windows 7, mainly because msvcr71.dll is natively missing. Can this be fixed (removing this dependency)? Thanks.
zeeh3 is offline   Reply With Quote
Old 2nd March 2010, 12:41   #15
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
zeeh3
You are using self-rebuilded dll? You can check with "Dependency Walker" that plugin linked only to kernel32.dll and user32.dll.
Instructor is offline   Reply With Quote
Old 2nd March 2010, 16:25   #16
zeeh3
Senior Member
 
Join Date: Aug 2005
Posts: 121
Sorry, there was a mistake... my bad
zeeh3 is offline   Reply With Quote
Old 27th May 2010, 12:34   #17
ivansobaka
Junior Member
 
Join Date: May 2010
Posts: 3
Hi dear Instructor.
I have a problem during using 'locate' with Windows7 32bit

My code is following:
${locate::Open} "$0" "/F=0 /G=0" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "error" IDOK close

loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 "" close 0

IfFileExists "$1\setup.exe" 0 loop
IfFileExists "$1\config.ini" 0 loop
; do smth
goto loop

close:
${locate::Close} $0 ; at this point application going to hang up
${locate::Unload}
ivansobaka is offline   Reply With Quote
Old 11th June 2010, 16:24   #18
dean.g
Junior Member
 
Join Date: Jun 2010
Posts: 5
endless loop

Hi Instructor,

I am attempting to cycle through all subdirectories in My Documents. I have hidden directories, the first one Locate comes across is "$AVG" (hidden, readonly). This subdirectory has one subdirectory ($AVG/$CHJW) which contains four files (acgch??.dat).

Following is my open command:
${locate::Open} "$DOCUMENTS" "/F=1 /D=0 /M=*-temp-*.ppp|*Recovered*.ppp /A=-HIDDEN /B=1" $0

The find command seems to find an "endless" number of empty paths\files in the $AVG/$CHJW directory. Adding /-PN=$$AVG stops this behavour but I need this script to run on anyones computer.

Any assistance appreciated!
dean.g is offline   Reply With Quote
Old 14th June 2010, 11:20   #19
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
ivansobaka
Make sure you don't change $0 variable in "; do smth"

dean.g
I'm out of the active NSIS developing, but you can pack this folder and send me on email I will try to reproduce the bug.
Instructor is offline   Reply With Quote
Old 14th June 2010, 13:03   #20
ivansobaka
Junior Member
 
Join Date: May 2010
Posts: 3
I dont use $0 variable in "; do smth"
But I've changed following string

${locate::Close} $0

to

${locate::Close} $R1

Now it works right,
thank you very much
ivansobaka is offline   Reply With Quote
Old 14th June 2010, 14:39   #21
dean.g
Junior Member
 
Join Date: Jun 2010
Posts: 5
loop

Hi Instructor,

If you need more information please let me know.

Cheers!
Dean
Attached Files
File Type: zip Test01.zip (165.5 KB, 220 views)
dean.g is offline   Reply With Quote
Old 14th June 2010, 14:45   #22
dean.g
Junior Member
 
Join Date: Jun 2010
Posts: 5
loop

Hi Instructor,

Please find attached.
Attached Files
File Type: zip Test01.zip (165.5 KB, 222 views)
File Type: nsi Test01.nsi (853 Bytes, 302 views)
dean.g is offline   Reply With Quote
Old 14th June 2010, 20:29   #23
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
I'm unable to open .odt files. Lets go the other way. Try to locate in "$CHJW"
code:
${locate::Open} "$DOCUMENTS\....\$$CHJW"
If it hang, try to remove by one file. If it not hang try to locate in "$AVG"
code:
${locate::Open} "$DOCUMENTS\....\$$AVG"
It simply can be file system error, like bad clusters on HDD etc.
Instructor is offline   Reply With Quote
Old 14th June 2010, 21:15   #24
dean.g
Junior Member
 
Join Date: Jun 2010
Posts: 5
loop

Hi Instructor,

Here is contents of .odt file (open office text file). I was just showing you the directory structor.

Cheers!
Attached Thumbnails
Click image for larger version

Name:	DirStruct.jpg
Views:	343
Size:	190.1 KB
ID:	47115  
dean.g is offline   Reply With Quote
Old 11th October 2011, 13:38   #25
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
Added: full unicode support on NSIS Unicode.

Locate plugin v2.0
Instructor is offline   Reply With Quote
Old 26th October 2011, 23:11   #26
mlf176f2
Junior Member
 
Join Date: Oct 2011
Posts: 1
Doesn't Locate All Files

For some reason this plugin cannot locate files such as

c:\.Rhistory

Is there some work-around?
mlf176f2 is offline   Reply With Quote
Old 31st October 2011, 14:00   #27
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
mlf176f2
Is not reproduced.

code:
FILE:"c:\IO.SYS" [110080 b] [Created: 08.06.2000 17:00:00] [-a--]
FILE:"c:\.Rhistory" [0 b] [Created: 31.10.2011 19:57:00] [-a--]
FILE:"c:\ntldr" [251152 b] [Created: 13.04.2008 18:02:06] [rahs]

Instructor is offline   Reply With Quote
Old 3rd May 2012, 20:15   #28
tinflute
Junior Member
 
Join Date: May 2012
Posts: 2
Question Locate crashes

My installer crashes when I run locate. It always crashes when it hits a particular folder (c:\Program Files (x86)\Oracle\). Runniny on windows 7.

code:
${locate::Open} "C:\" `/F=1 /D=0 /X=exe /-PN="Oracle" /-PF="$WINDIR\System|$WINDIR\System32|$WINDIR\Help" /N=pg_dump.exe /B=1` $0
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCpy $backup $0

tinflute is offline   Reply With Quote
Old 3rd May 2012, 21:34   #29
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If it is reproducible how about running it through a debugger. If you are up for installing Visual Studio 2010 Express and the Windows 7 SDK then I will explain how.

Stu
Afrow UK is offline   Reply With Quote
Old 4th May 2012, 14:59   #30
tinflute
Junior Member
 
Join Date: May 2012
Posts: 2
ok thanks. i'll get back to you if i get that installed.
i'm looking at an another approach looking up exe path through the registry.
tinflute is offline   Reply With Quote
Old 15th November 2013, 12:16   #31
karlos34
Junior Member
 
Join Date: Nov 2013
Posts: 1
Hi,
I have some troubles with ${locate::Open}. I use parametr /-PF=${UpgradeExcludeDirectories} to excluding but my string of excluded files is too long and has been truncated.
I found two possible reasons:
1, I found magic constant in source code NSIS_MAX_STRLEN. Can you create bigger buffer please?
2, add parameter which will be able to define excluded files as relative path
Have you any idea or is exist any way how can i use relative paths for excluded files?

Many thanks guys
karlos34 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast 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