ajit Posted December 29, 2008 Posted December 29, 2008 HiI work as a medical transcriptionist and AutoIt is my hobby.I am trying to make a script to automate opening a of word template eg. test.dot file as (Document1 - Microsoft Word) as it would open if it was double clicked but no matter what i do it always opens with its name i.e. (test.dot - Microsoft Word). I tried Shellexecute and _WordDocOpen without success.Could someone help me please?Thanking in anticipation.Ajit
someone Posted December 29, 2008 Posted December 29, 2008 To create a new document, you don't need to open up the template, just use; #include <Word.au3> $oWordApp = _WordCreate () or ShellExecute("winword.exe") While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
ajit Posted December 29, 2008 Author Posted December 29, 2008 To create a new document, you don't need to open up the template, just use; #include <Word.au3> $oWordApp = _WordCreate () or ShellExecute("winword.exe") Hi someone Thanks very much for your prompt reply. But I have already created a template file (.dot) wherein forms such as Blood Pressure, Temperature, Pulses, Respirations are already there and i only want to fill in the values and save it as a document (.doc). So i want a way to open that template exactly as it would open if it was double clicked on the desktop (Document1 - Microsoft Word) and not with the name it has been saved. Thanks again for your help Ajit
Kerros Posted December 29, 2008 Posted December 29, 2008 (edited) There is a Word UDF included with the latest version, check out _WordDocOpen in the help file. that should be what you are looking for, and it gives an example that should work for you. Edited December 29, 2008 by Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
ajit Posted December 29, 2008 Author Posted December 29, 2008 There is a Word UDF included with the latest version, check out _WordDocOpen in the help file. that should be what you are looking for, and it gives an example that should work for you.Thanks Kerros. I will check it out.Ajit
Valuater Posted December 29, 2008 Posted December 29, 2008 I think using a command line in a Run statement is what you wantList of Word startup switchesThe following Word startup (command-line) switches are listed in Word Help. *********The following Word startup (command-line) switches are for Word 2007.Collapse this tableExpand this tableType To do this/f Starts Word with a new document based on an existing file.The entire page is here...http://support.microsoft.com/kb/2105658)
ajit Posted December 29, 2008 Author Posted December 29, 2008 I think using a command line in a Run statement is what you wantThe entire page is here...http://support.microsoft.com/kb/2105658)Hi ValuaterThanks a lot for the reply. I think this should solve my problem. In fact i was having a lot of difficulty explaining my problem in the forum. Thanks againAjit
Moderators SmOke_N Posted December 29, 2008 Moderators Posted December 29, 2008 (edited) It's curious that ShellExecute wouldn't work... are you sure .dot is registered for word in your registry? Try this (worked on my pc):_Open_DOT("C:\test.dot") Func _Open_DOT($s_file, $s_wk_dir = @WorkingDir) Run(@ComSpec & ' /c "' & $s_file & '"', $s_wk_dir, @SW_HIDE) EndFunc Edit: I misread what you wrote. Edited December 29, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
someone Posted December 29, 2008 Posted December 29, 2008 (edited) Just tested this out and it works with Word 2k7 anyway. Just force the verb of ShellExecute to new ;ShellExecute(@DesktopDir & "\template.dot") ;opens as title template.dot ShellExecute(@DesktopDir & "\template.dot", "", "", "New"); opens as document1 edit again: I thought I misread this, but maybe I didn't . Is ShellExecute's default verb the action listed in bold when you right click a file, or open? When you right click a template file New is the bolded action Edited December 29, 2008 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
ajit Posted December 29, 2008 Author Posted December 29, 2008 Just tested this out and it works with Word 2k7 anyway. Just force the verb of ShellExecute to new ;ShellExecute(@DesktopDir & "\template.dot") ;opens as title template.dot ShellExecute(@DesktopDir & "\template.dot", "", "", "New"); opens as document1 edit again: I thought I misread this, but maybe I didn't . Is ShellExecute's default verb the action listed in bold when you right click a file, or open? When you right click a template file New is the bolded action Hi Someone Thanks so much. It worked perfectly and exactly the way i want. I am thrilled. The AutoIt community is really very helpful. Thanks again Ajit
ajit Posted December 29, 2008 Author Posted December 29, 2008 It's curious that ShellExecute wouldn't work... are you sure .dot is registered for word in your registry? Try this (worked on my pc):_Open_DOT("C:\test.dot") Func _Open_DOT($s_file, $s_wk_dir = @WorkingDir) Run(@ComSpec & ' /c "' & $s_file & '"', $s_wk_dir, @SW_HIDE) EndFunc Edit: I misread what you wrote. Hi Smoke_N Thanks really for the help. ShellExecute did work. Thanks again Ajit
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now