Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6541037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:17+00:00 2026-05-25T11:03:17+00:00

I am trying to write json string that I stringified using https://github.com/douglascrockford/JSON-js/blob/master/json2.js ( JSON.stringify)

  • 0

I am trying to write json string that I stringified using https://github.com/douglascrockford/JSON-js/blob/master/json2.js ( JSON.stringify) ,

I am trying to save the string and I am getting an error:

Microsoft JScript Runtime Error: Invalid procedure call or argument

at

var textStream = fileObj.OpenAsTextStream(ForWriting, TristateFalse); 

this is my code :

var pref = JSON.parse(textPref);
textPref = JSON.stringify(pref);
WSH.echo(textPref)

// Create the new file.
fso.CreateTextFile("d:\\Preferences_temp", true);
var fileObj = fso.GetFile("d:\\Preferences_temp");
var textStream = fileObj.OpenAsTextStream(ForWriting, TristateFalse); <- Microsoft JScript Runtime Error: Invalid procedure call or argument
textStream.Write(textPref);
textStream.Close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:03:18+00:00Added an answer on May 25, 2026 at 11:03 am

    The constants you pass to the FSO methods are not exposed via late binding with new ActiveXObject so you need to define them independently;

    var ForWriting = 2;
    var TristateFalse = 0;
    

    Edit

    var ForWriting = 2;
    var TristateTrue = -1;
    
    var textPref = '{"xxx": "AA \u05D5 BB"}';
    
    var pref = JSON.parse(textPref);
    textPref = JSON.stringify(pref)
    
    // Create the new file.
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    
    //create as unicode
    fso.CreateTextFile("c:\\null\\Preferences_temp", true, true);
    var fileObj = fso.GetFile("c:\\null\\Preferences_temp");
    
    //open for unicode
    var textStream = fileObj.OpenAsTextStream(ForWriting, TristateTrue);
    textStream.Write(textPref);
    textStream.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Boost Spirit and trying to write JSON parser using Boost Spirit
I am trying to convert a pretty complicated JSON string with json2.js from json.org
I'm trying to write a custom servlet (for AJAX/JSON) in which I would like
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
Trying to write a couple of functions that will encrypt or decrypt a file
im trying to write an app that will display a list off lines from
I'm trying to write a regex function that will identify and replace a single
I'm trying to write XSLT to transform a specific web page to JSON. The
I'm trying to write some JQuery using the AutoComplete plugin to display a list
I'm trying to parse json in as3 that has multiple arrays like this: {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.