Archive: manualy search for a file?


manualy search for a file?
I have made an Installer that installs 2 files. I also need the installer to Let me search for a desktop shortcut (will not always have the same name), and change the target of that shortcut to one of the 2 files I installed.


You could use the locate plugin ...
CF


Updated code from this thread

Name "Output"
OutFile "Output.exe"

!include "Locate.nsh"

!include "FileFunc.nsh"
!insertmacro GetFileName

Section
StrCpy $R0 "MyProgram.exe" #File name of the application

${locate::Open} "$DESKTOP|$QUICKLAUNCH|$SMPROGRAMS" "/F=1 /D=0 /M=*.lnk /B=1" $0
StrCmp $0 0 0 nextlocate
MessageBox MB_OK "Error" IDOK endlocate

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

StrCmp $6 '' endlocate
ShellLink::GetShortCutTarget $1
Pop $7
${GetFileName} "$7" $7

StrCmp $7 $R0 0 nextlocate
Delete $1
goto nextlocate

endlocate:
${locate::Close} "$0"
${locate::Unload}
SectionEnd