Jump to content

Installshield And %programfiles%


Recommended Posts

I'm currently working with the InstallShield installer of various Adobe programs and I a facing a problem with the %programfiles% variable which I cannot use in the setup.iss answer file:

szDir=D:\Program Files\Adobe\Photoshop CS

I decided that the best way to get around this issue is to have 2 answer file. One for the case of %ProgramFiles% being located on the D:\ drive and another one for the C:\ drive...

This is my current working RunOnceEx.cmd:

FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.bin SET CDROM=%%i:

SET ANSWERFILE=setupd.iss

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Stupid InstallShield Installer" /f

REG ADD %KEY%\001 /VE /D "Adobe© Photoshop© CS" /f
REG ADD %KEY%\001 /V 1 /D "\"%CDROM%\Adobe Photoshop CS\setup.exe\" -s -f1\"%CDROM%\Adobe Photoshop CS\%ANSWERFILE%\" -f2\"%systemdrive%\test.log\"" /f

BUT I would like to put a condition to check

IF %ProgramFiles%="D:\Program Files"

SET ANSWERFILE=setupd.iss

ELSE

SET ANSWERFILE=setupc.iss

well, ahem, something like that... :blushing:

Can someone help me with this condition in my RunOnceEx.cmd

Here is the original topic: http://www.msfn.org/board/index.php?showtopic=42541

Link to comment
Share on other sites


That Should Pass Back The First True Location.

EG If It On C:\ Then C Will Be Passed

If It On D:\ Then D Will Be Passed etc

FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\Program Files\Adobe\Photoshop CS" SET Loc1=%%i:

SET ANSWERFILE=%Loc1%

Link to comment
Share on other sites

i found on a old post a way to use %systemdrive% on a setup.iss answer file

it uses a batch like this:

parse.bat

@echo off
echo Starting...
echo .
echo Wait...
echo .
echo Wait
type %systemdrive%\Photoshop\setup.txt|%windir%\sed.exe 's/\%%systemdrive\%%/%systemdrive%/g'>%systemdrive%\Photoshop\setup.iss

what you have to do is put

szDir=%systemdrive%\Archivos de programa\Adobe\Photoshop CS

in your setup.ss, and then rename it to setup.txt

also, you need to put the sed.exe file in the windows directory

sed.exe

it works perfect for me with photoshop, dreamweaver, and flash :thumbup

i use it like this in my RunOnceEx.cmd :

REG ADD %KEY%\032 /VE /D "Adobe Photoshop CS" /f
REG ADD %KEY%\032 /V 1 /D "%CDROM%\software\Photoshop\Photoshop.exe" /f
REG ADD %KEY%\032 /V 2 /D "%CDROM%\software\Photoshop\parse.bat" /f
REG ADD %KEY%\032 /V 3 /D "%systemdrive%\Photoshop\setup.exe -s" /f

i made a sfx for the photoshop folder, it decompress to the HD, run the .bat, then run setup.exe -s, and at the end with my cleanup.cmd erase the photoshop folder

its better explained here, but its in french :}

Laboratoire des Technologies Microsoft - Supinfo Paris

maybe this is what your looking for?

Link to comment
Share on other sites

is there a way to check with the variable %ProgramFiles% because I know that even if it is located on the D:\ drive, on a system with a lot of software there will also be a C:\Program Files because older software aren't checking for the registry value and always point to C:\Program files.

So in those case your script would return the C:\ drive even if there is only 1 program at that location... :}

Also, it should be a condition statement like I described in my first post...

That Should Pass Back The First True Location.

EG If It On C:\ Then C Will Be Passed

     If It On D:\ Then D Will Be Passed etc

FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\Program Files" SET Loc1=%%i:

SET ANSWERFILE=%Loc1%

Link to comment
Share on other sites

I'd recommend a batch file!

REG ADD %KEY%\001 /V 1 /D "\"%CDROM%\Adobe Photoshop CS\SETUP.BAT\"" /f

But if you really want to to it the hard way, try this:

REG ADD %KEY%\001 /V 1 /D "cmd /c if \"%ProgramFiles%\"=\"D:\Program Files\" ( \"%CDROM%\Adobe Photoshop CS\setup.exe\" -s -f1\"%CDROM%\Adobe Photoshop CS\setupd.iss\" -f2\"%systemdrive%\test.log\" ) else ( \"%CDROM%\Adobe Photoshop CS\setup.exe\" -s -f1\"%CDROM%\Adobe Photoshop CS\setupc.iss\" -f2\"%systemdrive%\test.log\" )" /f

Link to comment
Share on other sites

2 things Incroyable...

1st off, Id check out this thread 1st... it allows you to still use variables with setup.iss.

2nd, if for whatever reason you still want to use your if then statement, this is what youll want... like Dahi said, toss this in a batch file and simply call your batch file from your runonceex, instead of trying to incorporate it all in there.

@echo off
IF %ProgramFiles%=="D:\Program Files" (
 SET ANSWERFILE=setupd.iss
) ELSE (
SET ANSWERFILE=setupc.iss
)
[<setup path>]\setup.exe" -s -f1 "%CDROM%\Adobe Photoshop CS\%ANSWERFILE%" -f2"%systemdrive%\test.log"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...