I’m creating a macro
to automatically open a word 2011 personal template.
I get an error when i try to choose the template.
The the actions sequence is the following:
1)
type the shift+command+P Keystroke to create a
new document from a template: ok
2)
type the tab keystroke two times to activate the
template choice: ok
3)
type the up arrow keystroke to reach the
personal template section: ok
4)
type the tab keystroke to enter the right side
of the personal tempalte section where are my templates: ok
5)
at this point i should add the action “type
the right arrow keystroke” to reach the second personal template but the action
does not work and i get a beep error (as if I had pressed a key not enabled in
that section of Word)
You’re doing that the hard way. Try this AppleScript, and rename the template in the 3rd line.
tell application "Microsoft Word"
set userTemplatesFldr to get default file path file path type user templates path
set myTemplate to userTemplatesFldr & ":Normal.dotm"
open myTemplate
end tell
Hi Chris,
i recently upgraded to Mavericks my computer and since i have done this the script doesn’t work: have you any idea how to fix the problem? the template is not found and remains the initial blank sheet.
If you moved the template to a folder you have to account for that. Rename Normal.dotm as needed.
set templateName to "Normal.dotm"
tell application "Microsoft Word"
activate
set userTemplatesFldr to get default file path file path type user templates path
set myTemplate to userTemplatesFldr & ":" & templateName
open file myTemplate
end tell
If you're still having problems get the path of your template on disk, and compare it to the value of the myTemplate variable.
This is a super simple script, so it should just work.
/var/folders/yj/tzd1v_w16k33dx4kjwys8jpc0000gp/T/Keyboard-Maestro-Script-86B
821F3-B42B-4EDE-A3BA-CBAD3A8F4A1F:122:126: script error: Expected end of
line, etc. but found class name. (-2741)
You can sometimes get errors when executing scripts in Keyboard Maestro if you have one or more variables that are very large or contain binary characters (eg you read an image file or pdf into a variable). The reason for this is that Keyboard Maestro places your variables into environment variables before executing script (including AppleScripts), and it is possible for large or binary values in the environment to cause the system to choke.
So check your variables (Keyboard Maestro ➤ Preferences, Variables pane) and see if any are large or weird.