Hi Every body
First of all, I have to say I know only a little about writing script in wincc
so my question maybe is very simple! anyway,my question is:
I have a 17 characters string in an internal tag with " text tage 8-bit character set"
now I want to separate two character of this string and move these character to an external tag with word data format in the other words,
for example I have an internal tag with name "code" include 17characters like" ABEDOKHD569874125"
and I want to move second and 3rd character (BE) to an external tag with name "Type" in word format
but I don't know how can I do that?!
Is any help?
thanks
[?+]: Getting two character of a string and write in a DW
-
- Posts: 15
- Joined: Wed Jan 26, 2011 1:24 pm
-
- Posts: 258
- Joined: Fri Apr 03, 2009 3:24 pm
- Location: Bosnia and Herzegovina
Re: [?]: Getting two character of a string and write in a DW
Try something like this:
n is a 16-bit integer, word.
Code: Select all
a0$="ABEDOKHD569874125"
a1$=mid(a0$,2,2) (you get a1$="BE")
n1=asc(mid(a1$,1,1)) (you get n1=asc("B")=65, 0100 0001)
n2=asc(mid(a1$,2,1)) (you get n2=asc("E")=68; 0100 0100)
n=256*n1+n2; 0100 0001 0100 0100
-
- Posts: 15
- Joined: Wed Jan 26, 2011 1:24 pm
Re: [?]: Getting two character of a string and write in a DW
thanks Homeroid_BL
it works
it works