Hi Folks,
I have working es 10.6 script that writes to a file but in 11.3 it fails to write the file.
My complete self contained example is below. All debugPrint output follows below the script.
When I run the script in es 11.3, it does read a pre-existing file but fails to write a file in the same directory. There are NO errors in the Formula Output window.
What the heck?
Also, Windows Explorer cannot see the file that should have been written but can see the FormulaOutput folder.
I did search on-line and tried using (as admin) attrib -r -s /D /S C:\Users. That did not help.
Running eSignal as Admin did not help. Running in Windows 7 Compatibility mode and as Admin did not help.
Looks like there is no longer a way to configure the output folder as there was in 10.6.
Does anyone have a suggestion?
I am running -
eSignal 11.3 version 2455 (64 bit)
Windows 7 Professional SP1
VMware Fusion 4.1.1
OS X 10.7.2 on a 64 bit Mac Pro
<code>
//
//
function preMain() {
setPriceStudy(false) ;
setStudyTitle("z_file_write_read_test_es_11p3") ;
setShowTitleParameters(true) ;
}
var sVersion = getBuildNumber() ;
var sFormulaOutputRoot = getFormulaOutputRoot() ;
var sUserName = getUserName() ;
function main() {
var nBarState = getBarState() ;
if (nBarState == BARSTATE_ALLBARS) {
var msgNum = 0 ;
debugPrint("msgNum " + msgNum + " eSignal version is " + sVersion + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " formulaOutputRoot " + sFormulaOutputRoot + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " userName is " + sUserName + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " nBarState is " + nBarState + "\n") ;
var sOutText = "some data to write to a disk file."
msgNum++ ;
var fileOutPath = "debug_file_io.txt" ;
var fileHandle = new File(fileOutPath) ;
if (fileHandle.exists) {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " opening file " + fileOutPath + "\n") ;
fileHandle.open("w+") ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " file did not exist " + fileOutPath + "\n") ;
}
if (!fileHandle.isOpen()) {
msgNum++ ;
debugPrint("msgNum " + msgNum + " did open file " + fileOutPath + "\n") ;
fileHandle.writeln(sOutText) ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " wrote >" + sOutText + "< to " + fileOutPath + "\n") ;
debugPrint("\n") ;
fileHandle.close() ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " could not open file " + fileOutPath + "\n") ;
debugPrint("\n") ;
}
fileHandle.open("r+") ;
if (!fileHandle.isOpen()) {
var sInText = fileHandle.readln() ;
fileHandle.close() ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " read >" + sInText + "< from " + fileOutPath + "\n") ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " could not open file " + fileOutPath + "\n") ;
debugPrint("\n") ;
}
var fileInPath2 = "other_preexisting_file.txt" ;
var fileHandle2 = new File(fileInPath2) ;
fileHandle2.open("rt") ;
var sInText2 = fileHandle2.readln() ;
fileHandle2.close() ;
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " read >" + sInText2 + "< from " + fileInPath2 + "\n") ;
}
}
</code>
Output from the above script is:
msgNum 9 read >This file was created with Notepad.< from other_preexisting_file.txt
msgNum 8 read >null< from debug_file_io.txt
msgNum 7 wrote >some data to write to a disk file.< to debug_file_io.txt
msgNum 6 did open file debug_file_io.txt
msgNum 5 opening file debug_file_io.txt
msgNum 3 nBarState is 2
msgNum 2 userName is pcolyer
msgNum 1 formulaOutputRoot C:\Users\Peter Colyer\Documents\Interactive Data\FormulaOutput\
msgNum 0 eSignal version is 2455
I have working es 10.6 script that writes to a file but in 11.3 it fails to write the file.
My complete self contained example is below. All debugPrint output follows below the script.
When I run the script in es 11.3, it does read a pre-existing file but fails to write a file in the same directory. There are NO errors in the Formula Output window.
What the heck?
Also, Windows Explorer cannot see the file that should have been written but can see the FormulaOutput folder.
I did search on-line and tried using (as admin) attrib -r -s /D /S C:\Users. That did not help.
Running eSignal as Admin did not help. Running in Windows 7 Compatibility mode and as Admin did not help.
Looks like there is no longer a way to configure the output folder as there was in 10.6.
Does anyone have a suggestion?
I am running -
eSignal 11.3 version 2455 (64 bit)
Windows 7 Professional SP1
VMware Fusion 4.1.1
OS X 10.7.2 on a 64 bit Mac Pro
<code>
//
//
function preMain() {
setPriceStudy(false) ;
setStudyTitle("z_file_write_read_test_es_11p3") ;
setShowTitleParameters(true) ;
}
var sVersion = getBuildNumber() ;
var sFormulaOutputRoot = getFormulaOutputRoot() ;
var sUserName = getUserName() ;
function main() {
var nBarState = getBarState() ;
if (nBarState == BARSTATE_ALLBARS) {
var msgNum = 0 ;
debugPrint("msgNum " + msgNum + " eSignal version is " + sVersion + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " formulaOutputRoot " + sFormulaOutputRoot + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " userName is " + sUserName + "\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " nBarState is " + nBarState + "\n") ;
var sOutText = "some data to write to a disk file."
msgNum++ ;
var fileOutPath = "debug_file_io.txt" ;
var fileHandle = new File(fileOutPath) ;
if (fileHandle.exists) {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " opening file " + fileOutPath + "\n") ;
fileHandle.open("w+") ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " file did not exist " + fileOutPath + "\n") ;
}
if (!fileHandle.isOpen()) {
msgNum++ ;
debugPrint("msgNum " + msgNum + " did open file " + fileOutPath + "\n") ;
fileHandle.writeln(sOutText) ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " wrote >" + sOutText + "< to " + fileOutPath + "\n") ;
debugPrint("\n") ;
fileHandle.close() ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " could not open file " + fileOutPath + "\n") ;
debugPrint("\n") ;
}
fileHandle.open("r+") ;
if (!fileHandle.isOpen()) {
var sInText = fileHandle.readln() ;
fileHandle.close() ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " read >" + sInText + "< from " + fileOutPath + "\n") ;
} else {
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " could not open file " + fileOutPath + "\n") ;
debugPrint("\n") ;
}
var fileInPath2 = "other_preexisting_file.txt" ;
var fileHandle2 = new File(fileInPath2) ;
fileHandle2.open("rt") ;
var sInText2 = fileHandle2.readln() ;
fileHandle2.close() ;
debugPrint("\n") ;
msgNum++ ;
debugPrint("msgNum " + msgNum + " read >" + sInText2 + "< from " + fileInPath2 + "\n") ;
}
}
</code>
Output from the above script is:
msgNum 9 read >This file was created with Notepad.< from other_preexisting_file.txt
msgNum 8 read >null< from debug_file_io.txt
msgNum 7 wrote >some data to write to a disk file.< to debug_file_io.txt
msgNum 6 did open file debug_file_io.txt
msgNum 5 opening file debug_file_io.txt
msgNum 3 nBarState is 2
msgNum 2 userName is pcolyer
msgNum 1 formulaOutputRoot C:\Users\Peter Colyer\Documents\Interactive Data\FormulaOutput\
msgNum 0 eSignal version is 2455
Comment