Two questions: registry and menus

10 views
Skip to first unread message

Eric James McMahon Witham

unread,
Feb 13, 2015, 2:45:41 PM2/13/15
to httpf...@googlegroups.com
Hi,

I'm writing some custom classes inside the rules script to handle a custom authentication scheme.  There are two things that I would like to do but I'm not exactly sure how to do them.  I'm hoping these are easy questions.

First, I have some complex options that I would like to save off into the registry myself (not using the BindPref mechanism).  I see that the Utilities namespace has Get methods for Int, Float, and Bool, but the only Set method is for String.  What is the best way to set and get Strings, Ints, and Bools from the registry?

Second, is there a way to make my own complex top level menu?  I'm familiar with adding custom sub-menus to the Rules top level menu, and I've also made simple top level menus, but what I would really like to do is have a menu like this:

[CustomAuth]
--[Enable Auto Authentication] (bool)
--[Redirect Requests]
----[Test Environment]
----[QA Environment]
----[Prod Environment]
----[disabled]
--[Some other option set]
----[Other option 1] (bool)
----[Other option 2] (bool)

Is any of that possible?

EricLaw

unread,
Feb 18, 2015, 10:07:32 AM2/18/15
to httpf...@googlegroups.com
Why don't you want to use a preference for this task?

You can use any of the .NET registry APIs in your script, you need not use any of the Utilities APIs.

You can add any menu you like to Fiddler's menu set using the standard System.Windows.Forms APIs.

Generally speaking, a task of the complexity you describe is implemented by creating an IFiddlerExtension rather than using the JavaScript API. This makes it easier to redistribute your work, allows you the ability to use C# for development, and allows you to use a proper debugger like Visual Studio.

Eric James McMahon Witham

unread,
Feb 18, 2015, 10:26:46 AM2/18/15
to httpf...@googlegroups.com
Thanks for the response!

I did end up getting what I wanted using the .NET registry APIs.  The main reason I didn't go with a preference is that there are a variable number of values that need to be saved off depending on how the user configures their system.  I'm trying to make my code easily redistributable to co-workers who are testing on different environments, not all of whom are programmers.  Saving / loading those values programmatically seemed like the best way, as I couldn't figure out how to get BindPref to work with a complex object.

After getting  to this point, I do agree that I'd be better off creating an IFiddlerExtension.  This is my first attempt at using JScript, so it's been fun to learn and figure things out, but I don't think it's the right tool for the task in this case.
Reply all
Reply to author
Forward
0 new messages