(I know this is a lot to read, but I wanted to make sure I was as detailed as possible with my new issue here.)
I hope you (or perhaps someone else in the know) come across this thread again, because I am now having another small problem with this batch file, and I could use some advice.
First, here is the batch file in its current version (NOTE: I placed numbers at the beginning of each line only for easy reference in this thread; they do not appear in the actual batch file):
01-"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v "C:\Users\**USER NAME**\Documents\Work.tc" /lw /b /m ts /q
02-If Exist W:\Work.docx. GOTO Open_Work
05-if exist w:\~$Work.docx del W:\~$Work.docx
08-choice /d y /t 2 > nul
09-If exist W:\~$Work.docx GOTO Wait_til_done
10-"C:\Program Files\TrueCrypt\TrueCrypt.exe" /d w /q
SCENARIO 1: If I run the batch file when I have no other Word documents already open, it gets to line 06, opens the Work.docx document, and stays there until I actually close the Work.docx document, then exits. So in this instance when Work.docx is the only Word file open, it doesn't even need to execute the loop in lines 07-09. No problem here.
SCENARIO 2: If I run the batch file when I already have another Word document open, it gets to line 06, opens the Word document, then continues executing the batch file. This is where the loop in lines 07-09 help me in that it will not exit the loop until I exit the Work.docx document. No problem here.
SCENARIO 3: Here is where I *am* running into issues. If I run the batch file when I have no other Word documents already open, it gets to line 06, opens the Work.docx document, and stays there. It is waiting for me to exit the Work.docx document before continuing to execute the batch file. However, let's say with Work.docx already open, I then open up another Word document (for argument's sake, let's call it Second.docx). I open Second.docx as I would a normal Word document (using the OPEN icon), *not* by using a batch file. Now I have Second.docx open but want to exit Work.docx. So I exit Work.docx. However, the batch file still stays on line 06. It won't leave that line (and thus exit) until I actually close Second.docx.
So, in a nutshell, if I execute the batch file without ever having another Word document open, it works fine. If I execute the batch file when I already have a Word document open, it works fine. But if I execute the batch file when no Word document is open, but then open a second Word document, it does *not* work fine.
I am having sort of the opposite problem I was yesterday. Yesterday, when I was having a problem, the batch file would exit prematurely. Today's problem is that the batch file is not exiting when desired.
I was thinking I could change line 06 to say the following instead:
"C:\Program Files\Microsoft Office\Office14\WinWord.EXE" W:\Work.docx
and then use a switch to force the batch file to continue, but after looking at a list of switches available ( http://support.microsoft.com/kb/210565
), I don't think any would help me.
If you have any ideas regarding the switches or any other suggestions, your help would be extremely appreciated.