PDA

View Full Version : getting data out of an exe


mjabon
09-21-2009, 09:32 PM
Hello. I want to publish a script as an exe and it writes to a file. I want to have axcess to the data in that file after the exe is closed (ie I want it saved in the same folder the exe is stored).

How can I do this? Right now nothing comes out of the exe.

farshizzo
09-22-2009, 10:58 AM
The documentation for Publishing as an EXE (http://www.worldviz.com/vizhelp/Publishing_as_an_EXE.htm) describes how to accomplish this. Specifically, you need to use the viz.res.getPublishedPath() (http://www.worldviz.com/vizhelp/commands/viz/res/getPublishedPath.htm) command.

mjabon
09-22-2009, 11:49 AM
The documentation for Publishing as an EXE (http://www.worldviz.com/vizhelp/Publishing_as_an_EXE.htm) describes how to accomplish this. Specifically, you need to use the viz.res.getPublishedPath() (http://www.worldviz.com/vizhelp/commands/viz/res/getPublishedPath.htm) command.

Right, but that just returns a string - the path of the file. It doesn't output the file.

farshizzo
09-22-2009, 11:53 AM
Of course it doesn't, it's up to you to create the file using the new path and write to it:f = open( viz.res.getPublishedPath('output.txt') , 'w' )
f.write('bla bla bla')
f.close()