undefined variable for return variable in Run Program

Got a problem you cannot solve? Try here.
Post Reply
ttcn2k4
Posts: 31
Joined: Wed Feb 01, 2012 10:04 am

undefined variable for return variable in Run Program

Post by ttcn2k4 »

Hi:

I assigned a Run Program to get the result into a variable, then make a compare after that. However, it issues an undefined variable error during compiling.

Run Program sc.exe create "CFS" start= auto binPath= "$TARGETDIR$\Service.exe" obj= $USERDOMAIN$\CFS password= $PWRINPUT$ (WAIT, get result into variable CFSRESULT)
if Variable CFSRESULT Equals 0
MessageBox: INFORMATION, Inside: $CFSRESULT$
end

Is there anything that I should do to fix it?

Also, the $CFSRESULT$ always returns the same value (1) no matter the password is wrong or right and the service is created. When I test the "sc.exe create" command at MS-DOS, it won't be able to create a service if the password is wrong. Anyone has any idea?

Thanks
Nhan
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: undefined variable for return variable in Run Program

Post by giaviv »

Hi,

What is the error level you get when you run sc.exe in cmd? Try typing echo %errorlevel% - is it 1?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ttcn2k4
Posts: 31
Joined: Wed Feb 01, 2012 10:04 am

Re: undefined variable for return variable in Run Program

Post by ttcn2k4 »

I caught 2 cases of the return value 0 or 1057. However, the %errorlevel% always 0. Well, at least I can have 2 different values to compare now. Thus, my main question is about the variable. When I have the comparison "if Variable CFSRESULT Equals 0", I got undefined variable for CFSRESULT at compiling.

I have tried with "if Variable CFSRESULT Equals 1", same error message. Only the "MessageBox: INFORMATION, Outside: $CFSRESULT$" (without if command) is fine.

Thanks
Nhan
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: undefined variable for return variable in Run Program

Post by giaviv »

Hi,

Try defining the variable first - just enter at the top of your script:

Code: Select all

Set Variable CFRESULT to 
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: undefined variable for return variable in Run Program

Post by giaviv »

Hi,

Try defining the variable first - just enter at the top of your script:

Code: Select all

Set Variable CFRESULT to 
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ttcn2k4
Posts: 31
Joined: Wed Feb 01, 2012 10:04 am

Re: undefined variable for return variable in Run Program

Post by ttcn2k4 »

it works.

Thanks
Nhan
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: undefined variable for return variable in Run Program

Post by giaviv »

No problem!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply