Script numeric edit control values not comparing

This ones driving me round the bend, here is the dcf for you to check
Iconset maker v2.dcf (13.8 KB)
The bug :
performing simple error check to see if large icons and small icons are within range and not equal to each other and that the large icons are not smaller than the small icons.
When a 3 digit number (i.e. greater than 99) is entered for the large icons and the small icons are smaller the 'Small icons are bigger than Large icons' error is triggered erroneously.
To check this bug click the button, make sure there is an icon name in the icon name field and enter 100 in the Large icon size field and click OK.

Logging is more verbose, thanks to @Ixp and ExifTools and the conditional check that is being triggered when it should not be is on line 69.

What is the actual bug here? It sounds like a bug in your script, unless you’re saying the wrong values are being returned from the controls, but there’s no mention of that or any diagnosis here.

Make sure you are comparing numbers and not strings. JScript can convert strings to numbers if needed.


This is the comparison error at line 69. When 99 is entered for Large icon size the error does not happen.
The controls are set to 'Number'. The types are not changed in the script that I know of.

I did take into account that I've only been learning javascript for about a week now, so it is probably a nooby error, I cleaned up the script and rewrote the error trapping routine but it still comes up with the same error. So I reluctantly posted it as a bug, knowing how busy you are. Please correct me if I'm wrong.

Thanks for the pointer, just used typeof and they are strings
image

var iconLarge = dialog.Control("edit2").value;
var iconSmall = dialog.Control("edit3").value;
Log("TYPE " + typeof iconLarge);

The Controls have been set to Number, but this is turning them into a string ? Is that right ?

I think it might be a bug,

but typeof dialog.Control("edit2").value is reporting as string.

Edit controls return strings. Numeric edit controls just restrict which characters you can type into them.

Convert it to an integer as I suggested earlier.

Thanks for the clarification, that makes sense :slight_smile: