DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

string operations

Solved!
Go to solution

hello.

 

i have a string (as a variable) an want to do 2 things:

 

  1. i want to know if a a charakter is the is the character "K" for example (string is "abcKhhh" i want to know if the 4th character ist the "K")
  2. i want to change te 10th charakter to "1" (string is "xxx_dd_02" i want it "xxx_dd_12")

i tried it with:

vari:="xxx_dd_02";

vari(7):="1";

but had no luck.

Any idea????

 

thx for any help

max

0 Kudos
Message 1 of 8
(6,389 Views)

Hello Max!

 

There is no char access in VBS strings but you can work with strings parts like this

 

1.:

if Mid("abcKhhh",4,1) = "K" then
  MsgBox "It is a K!"
else
  MsgBox "It isn't a K!"
end if

  

2.:

dim s

s = "xxx_dd_02"

MsgBox Left(s,7) & "1" & Mid(s,9)

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
Message 2 of 8
(6,384 Views)

hi matthias,

 

thx a lot for help. the problem is, i need it in a diadem sequence (*.au) - no vb script :(. had a long search in the diadem help but no luck. maybe i will find some similar instruction for the diadem sequence.

 

thx a lot !

 

max 

0 Kudos
Message 3 of 8
(6,372 Views)

Hello Maexchen,

 

What version of DIAdem are you using? It is possible to mix AUT and VBS code (not recommended, but possible), so unless you are using a very old version of DIAdem, you might still be able to use  the VBS code.

 

Best regards,

 

Otmar D. Foehner
0 Kudos
Message 4 of 8
(6,367 Views)
Solution
Accepted by topic author Mäxchen

Hello Mäxchen!

 

AUT is a little bit different Smiley Wink It's a time ago that I used it and I'm in a hurry now. Some small hints: Look at the commands cop and del (should be still in the help). I will make you an example in the evening (GMT).

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 5 of 8
(6,365 Views)

Hello all,

 

thx for help, with the commands cop and del and the Stringaddition (+) all works fine. the help is a little bit strange because its hard to understand if a command is for vbs or aut-sequence.

 

it would be interesting how to mix "aut-code" and "VBS-code" in a aut-sequence. this could be sometime very nice :).

i am on Diadem 9.1.

 

Thx for all help

Max

0 Kudos
Message 6 of 8
(6,351 Views)

Helo Max!

 

Nice that I could help.

 

To call VBS from AUT is easy! Have a look at the commands ScriptStatement and ScriptEvaluate or at this thread 'http://forums.ni.com/ni/board/message?board.id=60&message.id=3992&query.id=350780#M3992'

 

Have you tried the AUT->Script convert build in DIAdem? Give it a try. It produces 99.9% correct results (some verry unusual cases are not supported).

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 7 of 8
(6,346 Views)

Hello Matthias,

 

will have a look to the other thread.

i can not convert the *.aut because it is a working test-stand where i had to implement a new test...

0 Kudos
Message 8 of 8
(6,344 Views)