CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 06-20-2013, 10:39 AM   #1
Shawn Olson
wallworm's Avatar
Shawn Olson
Wall Worm
Columbus, USA
Join Date: Jul 2011
Posts: 220
Remove ESC from incoming string data

I have a function that uses memStream.readLine() to get data from 3rd party data sources (text files). Now I've encountered a problem I've never seen before.

Here is some pseudo-code:

Incoming string looks like this in Notepad++ (but uses little arrows in Notepad):

connections { "OnUser1" "target1ESCSetParentESCparentObj1ESC0ESC-1" "OnUser2" "target1ESCSetParentESCparentObj2ESC0ESC-1" "OnUser3" "target1ESCSetParentESCparentObj3ESC0ESC-1" "OnUser4" "target1ESCSetParentESCparentObj4ESC0ESC-1" }

(The characters did not paste properly into the form, so below is an actual image.)

That string is assigned to IncomingString in the code below:

memStreamString = memStreamMgr.openString IncomingString while memStreamString.eos() == false AND memStreamString.peekToken() != undefined do ( memStreamString.skipSpace() theLineC= (memStreamString.readLine()) print theLineC --This will print the text in the MAXScript listener filterString theLineC " " --This will stop the code from executing and print **interrupted** in the Maxscript listener )

So it appears this incoming data is using the character code that represents the ESC key on the keyboard.

I do not know how to sanitize this so that I can use it.

I find it odd that I can print the code but as soon as I try to run string functions that let me extract the data I want, Max stops executing and prints:

** interrupted **

I tried adding this code to the top of the parser:

escapeEnable = false

But that did not help (and according to the docs, is now defaulting to false anyway).
Attached Images
File Type: jpg maxscript_ESC.jpg (75.2 KB, 42 views)

Last edited by wallworm : 06-20-2013 at 10:45 AM. Reason: clarification
Old 06-20-2013, 11:23 AM   #2
Shawn Olson
wallworm's Avatar
Shawn Olson
Wall Worm
Columbus, USA
Join Date: Jul 2011
Posts: 220
OK... I found a solution:

replacementString = " " --set to whatever is best for needs cleanString = substituteString taintedString "\x1b" replacementString
Old 06-20-2013, 11:23 AM   #3
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:15 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.