SimplyMaya Forums

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


SM Forums / Maya Questions / Programming / load variables from a text file

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
22-02-2016, 11:53 PM   #1
uncharming
Registered User
 
Join Date: Feb 2016
Posts: 1
load variables from a text file
hello everyone, I need your help.
As indicated in the title, I want to load variables from a text file. I'm writing a single script.
At first, I generate a text file "C:/tmp/variable.txt" , (with a fopen) in which there is this:

string $VARMAX[] = {"nurbsSphere1","pCube1","nurbsCone2"};

secondly, I load it:
source "C:/tmp/variable.txt";
print $VARMAX;


it is now that the problem happens. If my file "C:/tmp/variable.txt" doesn't yet exist, Maya will tell me 'Cannot find file'. Logic.

So I try to put the command in a 'evalEcho',

pause -sec 1;
evalEcho "source \"C://xdk//variable.txt\";";
print $VARMAX;


I have this message: // Error: Line 3.14: "$VARMAX" is an undeclared variable. //
as if it was a procedure.

I need to have this text file to use it instantly or later.
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
// Error: line 0: Error reading file. PiroEfekta Programming 13 03-08-2016 05:52 PM
Error Reading File... HELP ME PLEASE roryfollansbee Challenge Forum 1 16-04-2016 09:00 AM
Cant open file Jimmer Maya Basics & Newbie Lounge 0 18-09-2014 03:58 AM
trouble opening maya scene jooleyinboots Maya Technical Issues 2 03-02-2014 09:11 PM
Maya scene files and rendered .iff files disappearing from HDD on file load priimate Maya Technical Issues 3 06-05-2011 09:34 AM