if statement that works in debug but not in run

Got a problem you cannot solve? Try here.
Ryan Lee
Posts: 26
Joined: Fri Jun 29, 2007 7:11 pm

if statement that works in debug but not in run

Postby Ryan Lee » Fri Jul 20, 2007 5:50 pm

I have the following statements:

Code: Select all

Set Variable ISSERVICERUNNING to
Check Service State for MyService (write result into variable ISSERVICERUNNING)
MessageBox: $TITLE$, service: $ISSERVICERUNNING$
if Variable $ISSERVICERUNNING$ Equals RUNNING
  MessageBox: $TITLE$, in if block
end


When I debug with MyService running, I get a message box stating that the service is RUNNING and I go into my if block (pops up another message box).

When I run with MyService running, I get a message box stating that the service is RUNNING but I do not go into my second if block (no message box stating i'm in the if block).

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Fri Jul 20, 2007 6:16 pm

The IDE already warns you about this (unless you turned tips off), but don't use $ signs in fields where variables are already expected:

Code: Select all

if Variable $ISSERVICERUNNING$


is wrong;

Code: Select all

if Variable ISSERVICERUNNING


is correct.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Ryan Lee
Posts: 26
Joined: Fri Jun 29, 2007 7:11 pm

Postby Ryan Lee » Fri Jul 20, 2007 7:55 pm

My bad copying the code into this post.

Code: Select all

Set Variable ISSERVICERUNNING to
Check Service State for MyService (write result into variable ISSERVICERUNNING)
MessageBox: $TITLE$, service: $ISSERVICERUNNING$
if Variable ISSERVICERUNNING Equals RUNNING
  MessageBox: $TITLE$, in if block
end



It doesn't actually have the $ signs around the ISSERVICERUNNING in the if block.

It does not work.

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Mon Jul 23, 2007 5:37 am

I created a simple script like this:

Code: Select all

Check Service State for Themes (write result into variable TEST_SERVICE)
MessageBox: Testing Service, $TEST_SERVICE$
if Variable TEST_SERVICE Equals RUNNING
  MessageBox: Test service..., is running!
end


Which works exactly as expected.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 81 guests