View Full Version : Another Conditional Question...sorry
GregSS
02-09-2005, 04:38 PM
I just upgraded from SF6. I have several projects that used a run time condition built in the conditional dialog box in sf6 that allowed me to set whether or not certain files were installed based on a radio button setting.
The dialog was painless.
If %radioselection%=option1 type stuff...
I have imported those SF6 jobs, and now it seems as though I will have to create some kind of conditional code instead of using that conditional dialog to set the run time conditions.
I have read through some of the threads here...but I am still confused.
Thanks,
Greg
Corey
02-09-2005, 06:16 PM
Hi Greg, what is your question?
GregSS
02-10-2005, 07:46 AM
My question is:
How do I set a run time condition of something like "if radiobutton1 is checked then install this file".
Thanks,
Greg
Brett
02-10-2005, 09:07 AM
First of all, take a look at the Radio Buttons screen. See the field called "Store result in session variable:"? That field allows you to define a session variable that will store the radio button control ID. Control IDs are those items that look like this: CTRL_RADIO_BUTTON_01 beside each item. So, if the user chooses Option 3 (in the case of the default Radio Buttons screen) %RadioSelection% will be set to CTRL_RADIO_BUTTON_03.
So, if you want to conditionally install a file based on this value, double click the file to open its file properties and go to the Conditions tab. See the field called "Script Condition"? That is where you will put the condition that will evaluate the result of the radio button screen. Sinve the result is stored in a session variable, we will need to expand it and then ompare the result. So, for example you could enter something like this in that field:
SessionVar.Expand("%RadioSelection%") == CTRL_RADIO_BUTTON_01
to only install the file if the user chose the first radio button option. Hope that helps.
GregSS
02-10-2005, 09:32 AM
Brett,
That helped quite a bit! Thank you. I have also been reading the users guide this morning.
For an opinion, I think that the script language is very powerful, and has quite a few useful features. I also believe that the SF6 menu choices for the variables that already existed instead of typing them all out. It kept me from switching screens back and forth looking for the right one.
But, I am learning...and that is always a plus.
Thanks,
Greg
GregSS
02-11-2005, 11:14 AM
I have tried, specifically, that type example to see if the files will indeed install if I select Button1 and they do not.
I do not get an error anymore with the condition statement in there, but none of the files with the condition of SessionVar.Expand("%RadioSelection%") == CTRL_RADIO_BUTTON_01
install when button 1 is selected. Any files without a condition install to the proper location.
Any ideas why this will not work?
Thanks again...
Greg
Joshua
02-16-2005, 03:42 AM
I admit I am a noob and I am bad at programing so there may be a way to use less code, but this is how I handle radio buttons.
Open the screen that contains your radio buttons. Place something like the following into your ON NEXT actions area:
-- check which radio button was choosen
nSelectedControl = String.ToNumber(SessionVar.Expand("%RadioSelection%"));
if (nSelectedControl == CTRL_RADIO_BUTTON_01) then
RadioChoice = 1;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_02) then
RadioChoice = 2;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_03) then
RadioChoice = 3;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_04) then
RadioChoice = 4;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_05) then
RadioChoice = 5;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_06) then
RadioChoice = 6;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_07) then
RadioChoice = 7;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_08) then
RadioChoice = 8;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_09) then
RadioChoice = 9;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_10) then
RadioChoice = 10;
elseif (nSelectedControl == CTRL_RADIO_BUTTON_11) then
RadioChoice = 11;
end
-- advance to the next screen
Screen.Next();
Then, where ever you want to test which button was choosen you can do either:
A}
if (RadioChoice == 1) then
-- do something
end
+++OR+++
B} to use as conditions in the individual file properties screen
RadioChoice == 1
change 1 to the number you want.
Hope this helps
Josh
Krawhitham
04-24-2005, 02:16 AM
I have tried, specifically, that type example to see if the files will indeed install if I select Button1 and they do not.
I do not get an error anymore with the condition statement in there, but none of the files with the condition of SessionVar.Expand("%RadioSelection%") == CTRL_RADIO_BUTTON_01
install when button 1 is selected. Any files without a condition install to the proper location.
Any ideas why this will not work?
Thanks again...
Greg
Put then in the "on next" action for the radio buttons screen
-- Expand the session variable %RadioSelection%.
strRadioSelection = SessionVar.Expand("%RadioSelection%");
-- Convert the selected radio button control to a number for the comparison.
nSelectedControl = String.ToNumber(strRadioSelection);
for the "script condition" in file properties use
nSelectedControl == CTRL_RADIO_BUTTON_01
or
nSelectedControl == CTRL_RADIO_BUTTON_02
or
nSelectedControl == CTRL_RADIO_BUTTON_03
or
nSelectedControl == CTRL_RADIO_BUTTON_04
and so on
Ishana
10-13-2008, 06:27 PM
I see posting on how to define a single variable with one screen of radio buttons...but how do I define multiple variables in the script conditions text box in the File Properties?
I have created 2 Radio button screens, one to ask which language (French or English) which I am capturing in %Language% and the other screen to capture which version of PowerPoint they are running (2000 or 2002,2003,2007)
[My PowerPoint Addin is in 2 versions, one for Powerpoint 2000 and one for Powerpoint 2002,2003 or 2007, hence I am leaving it up to user to select which PowerPoint version they have]
on LanguageScreen1 I defined this on Next action after placing 2 radio buttons...
if String.ToNumber(SessionVar.Expand("%Language%")) ==
CTRL_RADIO_BUTTON_01 then
English = true;
French = false;
else
English = false;
French = true;
end
and in the Script conditions textbox defined
French
or
English
and it works fine.
I cant figure out how to have the second condition added in the textbox... is it with an AND and parenthesis? I need some examples please..
I tried the following and it doesnt work
French AND 2000
(French) AND (2000 = TRUE)
(French) AND (2002 = TRUE) OR (2003 = TRUE) OR (2007 = TRUE)
I tried doing it with just 2 radio buttons and also tried with 4 radio buttons (each version of Powerpoint on a separate button)
Some examples would be nice...please..
If someone has an alternative way of doing it, I am open to it.
thank you in advance...
jassing
10-14-2008, 09:52 AM
is this a suf6 or suf7/8 question?
You posted in both places...
you should start a new thread either way; reviving such an old tread just will confused the issue(s).
Assuming a suf6 (since that makes more sense)
2000 will never be true or false -- it will always be 2000
Try changing yoru variables to PowerPoint20000 Or better
PowerPointVersion = 2000;
then check
English and PowerPiontVersion==2000
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.