Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > Software

Vista - Batch file Problem

Reply
 
Old 4 Weeks Ago   #1 (permalink)


Vista Ultimate x64
 
 

Batch file Problem

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 System SpecsSystem Spec
Old 4 Weeks Ago   #2 (permalink)


Win7x64
 
 

Re: Batch file Problem

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 System SpecsSystem Spec
Old 2 Weeks Ago   #3 (permalink)


Vista Ultimate x64
 
 

Re: Batch file Problem

Ok, thanks a lot for your help
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Batch file problem VB Script
Batch file help General Discussion
Batch-file not working: PATH-problem? Vista General
vista batch file problem Vista General
batch file calling exe file problem Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46