ScriptName "copy data V1.1" ScriptAuthor "(dA)" ScriptVersion "[18]" SetErrorHandler ( :AddressLable1 ) ; var vb_error : Byte ; // V1.0 15.07.02 create example // V1.1 15.07.02 SetErrorHandler included //Copy ( Source=v1, Destination=v2, NumberChar=v3 ); //Copy a number of bytes from one variable to another. //The number of bytes is a variable containing the number of bytes, //Source and Destination are meant to be Buffer variables. // Path: unsorted commands -> copy data // Copy ( v1 , v2 , v3 ) ; // Fieldbus -> yes // RS 232 -> yes // min value = 0 // But no effect. // max value = length of variable // Possible return code for an error, please see notice below // Errorcode = 0x10 = EXEC_USER_RAM_RANGE_ERROR // Example // Before: // : start ; // : stop ; Var v1 : BUFFER[4] ; MoveConst ( v1[0] , "1234" ) ; Var v2 : LONG ; Var v3 : BYTE ; MoveConst ( v3 , 4 ) ; : start ; Copy ( v1[0] , v2 , v3 ) ; //jump :start ; // The Script copy the value "1234" from v1 to v2 for 4 chars. // Notice: When the variable v3 bigger than v2 the overload bytes are // overwriting the variable v3. In the second run the "Errorcode 0x10" will be // displayed in the error window and the programm counter jump autom. to "AddressLable1" Var v12 : BUFFER[9] ; MoveConst ( v12[0] , "123456789" ) ; Var v22 : LONG ; Var v32 : BYTE ; MoveConst ( v32 , 9) ; : start2 ; Copy ( v12[0] , v22 , v32 ) ; jump :start2 ; :AddressLable1; Get (ErrorCode , vb_error) ; //user evalutation for the value of Errorcode return;