Batch file Problem

Miltzi

New Member
Hey all
I just wanted to know if its possible to make a batch file that when run, constantly saves everything that you type in a certain file like Work.txt
Theoretically it should probably be something like:
@echo off
CLS
:A
somehowsave work.txt
GOTO :A
I know it probably not possible but any help will be appreciated
 

My Computer

System One

  • Manufacturer/Model
    Custom Built
    CPU
    Core 2 duo 2.2GHz
    Motherboard
    Foxconn 45CMX
    Memory
    2gb
    Graphics card(s)
    nVidia 8500 gt 1gb
    Sound Card
    RaLink
    Monitor(s) Displays
    17'' Samsung lcd
    Hard Drives
    160gb Sata
    PSU
    500Kw Zixa
Short answer: No. Use an editor that supports periodic saves, like Word.

================================================

Longer answer: yes, but it's probably impractical for your purposes. The act of "saving" is specific to the editor which has the text file open for editing. Say for example that it's Notepad.exe in your case. The next version of the question thus becomes:

"How can I make Notepad save periodically?"

Since Notepad is not exactly modular or expandable, you'd have to figure out a way of leveraging the in-buit functionality to periodically save a file. For example, there's a Ctrl+S keystroke accelerator under the Notepad "File" menu. Next version of the question:

"How can I make Notepad believe that Ctrl+S is being pressed periodically?"

If you can code, one way to do that is to write a utility that would figure out the window handle (HWND) of the Notepad instance in question, and then send it WM_KEYDOWN messages whose wParam maps to "Ctrl+S". In pseudocode:

- figure out parent window HWND for Notepad instance.
LOOP:
- SendMessage( hwnd, WM_KEYDOWN, "Ctrl+S", NULL )
- break if done
- Sleep( <some interval> )
- Goto LOOP

It's definitely doable and not that tricky if you've done old-style Win32 UI programming, but it's almost certainly a misguided thing to do in the presence of better options - use Word ;)
 

My Computer

Ok, thanks a lot for your help
 

My Computer

System One

  • Manufacturer/Model
    Custom Built
    CPU
    Core 2 duo 2.2GHz
    Motherboard
    Foxconn 45CMX
    Memory
    2gb
    Graphics card(s)
    nVidia 8500 gt 1gb
    Sound Card
    RaLink
    Monitor(s) Displays
    17'' Samsung lcd
    Hard Drives
    160gb Sata
    PSU
    500Kw Zixa
Back
Top