add option to force type

allow a type parameter so the script can be used for widgets etc.