>the option appears but the boolean is always true regardless of the menu item state
Not if entered correctly. You can do an even simpler test; add the following just inside OnBeforeRequest
>The examples in the book have a different syntax
There are many different examples in the book; see the Extend the Rules Menu
section around page 209 (depending on which edition you're reading) for discussion.
public static RulesOption("Work Offline")
var bWorkingOffline: boolean = false;
Just to break this down: these two lines create a public static boolean field
with an initial value
of false. The field is decorated with a RulesOption attribute
(which is constructed using a string argument of "Work Offline"). When Fiddler compiles the FiddlerScript, it enumerates the public static fields, notes any that have a RulesOption attribute, and binds each as the backing value field for a new menu item on the Rules menu whose name is the text specified in the attribute.
The location of the attribute is somewhat flexible, you can write, for instance
public static var bWorkingOffline: boolean = false;
... if you prefer.
From the book:
As each Session flows through Fiddler, methods in the CustomRules.js script file are run, enabling you to hide, flag, or modify Sessions based on criteria of arbitrary complexity. Your rules script can be modified and recompiled dynamically at runtime without restarting Fiddler. This book does not provide a comprehensive reference to the JScript.NET language upon which FiddlerScript is based. If you plan to code especially powerful or complicated FiddlerScript, you should consider finding a copy of Microsoft JScript.NET Programming.
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items