Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

are there restrictions to what you can type in script controller window?

are there restrictions to what you can type in script controller window?

Anonymous
Not applicable
803 Views
6 Replies
Message 1 of 7

are there restrictions to what you can type in script controller window?

Anonymous
Not applicable

i want this line to show up in the controller window

information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string + "cm" without me having to type it in manually but its not working.

 

 

My script over all works fine everywhere but this line

information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string\n0" ----this line WORKS when running a script meaning it shows up in the script controller window...so i know \n0 is not the problem

 

however when I use this script line which adds "cm" it will not show up in the script controller window when i run script
information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string + "cm"\n0 ---DOES NOT shows up in the script controller window  when i run script


but it does work if I type in manually in the window.

information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string + "cm"
0"

 

are there restrictions to what you can type in script controller window?

seems like its the combo of "cm"/n0 that it doesnt like.

Any ideas what could be my problem?

opinions? thank you.

 

i want this line to show up in the controller window when i run my script

information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string + "cm" without me having to type it in manually

0 Likes
Accepted solutions (1)
804 Views
6 Replies
Replies (6)
Message 2 of 7

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

it has to be :

information.kerning.controller.SetExpression "SUTheText.text = (bug.distance) as string + \"cm\""

of course if "SUTheText" and  "bug" are globals or this script controller variable names

0 Likes
Message 3 of 7

Anonymous
Not applicable

thanks...that does work but it doesnt add the 0 on the next line in the window like the /n0     (which means next line put a zero).

how would i add that as well?

 

 

oops...putting this seems to work.....+ \"cm\"\n0"

 

can you elaborate where you got your information and why what you showed me works?

Seems like a totally unpredictable answer 

thank you.

0 Likes
Message 4 of 7

denisT.MaxDoctor
Advisor
Advisor

because you want to put a string as a parameter of #text property.

 

i've just made the string complete:

 

it was:

 

(a.text = "abc") + "0123"

 

i made it:

 

a.text = ("abc" + "0123") 

 

 

it's just about how to quote an executable string right

0 Likes
Message 5 of 7

Anonymous
Not applicable

what is going on with the back slashes at the end?

+ backslash then quote then cm then backslash then quotes.? Iam lost there.

 

 

+ \"cm\""

 

 

0 Likes
Message 6 of 7

denisT.MaxDoctor
Advisor
Advisor

check for example the MXS Help -> String literals

0 Likes
Message 7 of 7

Anonymous
Not applicable

great! thanks for that direction.

0 Likes