P
peterthebag
Hi,
i'm trying to use some of the example code in the MS guide VBA to
applescript and I seem to be getting a lot of errors.
I am trying to get a script that allows me to format text. Based on
the guide I have been trying the code below, but keep getting errors.
Could anyone guide me as to what is wrong?
Also, the code contains VBA - which seems to defeat the point - is
there a way to do it solely in AS?
many thanks,
Peter
tell application "Microsoft PowerPoint"
--get the selected shape via the handler
set selectedShape to my GetSelectedShape() -- paste it in!
tell text range of text frame of selectedShape
tell its font
set {font name, font size, font color, bold} to ¬
{"Arial", 24, {255, 0, 0}, true}
end tell
end tell
end tell
to GetSelectedShape()
set textFilePath to (path to temporary items as string) & "Shared
Text File"
tell application "Microsoft PowerPoint"
activate
set theIndex to slide index of slide of view ¬
of active window
set selectedSlide to slide theIndex of active presentation
do Visual Basic "n =
ActiveWindow.Selection.ShapeRange.ZOrderPosition
'write n as string to text file, replacing any text there
FileNumber = FreeFile
Open \"" & textFilePath & "\" For Output As #FileNumber
Print #FileNumber, CStr(n)
Close #FileNumber
"
set n to (read alias textFilePath before return) as integer
set selectedShape to shape n of selectedSlide
return selectedShape
end tell
end GetSelectedShape
i'm trying to use some of the example code in the MS guide VBA to
applescript and I seem to be getting a lot of errors.
I am trying to get a script that allows me to format text. Based on
the guide I have been trying the code below, but keep getting errors.
Could anyone guide me as to what is wrong?
Also, the code contains VBA - which seems to defeat the point - is
there a way to do it solely in AS?
many thanks,
Peter
tell application "Microsoft PowerPoint"
--get the selected shape via the handler
set selectedShape to my GetSelectedShape() -- paste it in!
tell text range of text frame of selectedShape
tell its font
set {font name, font size, font color, bold} to ¬
{"Arial", 24, {255, 0, 0}, true}
end tell
end tell
end tell
to GetSelectedShape()
set textFilePath to (path to temporary items as string) & "Shared
Text File"
tell application "Microsoft PowerPoint"
activate
set theIndex to slide index of slide of view ¬
of active window
set selectedSlide to slide theIndex of active presentation
do Visual Basic "n =
ActiveWindow.Selection.ShapeRange.ZOrderPosition
'write n as string to text file, replacing any text there
FileNumber = FreeFile
Open \"" & textFilePath & "\" For Output As #FileNumber
Print #FileNumber, CStr(n)
Close #FileNumber
"
set n to (read alias textFilePath before return) as integer
set selectedShape to shape n of selectedSlide
return selectedShape
end tell
end GetSelectedShape