/    Sign up×
Community /Pin to ProfileBookmark

.txt editor and Mapped Drive issue

Hi again

I have been using a script to open a .txt or .html file from a location. (hit browse and choose the file) it than opend the file in a text area below, u can than proceed to edit and finally save.

This has worked fine from my USB stick, and even from my local drive, how ever (since this is at work) we have recently started using 2 drives that are mapped to external servers, and we have to store everything on these rather than our local drives, now when I try to open the files I get an error message.

error:
Error: Automation Server Can’t Create object
Code: 0

here is the shelled out code I was using:

[CODE]
<html>

<head>

<script type=”text/javascript”>
function ShowFile(sFilePath){
var oFileSystem = new ActiveXObject(“Scripting.FileSystemObject”);
frmEditHTML.tarHTMLText.value = oFileSystem.OpenTextFile(sFilePath.value).ReadAll();
}

function SaveAfterEditing(sFilePath){
var oFileSystem = new ActiveXObject(“Scripting.FileSystemObject”);
var oFile = oFileSystem.CreateTextFile(frmEditHTML.filPath.value,1);
oFile.WriteLine(sFilePath.value);
oFile.Close();
}
</script>

</head>

<body>

<form name=”frmEditHTML”>

<br>

<input class=”button2″ type=file name=”filPath” onchange=”ShowFile(this)” size=”111″>
<input class=”button” type=”reset” value=”Reset” name=”Button3″ style=”border: 0;”>
<input class=”button” type=”button” value=”Save” name=”cmdSave” onclick=”SaveAfterEditing(this.form[‘tarHTMLText’])”>

<br>

<textarea name=”tarHTMLText” cols=”123″ rows=”16″ style=”border:2px solid #000000; font-family: Comic Sans MS; font-size: 14; font-weight: bold; background-image: url(notepad.jpg); background-attachment: fixed;”>
Use ‘Browse’ to select your file (.txt | .html | .htm | etc.), manually choosing the DIR may cause it to play up.
</textarea>

</form>

</div>

</body>

</html>
[/CODE]

I think thats all of it. Any Ideas?
Thank You
Kirt

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@KirtanglauthorJun 10.2008 — Thanx, im not at work to test it at the moment, but does that just need to go into the head of the script, or does it need to be configured in a cirtain way?
Copy linkTweet thisAlerts:
@KirtanglauthorJun 10.2008 — Looking at that script it maps the network drive, I don't need to map the drive its already there.. Its just when I run the above script on one of these network drives it gets the above error... it only works on local drives...

  • - Kirt
  • Copy linkTweet thisAlerts:
    @KirtanglauthorJun 10.2008 — If this helps, its the original Untouched code I used, try it, it works fine on C drive, but when running from an mapped drive it does not (this is not used on a server, its run localy from the HDD)

    [CODE]
    <html>
    <head>

    <script type="text/javascript">
    function ShowFile(sFilePath){
    var oFileSystem = new ActiveXObject("Scripting.FileSystemObject");
    frmEditHTML.tarHTMLText.value = oFileSystem.OpenTextFile(sFilePath.value).ReadAll();
    }

    function SaveAfterEditing(sFilePath){
    var oFileSystem = new ActiveXObject("Scripting.FileSystemObject");
    var oFile = oFileSystem.CreateTextFile(frmEditHTML.filPath.value,1);
    oFile.WriteLine(sFilePath.value);
    oFile.Close();
    }
    </script>

    </head>

    <body>

    <form name="frmEditHTML">
    Select the HTML File you want to Edit
    <input type=file name="filPath" onchange="ShowFile(this)">
    <textarea name="tarHTMLText" cols=60 rows=20></textarea>
    <input type="button" value="Save" name="cmdSave" onclick="SaveAfterEditing(this.form['tarHTMLText'])">
    </form>

    </body>
    </html>
    [/CODE]
    Copy linkTweet thisAlerts:
    @KirtanglauthorJun 10.2008 — Oh and I did find this, but im having troubles with it, the function posted in the reply does not run properly, i think im doing it wrong

    http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.fox.helpwanted&tid=4bb02437-58ed-457f-bcb7-cfc0ed095a22&cat=&lang=&cr=&sloc=&p=1

    p.s. How do you edit post rather than double (or triple) posting.
    ×

    Success!

    Help @Kirtangl spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...