Skip to content
⌘ NSIS Forum Archive

iffileexists else PLEASE HELP!!!

7 posts

TwitchBitch#edited

iffileexists else PLEASE HELP!!!

ok i need to make an else function for this code that is what i have but for some reason it does not work 🙁
can some one help meh? please need it soon


Section
${GetDrives} "CDROM" "CHECK"

SectionEnd
Function CHECK


IfFileExists "$9\Startup.exe" 0 next
StrCpy $R0 "$9" ;$R0 contains the drive you're looking
StrCpy $0 "StopGetDrives"
;else
;MessageBox MB_okcancel "Please Insert exampl Disk"
next:
Push $0
;else

FunctionEnd
TwitchBitch#
ok figured it out i think but this is what i got



Function CHECK


${If} ${FileExists} "$9\EXAMPLE.exe"
StrCpy $R0 "$9" ;$R0 contains the drive you're looking
StrCpy $0 "StopGetDrives"
next:
Push $0

${Else}
MessageBox MB_OK "Please Insert EXAMPLE Disk"



FunctionEnd
and this is what i get when it's done with the creation

Processed 1 file, writing output:
Adding plug-ins initializing function... Done!
Error: could not resolve label "_LogicLib_Label_2" in function "CHECK"
Error - aborting creation process
anyideas why it's not workin?

and is there ne way for it to check again after you press ok?
Instructor#
Name "Test"
OutFile "Test.exe"

!include "FileFunc.nsh"
!insertmacro GetDrives

Section
begin:
StrCpy $R0 ''
${GetDrives} "CDROM" "GetDrivesCallback"
StrCmp $R0 '' 0 +2
MessageBox MB_OKCANCEL "Please Insert example Disk" IDOK begin IDCANCEL end
MessageBox MB_OK "Drive: $R0"

end:
SectionEnd

Function GetDrivesCallback
IfFileExists "$9Startup.exe" 0 end
StrCpy $R0 "$9"
StrCpy $0 "StopGetDrives"

end:
Push $0
FunctionEnd
Comm@nder21#
anyideas why it's not workin?
missed the EndIf:
Function CHECK
${If} ${FileExists} "$9\EXAMPLE.exe"
StrCpy $R0 "$9" ;$R0 contains the drive you're looking
StrCpy $0 "StopGetDrives"
next:
Push $0

${Else}
MessageBox MB_OK "Please Insert EXAMPLE Disk"

${EndIf}
FunctionEnd