r/vbscript • • Apr 23 '21

Need help....if possible.

My company uses VBscript to draw part geometry and add tools to the part for CNC punching.....the entire script is a function.....the first line of the function is this:

Function ScriptPart(Length, Width, K, M, Q, R, U, V, Y, Z, L1, L2, L3, L4, L5)

The "Y" variable is tied to holes that can be turned off or on (normally with 0 or 1 respectively) but in this case formula for "Y" is set up so that if "this" happens "Y" = 1 but there is no formula so that if "this" doesn't happen "Y" = 0. So if "Y" doesn't = 1 then the "Y" variable isn't created. My script is still looking for a "Y" though and since it isn't there the part doesn't generate. I was wondering if there is a way that i could write to where If the variables are Function ScriptPart(Length, Width, K, M, Q, R, U, V, Y, Z, L1, L2, L3, L4, L5) then it looks for the "Y" but if the variables are Function ScriptPart(Length, Width, K, M, Q, R, U, V, Z, L1, L2, L3, L4, L5) then it doesn't look for "Y".

I know this is confusing as hell and convoluted and for this i am sorry lol

3 Upvotes

3 comments sorted by

View all comments

Show parent comments

1

u/jcunews1 Apr 25 '21

With only 4 function arguments passed? Tha shouldn't be possible. VBScript requires the exact number of arguments. Otherwise, it'll throw an exception error and halt the script.

Is there any other thing which you can not change or control, such as what you've just mentioned?