TwitchBitch
30th June 2007 05:03 UTC
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
ajfisher
30th June 2007 05:17 UTC
Your life will be a lot easier if you use LogicLib
far easier than using strcpy and jumps
ajfisher
30th June 2007 05:18 UTC
in case the link didn't come through...
http://nsis.sourceforge.net/LogicLib
TwitchBitch
30th June 2007 05:24 UTC
ok idk how to do that with logiclab?
can you post alternet example of my code?
TwitchBitch
30th June 2007 05:56 UTC
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
30th June 2007 06:57 UTC
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
1st July 2007 18:00 UTC
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