I've created a jsx script that creates a custom dialog box in illustrator that allows me to load a text file into a string.. It all seems to work OK in Extendscript but the moment I save it and run it standalone from Illustrator the dialog box appears then instantly vanishes. Any ideas, I've removed all the $writeIn
statements.
I've looked around but there seems to be nothing on this Code lookes like ths:
function init() {
dataFile=""//Load in paths to users day file and folder where spreadsheets are stored
var readFile = File(appPath+ "pathData"+".txt");
if(readFile != null) {
readFile.open('r')
dataPath=readFile.read();
readFile.close();
dataPath=dataPath.replace(/[\n\r]/g, '');//Seems to need this as without there is a cariage return added to the end of the string somewhere in the saving of the file
};
else dataPath="Press button to set path to day folder";
readFile = File(appPath+ "pathDay"+".txt");
if(readFile != null) {
readFile.open('r')
dayPath=readFile.read();
readFile.close()
dayPath=dayPath.replace(/[\n\r]/g, '');//Seems to need this as without there is a cariage return added to the end of the string somewhere in the saving of the file
//$.writeln("dayPath=",dayPath);
};
else dayPath="Press button to set path to day folder";
var initPanel=new Window("palette","iPlot", undefined);
initPanel.orientation="column"
var group1=initPanel.add("group",undefined,"GroupOne");
group1.orientation="column"
var loadButton=group1.add("button",undefined,"Load data");
loadButton.onClick = function() {
initPanel.close();
loadFile();
};
var closeButton=group1.add("button",undefined,"Close");
closeButton.onClick = function() {
//$.writeln("Close button pressed");
initPanel.close();
};
var setipButton=group1.add("button",undefined,"Setup");
setipButton.onClick = function() {
setup()
};
initPanel.center();
initPanel.show();
return true;
}