mminnder
12 years agoOccasional Contributor
Text Streams and Troubles
So, I'm currently making a program that checks a json returned from a web service against a local json, and if the local doesn't exist, than it should create it using the return. When I do this I want it to return the info inside this newly created json to the previous function.
IE. return text;
Basically:
If (file doesn't exist)
{
var createObject = new ActiveXObject("Scripting.FileSystemObject");
var textDoc = createObject.CreateTextFile("./JSON/Returns/" + key + ".txt", 1);
textDoc.close();
var reopenedTextDoc = OpenTextFile("./JSON/Returns/" + key + ".txt", 1);
var text = reopenedTextDoc.ReadAll();
}
it breaks on var reopenedTextDoc = OpenTextFile("./JSON/Returns/" + key + ".txt", 1);
Error is : Object Expected
I'm assuming that the issue is that it's not done creating the text file by the time it tries to open it, is there any way to say "if this file is done being created, open it"?
IE. return text;
Basically:
If (file doesn't exist)
{
var createObject = new ActiveXObject("Scripting.FileSystemObject");
var textDoc = createObject.CreateTextFile("./JSON/Returns/" + key + ".txt", 1);
textDoc.close();
var reopenedTextDoc = OpenTextFile("./JSON/Returns/" + key + ".txt", 1);
var text = reopenedTextDoc.ReadAll();
}
it breaks on var reopenedTextDoc = OpenTextFile("./JSON/Returns/" + key + ".txt", 1);
Error is : Object Expected
I'm assuming that the issue is that it's not done creating the text file by the time it tries to open it, is there any way to say "if this file is done being created, open it"?
Ok Problem solved.
Stupid problem really.
I was running ReadyAPI 1.1.0
I then updated to 1.2.2. However the shortcut on my desktop was still pointing to 1.1.0. Hence the java libs was copied into 1.2.2 since it is the one I thought I was using. As a simple test I copied into 1.2.2 folder. Everything worked perfect :-)
Wil update shortcut now to point to the correct place.
Thanks for everyones input.