Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Edit a NotePad file?

  1. #1
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default Edit a NotePad file?

    I'm assuming I can do this with AJAX (most likely not). But how exactly can I edit a notepad file (add stuff to it)? I don't want to do this on my server, just on my pc.
    - Mike

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Without ActiveX or Java, you can't.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Thanks. So how can I use Java to do this?
    - Mike

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Or php...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Code:
    import java.io.*;
    
    class one
    {
    	public static void main()
    	{
    		try {
    		        BufferedWriter out = new BufferedWriter(new FileWriter("t.txt", true));
    		        out.write("aString");
    			out.close();
    		    } 
    		catch (IOException e) {}
    	}
    }
    The above code should write into a txt file though not tested.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Depending upon how and when you want to add stuff to a notepad file and where you want to get that stuff from, batch programming might be your best bet.

    By the way, a notepad file is only an ordinary text file.

    This batch file:

    Code:
    @echo off
    echo fadeimages=[ > test_it.js
    for %%p in (*.jpg, *.gif, *.png) do echo 'file://localhost/C:/internet/project/files/%%p', >>test_it.js
    echo 'end'] >>test_it.js
    Call it - make_js.bat - will create or overwrite a javascript (an ordinary text file) file that when linked to a given HTML page will then create an array of images (with one extra entry that can later be trimmed using javascript) from the directory using the localhost absolute path (red) of one's choosing.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Actually, about php-- if you're talking about a local file, it won't work. As Twey said, ActiveX and Java (and I believe flash, if it has special permissions and complex code) are the only ways to modify an existing text file on your harddrive. I misread the original post, sorry.
    PHP (as well as other server side languages-- CGI/ASP/etc.) can, though, on the server (or just output to the user).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    import java.io.*;
    
    class one
    {
    	public static void main(String[] args)
    	{
    		try {
    		        BufferedWriter out = new BufferedWriter(new FileWriter("t.txt", true));
    		        out.write("aString");
    			out.close();
    		    } 
    		catch (IOException e) {}
    	}
    }
    The signature for main is
    Code:
    public static void main(String[])
    If the signature isn't matched, main won't be called.

    Of course, if you're just seeking to automate the creation of a large text file, John's batch file idea will work fine.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I knew about the batch file way, but I was trying to mix it into a webpage, and that I'm aware of, bat files can't be encorperated into webpages
    - Mike

  10. #10
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I want to get input from the user too, then add to a .txt file
    - Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •