From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

VBS: Invalid read-access to a variable

Hi all,
I my script I have a loop that runs 1000times and it do every run the same elaboration; at the 834 run I've got this error:

4    15/06/2007 1:43:08 Error:
     Error message from DIAdem command kernel:
     Invalid read-access to a variable "L1" .
5    15/06/2007 1:43:09 Error:
     Error in <TecNASGrafici.vbs> (Line: 84, Column: 4):
     Error message from DIAdem command kernel:
     Invalid read-access to a variable "L1" .
6    15/06/2007 1:43:09 Error:
     Error in <TecNAS.VBS> (Line: 370, Column: 3):
     Error in <TecNASGrafici.vbs> (Line: 84, Column: 4):
     Error message from DIAdem command kernel:
     Invalid read-access to a variable "L1" .

The strange thing is that all the other times it runs normally.

Someone can help me?

thanx a lot

Michele
0 Kudos
Message 1 of 7
(4,033 Views)
Hello Michele!
 
Can you give us your code?
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 7
(4,023 Views)
Hi Twigeater,
I modify the VBS to run lonely because in my program it's a LabView application that call a vbs script.
The program is running on a TestBench; but the error is strange because append randomly; it occur this night at iteration 1007 (of 2000); last time it occur at 834.
About you it could be a problem of RAM, timing on the accessa (so I need to use a pause), installation?
The script in attach it's only to give you an idea of the elaboration. It couldn't run . (I prepare an example and I send it)

Another question: is normal that after every iteration, even if at the end I use DATADELALL command, the memory used by DIAdem process increase of half Mb?
It's possible that after 1000 iteration the memory increase of 500mb and with low phisic memory the system couldn't works normally.

Thanks a LOT

0 Kudos
Message 3 of 7
(3,990 Views)

Hello Michele!

Now I got the time to have a look at your script. I couldn't reproduce your error in DIAdem 10.1 likely I have not your data.

I tried to understand your code and found some ambiguous lines. First of all it as good practice to add a 'Option Explicit' statement at the top of a script. After I made this I got errors in the Lines 12+22 because 'Level_' is undefined. 'L1' is used but never set. The reason for your error could be the mixed use of a DIAdem variable with a VBS variable. You use 'L2' a standard DIAdem variable and use the same name as parameter variable for your functions. There it will be a VBS variable! Try to change the function parameter variable name to e.g. 'VbsL2' and repeat your test. If you want to use the DIAdem 'L2' than just delete the function parameter.

 Note: You use the command 'ChD' to read the data. The command 'ChDx' is much faster!

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 7
(3,951 Views)
Hi Twigeater,
first of all thanks a lot for your reply.
I've missed to describe that this script is called by another script at every iteration of the "mail loop"; L1 is the iteration number defined in the main script (also Level_ is defined in the main script).
Now I change the variables to use only VBS variable and also I change ChD in ChDx.
I've post a new message because I've seen that at every iteration the memory used by DIAdem increase; it could be also that le low phisical memory cause some problem with the variable access.

Thanx very much Mattias.

0 Kudos
Message 5 of 7
(3,937 Views)
Hello Michele!
 
It was a good idea to split the two problems and to make a new thread for the memory issue. Please always add the DIAdem version number you use to your questions.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 6 of 7
(3,931 Views)
Hi, the version is DIAdem Base 10.0 with service pack SP1.

Thanx
0 Kudos
Message 7 of 7
(3,926 Views)