Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Create Install Choice: as Service or Application


17 replies to this topic

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 18 March 2004 - 23:22

Dear Friends,
I am using Installshield Prof. 6.3. Does anyone know how to create an install where the user will have a pop-up window giving options of Choosing Installation Type:
1. Install as a Service
or
2. Install as an Application

I attached the example.

Thank you very much,
Dipo

Attached Files



Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 19 March 2004 - 00:20

You could add such a dialog to your OnFirstUIBefore event by calling AskOptions with an nValue parameter of 'EXCLUSIVE' to get radio buttons instead of check boxes. See the help for more information on this function.

This is of course assuming that you already have an installable program with both standard application support and Windows service support.
user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 23 March 2004 - 21:23

Thanks.
Do you know how to include IF statement in AskOptions?
For example,
If option 1 is selected, then do the following,
If option 1 is selected, then do the following, then end.

Thanks,
Dipo

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 23 March 2004 - 23:32

The IF statments would just be regular code that would come after calling the AskOptions dialog, and entail checks on bvCheck1 for the 1st option, bvCheck2 for the 2nd option, etc.

Quick Example
CODE
AskOptions:
// Initialize parameters (e.g. szMsg, szText1, etc.)
nResult = AskOptions(EXCLUSIVE, szMsg, szText1, bvCheck1, szText2, bvCheck2);

if (nResult = BACK) goto <LabelNameforPreviousDialog>;

if (bvCheck1) then
 // Do option 1 command
elseif (bvCheck2) then
// Do option 2 command
endif;

NOTE: This code was NOT compiled, so it may not be syntactically correct.

Edited by Taco Bell, 23 March 2004 - 23:39.

user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 25 March 2004 - 18:54

I still have a problem if the IF statement. This is the situation:
I declare a global number nvalue,

If install as service, then nvalue = 1
If install as application, then nvalue = 2

Running down the script, at function OnRebooted()
if nvalue = 1
then
szMsg = "service is about to install";
MessageBox (szMsg, INFORMATION);
LaunchApp ("C:" ^ "Program Files" ^ "Data" ^ "Data.exe", "/SERVICE START");

Problem:
when it reboots, it doesn't run the message box and service.
Without the if statement, the service is installed fine.

Thanks very much,
Dipo

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 25 March 2004 - 22:26

So sounds like the problem is with nValue being populated.

Based on the results of bvCheck#, you need to assign it a 1 or a 2.
user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 26 March 2004 - 15:11

Hello again..smile.gif


I have tried several different ways, including assigning the values, but still have the same problem, which is the nvalue=1 (in the IF statement) that is on function OnFirstUIBefore() is not passed to function OnRebooted().

Do you have any idea as to how to pass the nvalue to OnRebooted?

Thanks,
Dipo


Ozone

Ozone
  • Full Members
  • 77 posts

Posted 26 March 2004 - 15:53

The value assigened to 'nvalue' exists in memory and is destroyed when rebooting. Try writing the 'nvalue' to a file that can be read when rebooting.

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 26 March 2004 - 16:59

all right.
Do you have a sample script how to do that? (writing the 'nvalue' to a file that can be read when rebooting.)
Thanks,
Dipo

Perotin

Perotin
  • Full Members
  • 407 posts

Posted 26 March 2004 - 17:56

Is there any chance to pass the parameter to the setup after reboot?
Do you create a "run" key in the registry or a link for the autostart group?
You could easily add a paramter like " -service" to the program call and read it in OnRebooted() ...

how 'bout that?

PS: the command line can be found in CMDLINE, so try
CODE

OnRebooted()

if CMDLINE % "-service" then
  szMsg = "service is about to install";
  MessageBox (szMsg, INFORMATION);
  LaunchApp ( PROGRAMFILES ^ "Data" ^ "Data.exe", "/SERVICE START");
endif;


btw: you should use system variables like PROGRAMFILES and WINDIR. In most cases you don't on what OS and language the program will be installed ...

Edited by Perotin, 26 March 2004 - 18:02.

Gruß / regards
Thomas

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 26 March 2004 - 18:37

Oh right Ozone, good point. wink.gif

It's really easy to write to a file Dipo, and if you still need it I can give you some sample code to do that, but if all you're doing on the reboot is running that application, then during OnFirstUIAfter() I would just write the command to the HKLM\Windows\CurrentVersion\RunOnce area of the registry where it will be automatically processed by Windows on the next reboot.

However, do you really need to wait for a reboot to issue this command or could it just be launched after all of the files have been copied? 'cause if you really don't need the reboot, then just move that if nvalue = 1 code from OnRebooted() and into OnFirstUIAfter().

Also Perotin, he wouldn't actually be able to use a parameter value of -service because it would collide with InstallShield's -s command for a silent setup, but something like that that would certainly be another option. Just need to check out "Command line setup engine" in the help index to make sure it doesn't start with same letter as one used by IS.

Edited by Taco Bell, 26 March 2004 - 19:09.

user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 26 March 2004 - 21:37

Wow, I learn alot from you guys.
I don't have to wait untill it reboot. The goal is to run the program as service when selected. I will try OnFirstUIAfter() and give update.

Thanks,
Dipo

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 29 March 2004 - 22:29

I am not successful, yet.

The message box appeared, but the program won't run.

function OnFirstUIAfter()
string szMsg;
begin
if (bvCheck3 = 1) then
szMsg = "service is about to install";
MessageBox (szMsg, INFORMATION);
LaunchApp ("C:" ^ "Program Files" ^ "Data" ^ "Data.exe", "/ SERVICE START");
endif;
end;


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 30 March 2004 - 03:15

Well that extra space between the forward slash & 'SERVICE' in your "/ SERVICE START" parameter is probably partially to blame.

Also, check the resulting value from calling LaunchApp to further locate the problem, and maybe try using LaunchAppAndWait instead.

While you're at it, just launch the actual program via Start | Run as a sanity check and to make sure that it's truly okay without the reboot.
user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 30 March 2004 - 19:45

The original script doesn't have the space, though...somehow when I copy and paste it added the space.
I tried both with and without space, also with LaunchAppAndWait, it doesn't work.

What I found out, after the installation and ask the computer to reboot, I said No. I cannot start the program. So, the start --> Run command also doesn't work to run the service. However, if I reboot the computer, the program runs well, and I can type /service from the Start --> Run and it works fine.

It's still a mystery for me..sad.gif

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 30 March 2004 - 22:49

That prooves your application needs a reboot to work after all, so just see about making use of the previous suggestions for the OnRebooted event or the RunOnce area of the registry.
user posted image

dipowargaw

dipowargaw
  • Members
  • 20 posts

Posted 31 March 2004 - 16:13

The resolution I did is to put the AskOptions(EXCLUSIVE, szMsg, szText1, bvCheck1, szText2, bvCheck2) on the function OnRebooted()
It works very well..smile.gif
My boss is happy, too. The other programmer is trying to make the appliation can run without rebooting the computer.

Thanks a lot for your help. I really appreciate it.
-Dipo

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 31 March 2004 - 21:07

Ah, that works equally well, so glad to hear it Dipo and you're very welcome.
user posted image