PDA

View Full Version : Determining if a Step is checked


tdc
05-12-2004, 08:48 AM
I am trying to determine if 'Am I Checked' is checked and then set a macro based on the result. This example only works for the current Step. How do I reference 'Am I Checked' in the script?

<?xml version='1.0'?>
<project version='5'>
<step action='Set Macro' type='0'>
<MacroName>test</MacroName>
<checked type='11'>0</checked>
<indent type='3'>1</indent>
<name>Am I Checked</name>
</step>
<step action='Run Script' type='0'>
<Language>VBScript</Language>
<Script>
<![CDATA[set pstep = step
if pstep.checked then
msgbox "set a macro"
else
msgbox "delete a macro"
end if
]]></Script>
<indent type='3'>1</indent>
<name>VBScript</name>
</step>
</project>

kinook
05-12-2004, 09:05 AM
If you know where the step is, you could use

If Project.Steps(vbldStepMain)(1).Checked Then
...

To locate the step by name, use

index = Project.FindStep("Am I Checked", vbldStepMain)
If Project.Steps(vbldStepMain)(index).Checked Then
...