Re: How to skip Project Gallery in Word w/ Applescript
- From: "Hans Zybura" <altfusionist@xxxxxxxxxxxx>
- Date: Fri, 8 Dec 2006 15:40:27 +0100
Thank you for trying to help, Geoff.
At first I thought "System Events" could be the right clue - though your
lines didn't really work. Word's Project Gallery is a real nightmare. I
could not come to a reliable solution, for the backward compatibility I
need. After hours of experimentation I had a working script on one test
machine with OS 10.48 , only to find that it didn't work at all on an older
one with OS 10.15, where the System Events dictionary didn't even know
"keystroke".
Maybe I give up on using applescript for the task at hand and use written
documentation to ask the user to close the Project Gallery by hand before
continuing. (It's a first-use-situation with a Word add-in, where I can not
rely on the existence of a certain template in the right folder.)
That's technical progress, I guess.
Thanks again,
Hans
<ruthlesslightning@xxxxxxxxx> schrieb im Newsbeitrag
news:1165444064.087301.23920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hans:
Don't know if this would achieve the desired result. I'm a bit of a
hack with AppleScript, but here's what I came up with:
tell application "Microsoft Word"
activate
delay 2
tell application "System Events"
keystroke tab using shift down
--keystroke arrow down
keystroke (key code 125)
keystroke tab
keystroke return
end tell
end tell
What that does is shift+tab over to the list of templates (defaults to
"Blank Documents." Then, it arrows down to "My Templates." Then, it
hits RETURN, to select the FIRST template in the list. If yours is the
second template that's going to show up under "My Templates," just add
the line:
keystroke(key code 125) between "keystroke tab" and "keystroke return."
That should do it.
HTH.
Cheers,
Geoff Lilley
Microsoft Office Master Instructor (2000/XP)
Apple Certified HelpDesk Specialist (OS X 10.4)
Hans Zybura wrote:
Hi,
I want to hand our customers using MacOS 10.1 (or later) and MacOffice (X
or
2004) a simple applescript, which is meant to do the following:
- start Word
- open a new document with our special template attached
- do some more VBA code
Basically it looks like:
tell application "Microsoft Word"
launch
do Visual Basic "
Documents.Add Template:=/"ourTemplate.dot/", NewTemplate:=False
"
end tell
In fact there will be a lot more lines of VBA code following the initial
one, but there's a catch even in these few lines: When the user has set
Word
to start with the Project Gallery, the applescript will throw an error
when
reaching the line containing "do Visual Basic...". I've done a lot of
experimentation and an extensive search on this, but found some advice
concerning a similar problem with Excel only. That did not change the
problem with Word.
Is there a way to make an applescript stop the Project Gallery from
showing
up or - next best thing - to close it immediately? Without changing the
users settings to "Do not start Word with automatically showing up the
damned Project Gallery" beforehand?
Thanks in advance
Hans
.
- References:
- How to skip Project Gallery in Word w/ Applescript
- From: Hans Zybura
- Re: How to skip Project Gallery in Word w/ Applescript
- From: ruthlesslightning
- How to skip Project Gallery in Word w/ Applescript
- Prev by Date: Re: Toolbar disappears and no way to put it back!
- Next by Date: Re: Hyperlinks in word and proxy PAC files
- Previous by thread: Re: How to skip Project Gallery in Word w/ Applescript
- Next by thread: Easily adding in-text comments in different color, font?
- Index(es):
Relevant Pages
|