# Enable / Disable Actions with a script

**URL:** https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673
**Category:** Discussion
**Created:** [November 27, 2007, 4:06am UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673 "2007-11-27T04:06:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 27, 2007, 4:06am UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673/1 "2007-11-27T04:06:18Z")

</div>

Hello

I've got a question about enable / disable different actions.

I've a list with actions.

I build a project twice a day. A daily build an a nightly build. The daily build don't use as much actions as the nightly build does.

My question is now, can I use the same action list for both? (daily and nightly build) When I run a daily build can I disable all the action which I don't need?&nbsp; (Maybe with a script or something like that?)

Thanks a lot!

I hope you understand what I meaning ;-)

Regards

Christof

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 28, 2007, 12:29pm UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673/2 "2007-11-28T12:29:33Z")

</div>

Hi Christof,   
  
 You can skip an action at runtime. There are three ways to do this:   
  
 1) Use an Execute Condition. If you go to the “Runtime” tab of an action, then there is a section at the bottom called Execute Condition. The Execute Condition is a small piece of script which must evaluate to “True”, or the action will be skipped.   
  
 Say you had a Project Variable called IsNightlyBuild, which is set from the scheduled nightly build with the /V option. The Execute Condition could be simply “IsNightlyBuild”.   
  
  
 2) Use the BeforeAction script event on an action. This script event has a pass-by-reference parameter called SkipAction which you can set to True in order to skip the action.   
  
  
 3) Use If/Then logic. If you need to skip multiple actions, it can be a good idea to group them together as the child of an If/Then action, and use the If/Then logic to determine whether or not to run them. This can make it easier to see the logical and functional structure of your build process.   
  
  
 Please let me know if you’d like an in-depth walkthrough on any of these techniques.   
  
 Regards,   
  
  
 Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 28, 2007, 9:33am UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673/3 "2007-11-28T09:33:48Z")

</div>

Hi Angus

Thanks for your repy!

Would your first suggestion work with more than 2 build options I have about 8 build options

What would you prefer? For each build option a separate action list? Or one of the solution which you told me?

Thanks a lot!

Regards,

Christof

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 28, 2007, 11:27am UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673/4 "2007-11-28T11:27:14Z")

</div>

Hi Christof,   
  
 So you mean that there are 8 different types of builds you could be running?   
  
 It really depends on how different they are. If there are lots of major differences, separate action lists could be an option. If there are only minor differences, you might want to parse the build type and set some other variables, for example using the Switch/Case actions   
  
 Switch(BuildType)   
 Case NightlyBuld:   
 Set Variable RebuildAll = True   
 Set Variable RunTests = True   
  
 Case DailyBuild   
 Set Variable RebuildAll = False   
 Set Variable RunTests = True   
  
 … etc, etc.   
  
 Or there are numerous other ways you could do it.   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 29, 2007, 3:54am UTC](https://www.finalbuilder.com/forums/t/enable-disable-actions-with-a-script/673/5 "2007-11-29T03:54:05Z")

</div>

Thanks for your help!

I'll try the different proposals.

Regards

Christof

&nbsp;
