SableScript problem using If statement
Posted: Sun Feb 11, 2007 9:57 pm
I am having difficulty getting a simple SableScript to work. What I'm trying to accomplish is to use a combo box to allow the user to select a feature and then have a run button that reads in the appropriate .cin file for that feature and runs the simulation. The combo box is working fine because I can verify that the parameter (called 'ChooseCINFile') is changing its value as the user selects a feature. When I hit the run button I've defined it runs the following script:
sub GetFeature()
dim ChooseCINFile as integer
if (ChooseCINFile = 1)
call RunVenappCommand(SIMULATE>READCIN|POX-Sable.cin)
call SimulationRun()
end if
if (ChooseCINFile = 2)
call RunVenappCommand(SIMULATE>READCIN|POX-Sable.cin)
call SimulationRun()
end if
end sub
I know the script is getting executed because if I put a call SimulationRun() outside the If statements the simulation runs (there are no commands defined in the button properties to do this - I let the script do the run). I also know that the If statements are not executing because even if I make the condition If (1 = 1) it still won't execute what is inside the If statement. I've tried putting only the call to SimulationRun() inside the simplest If statement but it doesn't work - only if it is outside the If statement. Ideas?
I also have a separate question - when the user makes a selection in the aforementioned combo box and then does a run - at the end of the run the combo box parameter always reverts to its default value as defined in the model. How do I get it to stay with the value chosen by the user? I was able to do this by making the parameter a subscripted variable in the model but there must be a better way to do this?
Any help would be appreciated. Thanks.
sub GetFeature()
dim ChooseCINFile as integer
if (ChooseCINFile = 1)
call RunVenappCommand(SIMULATE>READCIN|POX-Sable.cin)
call SimulationRun()
end if
if (ChooseCINFile = 2)
call RunVenappCommand(SIMULATE>READCIN|POX-Sable.cin)
call SimulationRun()
end if
end sub
I know the script is getting executed because if I put a call SimulationRun() outside the If statements the simulation runs (there are no commands defined in the button properties to do this - I let the script do the run). I also know that the If statements are not executing because even if I make the condition If (1 = 1) it still won't execute what is inside the If statement. I've tried putting only the call to SimulationRun() inside the simplest If statement but it doesn't work - only if it is outside the If statement. Ideas?
I also have a separate question - when the user makes a selection in the aforementioned combo box and then does a run - at the end of the run the combo box parameter always reverts to its default value as defined in the model. How do I get it to stay with the value chosen by the user? I was able to do this by making the parameter a subscripted variable in the model but there must be a better way to do this?
Any help would be appreciated. Thanks.