[Windows Mobile] arealityfarbetween:
Hi there chef's! I'm not sure if any of you will find this useful but I'll post it in case you do...

I designed this little mortscript application so that users of my rom can tweak a few settings to their needs and because all of the other tweak applications couldn't be tweaked easily themselves without learning .NET or something similar.

I wasn't getting much feedback so I thought perhaps it wasn't customisable enough or maybe you didn't like my selection of tweaks. Perhaps you thought the menu layout sucked?

Anyway, to address those problems I've moved this on quite a way. It now includes a set of functions for creating Menu's. To Find out how, see the section titled DynamicMenu.

FoddTweak

Backup and restore of important data (Full registry, Titanium configuration, Start menu cpr files, Start menu icon registry settings)

Icon removal to save RAM (all, or all but settings (HTC icons are excluded))

Titanium plugin injection/removal and plugin order settings

Slide lock settings (both manila and wm6.5)

Enable/Disable Sleuth's myLocation service (soft-reset needed)

Enable/Disable start menu replacements and complete removal of the WM6.5 start menu

FoddTweak depends on a few things:

MortScript! (tested on 4.3.b15)

DynamicMenu (included in versions>0.0.1)

TICS Installer (for plugin injection/removal, included in versions>0.0.1)

FDC task manager (for backup purposes, included in versions>0.0.1)

DynamicMenu

It works like this; the menu system 'compiles' a master menu source file with extension mgs to it's component mgc files for each menu. If you want DynamicMenu to 'recompile' then just delete the top level compiled menu (e.g. If you add new options to "FoddTweak.mgs" then delete "FoddTweak.mgc" then re-run FoddTweak.)

This is a sample file, which is used to create menu's for the FoddTweak application:

menu(FoddTweak:Main Menu)
item(Toggle Lock on Screen Dim:true:Call:"AnyRegWrite", "Toggle", "HKCU", "ControlPanel\Backlight", "AutoDeviceLockEnable")
item(Sleuth's myLocation Service:true:Call:"AnyRegWrite", "Toggle", "HKLM", "Services\myLocation", "Enabled")
item(:false)
menu(RAM Savings:RAM Saving Options)
item(Remove all Start Menu Icons:false:Call:"RmAllStartIcons")
item(Remove all but Settings Icons:false:Call:"RmAllButSettings")
item(Remove the Start Menu:false:Call:"RmStartMenu")
endmenu
item(:false)
menu(WM6.5 Settings:WM6.5 Specific Settings)
item(Toggle WM6.5 Slide Lock:true:Call:"AnyRegWrite", "Toggle", "HKLM", "Software\Microsoft\Shell\LockScreen", "Enable")
item(:false)
item(Titanium Plugin Injector:false:Call:"TitaniumPluginInjector")
item(Titanium Plugin Uninstaller:false:Call:"TitaniumPluginUninstaller")
item(Titanium Plugin Order:false:Call:"TitaniumPluginOrder")
endmenu
item(:false)
menu(HTC Sense:HTC Sense Options)
item(Toggle Sense 2.5 Slide Lock:true:Call:"AnyRegWrite", "Toggle", "HKCU", "Software\HTC\Manila", "Home.lock.Enabled")
item(Toggle Sense Menu Replacement:true:Call:"ToggleSenseMenuRep", "Toggle")
endmenu
item(:false)
menu(Backup:Backup Options)
item(Make Backup:false:Call:"Backup")
item(Select Backup Folder:false:Call:"SelectBackup")
item(:false)
item(Restore ZIP Backup:false:Call:"RestoreZIP", backupdir\"*.zip", "\Windows")
item(Restore REG Backup:false:Call:"RestoreREG", backupdir\"*.reg")
endmenu
endmenu

Syntax

It should be quite obvious how the menu/submenu entries work with a title and description-those can be nested without any problems (though, I only tested one nesting at present.)

Menu syntax is a little restricted, you can't have the colon (":") symbol in the name or description as it's used as a field delimiter and they must be string literals:

menu(name:description)
...
endmenu

For your menu items, the ItemName and Mortscript Command are string literals. Arguments which are not enclosed in double quotes will be interpreted as variables (I haven't tested this though,) which obviously must be set by the calling script before the call to DynamicMenu().

You can make use of any Mortscript function that the script which calls DynamicMenu() has access to and of course Mortscript commands such as "Run" etc will also work just fine so with this you can access any system command as well.

The testing field for the items is important, if your function supports taking it's first argument as the word "test" and outputting something, that something will be output in brackets next to the menu item. Sounds vague? Well, it is. That something can be anything, true/false, a string. Whatever. So the idea is that it'll be used to denote whether a switch is on/off or the value of that particular menu item...

item(ItemName:Can it be tested?:Mortscript Command:Argument1, Argument2, ..., ArgumentN)

To put in a seperator you can include a blank line in the menu using the code below. I wouldn't recommend it due to differences in screen size, but if you wanted a dashed line as the seperator, for example, then just fill the first field with hyphens. Seperators are as follows:

item(:false)

It's a v.simple language, I haven't included any comment support and it's line by line but see what you make of it :)