Re: Hide ribbon in Word
Re: Hide ribbon in Word
- Subject: Re: Hide ribbon in Word
- From: Yvan KOENIG <email@hidden>
- Date: Fri, 26 Jun 2015 15:02:30 +0200
> Le 26/06/2015 à 13:27, Axel Luttgens <email@hidden> a écrit :
>
>
>> Le 26 juin 2015 à 02:47, Hans van den Broek a écrit :
>>
>> Turns out you can turn off the ribbon in the Word Preferences. No ribbon when you run Word…
>>
>> Related question:
>>
>> To toggle the ribbon, this works:
>>
>> tell application "Microsoft Word"
>> tell application "System Events"
>> key code 15 using {option down, command down}
>> end tell
>> end tell
>>
>> while using keystroke "r" doesn’t work. Can anybody explain, please?
>
> Hello Hans,
>
> This one works here:
>
> tell application "Microsoft Word" to activate
> delay 1
> tell application "System Events"
> keystroke "r" using {option down, command down}
> end tell
>
> The delay may probably be shorter, but the idea is there: the keyboard event is sent to the frontmost application, and that application must be ready to do something with it.
>
> As far as I can tell, "keystroke" and "key press" appear to be equivalent.
>
> Of course, since the same may be achieved by setting Word’s property "display ribbon", there is no real point to unreliably go thru keyboard events…
>
> HTH,
> Axel
Better use :
tell application "Microsoft Word" to activate
tell application "System Events" to tell process "Word" # check that it's the real name of the process, I don't own/use this application
set frontmost to true
keystroke "r" using {option down, command down}
end tell
end tell
Putting explicitly the process at front allow us to work without the delay whose required duration isn't known.
Yvan KOENIG (VALLAURIS, France) vendredi 26 juin 2015 15:02:20
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden