My ruby read write file error when loading them
-
So would you want me to init open my r/w file each time you start-up skeckup so that my ruby can be loaded with-out r/w error?
(or can I make some subloop process when you only inial or postial run the ruby function.to open or close r/w file)The problem is the comfirm init open r/w file menu process, I wish I could init open my file with out open file menu and select process.
Dose anyone use read/write funtion?
Dose the r/w section of ruby init load only to seketchup untill some one call it thou the open file process.
It must be something simple?
or I missing some info to sheckup process to init open r/w function.
-
You issue is not expressed clearly.
Can you simply explain what is is you want to do...Any RB files in Plugins auto-load as SketchUp starts.
You can manually useload('somefile.txt')
after it is done - the TXT file won't have auto-loaded before that.You can certainly use
fi=File.open(fullfilepath, 'r')
orfi=File.open(fullfilepath, 'w')
.
To get the file's contents you could also usecontents=IO.read(fullfilepath)
To get an array of 'lines' uselines=IO.readlines(fullfilepath)
To write to a file there are several ways...
fi.write(stuff) fi.print(string) fi.puts(line)
etc...
Don't forget to tidy up withfi.close
afterwards, if using 'open' and completing the 'writing' etc, otherwise it is stuck open and can't be accessed by another process until SketchUp is closed.
Note how you need to pass the FULL path to the file your are opening to read/write...
If it does not exist it is made.
Unless you use the second argument of 'a' to 'append' [instead of 'w' for 'write'] the file's contents will be overwritten. -
Thanks Tig
load('somefile.txt')
it's was something simple
now
errors and fix menu's begone
I fixing my massive inputbox and Var array (to a eazier to use floting WebDialog for inputing and smaller number of data arays need to control my processing )
Advertisement