Sign in to follow this  
Followers 0
ajit

Medical Transcriptionist needs help

11 posts in this topic

Hi

I 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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I think using a command line in a Run statement is what you want

List of Word startup switches

The 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 table

Type 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/210565

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I think using a command line in a Run statement is what you want

The entire page is here...

http://support.microsoft.com/kb/210565

8)

Hi Valuater

Thanks 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 again

Ajit

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0