Old 4th June 2012, 11:27   #1
Gowrisankar
Junior Member
 
Join Date: Jun 2012
Posts: 9
Smile How to get the .exe file automatically and execute

I want the NSIS installer search and automatically get the exe file in the target system and needs to execute, Whether it is possible? , If possible please post the code..........
Gowrisankar is offline   Reply With Quote
Old 4th June 2012, 19:36   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
You can use the Locate plugin to find a file on the target system. Note that there's no guarantee that 'your' filename isn't used by some other application as well, so... Use with caution. Maybe add an md5 hashcheck or something?
MSG is offline   Reply With Quote
Old 6th June 2012, 12:25   #3
Gowrisankar
Junior Member
 
Join Date: Jun 2012
Posts: 9
can you give correct code for that I want to use that , I cant understand locate plugin
Gowrisankar is offline   Reply With Quote
Old 6th June 2012, 13:29   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
To learn NSIS, start with examining NSIS\Examples\Example1.nsi and Example2.nsi. Find out what all commands do, using the command reference: http://nsis.sourceforge.net/Docs/Chapter4.html

Once you know what all the commands in those Examples do, and why, you will be well on your way to understanding NSIS. In your particular case, you can find the required code in the locate plugin zip (Example\LocateTest.nsi).
MSG is offline   Reply With Quote
Old 11th June 2012, 04:54   #5
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
Locate plug-in is here (wiki): http://nsis.sourceforge.net/Locate_plugin, forum thread here: http://forums.winamp.com/showthread....hreadid=224837

There are many examples, try to use one of them.

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 12th June 2012, 13:35   #6
Gowrisankar
Junior Member
 
Join Date: Jun 2012
Posts: 9
please any one can send locate plugin to my mail ID cgssankar@gmail.com because I can't able do download from source.....
Gowrisankar is offline   Reply With Quote
Old 12th June 2012, 13:48   #7
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
It's working fine: http://nsis.sourceforge.net/mediawik.../af/Locate.zip

If you can't download zip files at your work location, you won't be able to download it from gmail either.
MSG is offline   Reply With Quote
Old 13th June 2012, 13:22   #8
Gowrisankar
Junior Member
 
Join Date: Jun 2012
Posts: 9
I placed the required files for locate command in the application path and when I compile the following code,

Name "filefind"
OutFile Files.exe
!include "Locate.nsh"
Section
${Locate} "final/jre" "/L=F /M=jre1.exe" "Example1"
; 'RPC DCOM.rar' file in 'C:\ftp' with size 1 Kb or more

IfErrors 0 +2
MessageBox MB_OK "Error" IDOK +2
MessageBox MB_OK "$$R0=$R0"
SectionEnd

Function Example1
StrCpy $R0 $R9
; $R0="C:\ftp\files\RPC DCOM.rar"

MessageBox MB_YESNO '$R0$\n$\nFind next?' IDYES +2
StrCpy $0 StopLocate

Push $0
FunctionEnd

I got the error "Invalid command: ${locate}", Now what can I do?
Gowrisankar is offline   Reply With Quote
Old 13th June 2012, 17:45   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
There is no "Locate" define in locate.nsh. Look at the example again.
MSG is offline   Reply With Quote
Old 14th June 2012, 13:40   #10
Gowrisankar
Junior Member
 
Join Date: Jun 2012
Posts: 9
I want to find jre.exe file which is in *\final\jre directory for that I am using the following section,

Section "Search for exe files"
${locate::Open} "*\final\jre" `/L=F /D=0 /M=*.exe /B=1` $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

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

MessageBox MB_OKCANCEL '$$1 "path\name" =[$1]$\n\
$$2 "path" =[$2]$\n\
$$3 "name" =[$3]$\n\
$$4 "size" =[$4]$\n\
$$5 "time" =[$5]$\n\
$$6 "attributes =[$6]$\n\
$\n\
Find next?' IDOK loop
close:
${locate::Close} $0
${locate::Unload}
SectionEnd


but every time i got Error message only. can you give a correct syntax to get that exe file?...........
Gowrisankar is offline   Reply With Quote
Old 15th June 2012, 08:04   #11
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
Syntax of "Path" parameter is incorrect.

You cannot use "*\final\jre directory" but you need absolute path like "D:\Temp|C:\WINDOWS", ...

Read readme file, there is correct usage.

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
automatically, get exe, search, with out set path

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