Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 30, 2012, 06:44 PM   #1
akiev
macrumors newbie
 
Join Date: Oct 2012
Applescript to insert sound in Microsoft Word

I've spent hours on figuring out how to do this. There is an "API" for inserting images (like make inline picture), but I did not find anything about how to insert a sound into the Word document (2011 Office). Any help will be appreciated. Thanks
akiev is offline   0 Reply With Quote
Old Oct 30, 2012, 09:38 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Looked in the dictionary and could not find anything usable. You can always use UI scripting.

Example from Dutch version of Word 2011 :

Code:
GUIScripting_status()

activate application "Microsoft Word"
tell application "System Events"
	tell process "Microsoft Word"
		-- insert GUI Scripting statements here
		click menu item "Geluid uit bestand..." of menu 1 of menu item "Audio" of menu 1 of menu bar item "Invoegen" of menu bar 1
	end tell
end tell

on GUIScripting_status()
	-- check to see if assistive devices is enabled
	tell application "System Events"
		set UI_enabled to UI elements enabled
	end tell
	if UI_enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Cancel"} default button 1
		end tell
	end if
end GUIScripting_status
Invoegen = Insert
Audio = Audio
Geluid uit bestand... = Sound from file...(not sure about this)
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote
Old Oct 31, 2012, 10:14 AM   #3
akiev
Thread Starter
macrumors newbie
 
Join Date: Oct 2012
Yes, this is exactly what I'm doing now. But when the sound inserted using UI scripting - it appears in the top left corner, but I need to make it inline with text.
Thanks
akiev is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
MS Word: Insert date option Pagemakers iPad Apps 4 Apr 2, 2014 09:08 AM
applescript align column in word table Freez Mac Programming 2 Jan 25, 2014 11:23 AM
New app: Go Word - for Microsoft Word Edition & Open Office Format txsoft Mac Applications and Mac App Store 0 Nov 21, 2013 12:36 AM
MS Word - Insert landscape page (page break not working) foxdougan Mac Applications and Mac App Store 2 Jun 17, 2013 09:28 AM
Applescript to Export text from Indesign and import to Microsoft Excel. alissat Mac Programming 1 Mar 28, 2013 12:21 PM

Forum Jump

All times are GMT -5. The time now is 02:19 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC