SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Maya Script reading txt-file and interpret data

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
28-10-2020, 04:53 PM   #1
AverageRigger
Registered User
 
Join Date: Jan 2020
Posts: 7
Maya Script reading txt-file and interpret data
Hello world!
I am currently experimenting with txt files inside maya. F.e.
"
1 sphere
2 cube
3 cylinder
4 cone
5 plane

"

The left column reflects a frame number and the right an objectname.
I want to read the file and interact with an object only for a specific frame. For example switching the visibility of an object on and off.

this is what i got so far:

fileHandle = open('c:\\text.txt', 'r' )
str1 = fileHandle.read()
fileHandle.close()
print str1

(This doesn't have to be written in Python. MEL is perfect aswell)
I know how to read the file and save it to an string but not how to navigate inside.
Perhaps someone is experienced enough to help
Thank you very
  Reply with quote
30-10-2020, 10:30 AM   #2
AverageRigger
Registered User
 
Join Date: Jan 2020
Posts: 7
Quote:
Perhaps someone is experienced enough to help
Thank you very
After a short research i found the answer! If anyone else needs it
https://knowledge.autodesk.com/suppo...A7495-htm.html

This is the way!
  Reply with quote