Subst Drive BeforeAction Failure

This worked in FB6, but in FB7 I get the error below:

JavaScript BeforeAction:

Action.VirtualDrive = CSSubstDrive.charCodeAt();
 

Action Messages:
Error Executing script : BeforeAction
EInvalidCast
Invalid class typecast
Line: 3
Char : 1
Error in BeforeScript : JavaScript, This Action did not execute.
 

If there is a better way to do this that will work for both, let me know.

-Nelson

Hi Nelson

The charCodeAt function actually returns an integer (the Unicode value of the character of the specified index, defaulting to zero if no index is specified). Not sure why this worked in FB6 (even when I use a run script action to perform a simple charCodeAt on a variable I get a number), however we have updated the scripting engine for FinalBuilder 7.

If you want to reference a character from a string you can use the charAt function which will return the character at the specified index.

Regards,
Steve

I am trying to migrate from FB6 to FB7 and the easiest way to do that is to not convert all my scripts at once. So ideally I need something that will work in both versions. In FB6, it won’t take a char, only an int and now in FB7 it only takes a char not an int. Any ideas?

Hi Nelson

Ok, I have it working now under FB7 :

https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700_1197.exe

There will probably be some corner cases where my scripting implementation doesn’t handle things as well as the old library, unfortunately I had no choice as the old library is full of assembler and doesn’t support unicode strings. It’s also something that’s not easily unit tested either.

Confirmed fixed.

Thanks for working on my issues so quickly!

-Nelson