Skip to content
⌘ NSIS Forum Archive

command File /r not work with Variable

11 posts

r2du-soft#

command File /r not work with Variable

hi
what file /r nor work with variable but file /r "c:...." worked good!
if have a way for using file /r with variable?


;--------------------------------
Function verscan32
SetRegView 32
ReadRegStr $R1 HKCU 'Software\DownloadManager' 'ExePath'              ;Installed Patch
ReadRegStr $R2 HKCU 'Software\DownloadManager' 'AppDataIDMFolder'     ;Backup Patch
FunctionEnd
;--------------------
Function verscan64
SetRegView 64
ReadRegStr $R1 HKCU 'Software\DownloadManager' 'ExePath'              ;Installed Patch
ReadRegStr $R2 HKCU 'Software\DownloadManager' 'AppDataIDMFolder'     ;Backup Patch
FunctionEnd
;--------------------------------


Section

${If} ${RunningX64}
call verscan64
${ELSE}
call verscan32
${EndIf}

IfFileExists "$R1" foundIDM notfoundIDM
notfoundIDM:
MessageBox MB_OK "Internet Downlaod Manager not Found On You're Pc!"
goto end

foundIDM:  
  SetShellVarContext all

SetOutPath "$INSTDIR"


***********************************
***********************************
File /r "C:\Users\rozsoft\AppData\Roaming\IDM\" ;****************This is Worked
File /r $R2 ;****************Not Worked
***********************************
***********************************





end:
SectionEnd


Anders#
How would this work exactly? ReadRegStr happens on the end-users machine and you expect the installer to do what exactly?

This has been asked so many times before, next time please search before starting a new thread. Use CopyFiles to copy files on the end-users machine.

Edit: If you need to read from the registry on the computer you are compiling on then you need to use a external tool and !system...
r2du-soft#
Originally Posted by Anders View Post
How would this work exactly? ReadRegStr happens on the end-users machine and you expect the installer to do what exactly?

This has been asked so many times before, next time please search before starting a new thread. Use CopyFiles to copy files on the end-users machine.

Edit: If you need to read from the registry on the computer you are compiling on then you need to use a external tool and !system...
Thanks Mr Anders for unlock thread
my question something like to this code The was published in Topic:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


but The difference is this: in this example (http://forums.winamp.com/showpost.ph...8&postcount=35) in line "file 1gigfile", 1gigfile is beside .nsi file and no need to specify the path,but in my program must path must read from registry...

So then I have use from command file /r '$R2' but variable in command File /r not worked!

i have read all files from variable $R2 and save that files to exe file.
In principle my program is a Backuper from The IDM download queues for make backup form queues and restore backups after replace windows.....


Mr Anders
i after ReadRegStr call that function in first Section with command:

${If} ${RunningX64}
call verscan64
${ELSE}
call verscan32
${EndIf}
if this command does not answer(not Worked)?!!!!
but i use from $R1 in commands and worked!:
IfFileExists "$R1" foundIDM notfoundIDM
please give me a example of : (external tool and !system...)
thanks
Anders#
Originally Posted by r2du-soft View Post
please give me a example of : (external tool and !system...)

Section
!tempfile TMP_REG
!system '"reg" query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "{374DE290-123F-4565-9164-39C4925E467B}" > "${TMP_REG}"' = 0
!searchparse /file "${TMP_REG}" "REG_SZ " SHELLFOLDERDOWNLOADS ; The reg.exe output is not the same on all versions of Windows, might need to tweak this!
!delfile "${TMP_REG}"
File /r "${SHELLFOLDERDOWNLOADS}\*.txt"
SectionEnd
(You should not really get the users downloads folder this way but I just needed a example registry location)
r2du-soft#
Originally Posted by Anders View Post
(You should not really get the users downloads folder this way but I just needed a example registry location)

Thanks Mr Andres
i tested code. but this code work Exactly similar to code:
File /r $R2 ;****************Not Worked
when i write ${SHELLFOLDERDOWNLOADS} to text file with code:

FileOpen $4 "$TEMP\IDM.Address.Backup.txt" w
FileWrite $4 ${SHELLFOLDERDOWNLOADS}
FileClose $4
i see contents file IDM.Address.Backup.txt is C:\Users\rozsoft\AppData\Roaming\IDM\
Exactly the same way $R2 Do it!

and this way not worked!

!tempfile TMP_REG
!system '"reg" query "HKCU\Software\DownloadManager" /v "AppDataIDMFolder" > "${TMP_REG}"' = 0
!searchparse /file "${TMP_REG}" "REG_SZ " SHELLFOLDERDOWNLOADS ; The reg.exe output is not the same on all versions of Windows, might need to tweak this!
!delfile "${TMP_REG}"

SetOutPath "$INSTDIR"
File /r "${SHELLFOLDERDOWNLOADS}\*.txt"
r2du-soft#
Originally Posted by Anders View Post
Change !delfile to !echo and go and look at the file in %temp%...
Overall when compile in that code on line 134 was an error:
There was an error.
Error in script "C:\Users\rozsoft\Desktop\bseter.nsi" on line 134 -- aborting creation process
line 134.code:

File /r "${SHELLFOLDERDOWNLOADS}\*.txt"
r2du-soft#
Anybody does not know of any way to solve this problem?

There is no code to replace File /R '$R2' ?
Anders#
Originally Posted by r2du-soft View Post
Anybody does not know of any way to solve this problem?

There is no code to replace File /R '$R2' ?
No, the File instruction needs the file/directory names at compile time. You don't seem to understand that variables only work on the end-users machine. If you need to read the path on the end-users machine and then do something you have to use CopyFiles. The File instruction can only be used to include files that exist on your machine where you execute MakeNSIS.
r2du-soft#
Originally Posted by Anders View Post
No, the File instruction needs the file/directory names at compile time. You don't seem to understand that variables only work on the end-users machine. If you need to read the path on the end-users machine and then do something you have to use CopyFiles. The File instruction can only be used to include files that exist on your machine where you execute MakeNSIS.
thanks Mr Anders
I'm understand that variables only work on the end-users machine. 🙂
i use this program with visual basic but because the nsis
I want write much programs with nsis, i want use this program with nsis 🙂 Because seems to me programs size that write with Nsis languages very Less than other programs size that write with other languages and nsis is very faster!
i understand, for example i can copy files with CopyFiles from '$R2' to 'temp\IDM' backups and when use from command File /R i user from File /R "$%Temp%\IDM" but here is a problem!!!!
in this way i must copy backups to temp,if Backups size is for example 7Gig and user Not enough space for copy backups to temp when what should I do? 😕


Also:

WHAT:
what File /R "$%Temp%\IDM" **********WORKED

BUT:
File /R "$Temp\IDM" **********NOT WORKED

******?


Thanks
JasonFriday13#
Originally Posted by r2du-soft View Post
Also:

WHAT:
what File /R "$%Temp%\IDM" **********WORKED

BUT:
File /R "$Temp\IDM" **********NOT WORKED

******?


Thanks
Originally Posted by Anders
No, the File instruction needs the file/directory names at compile time. You don't seem to understand that variables only work on the end-users machine.
$Temp is a variable, so it's used at run time. It can't be used with "File".