Benches macOS

1

Scripting Bridge and Powerpoint, how to m…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I know how to make a new slide in an active presentation in Powerpoint. It works like this:

tell application "Microsoft PowerPoint"

set newSlideC to make new slide at before slide 2 of active presentation ¬

with properties {layout:slide layout media clip and text}

end tell

(I stole this snippet from
http://www.mactech.com/vba-transition-guide/index-094.html)

Now I would like to do the same via Scripting Bridge in my Cocoa app.

But I seem to be unable to find the appropriate classes, objects, methods, or properties in Powerpoint.h

(which I created with this command:

sdef /Applications/Microsoft Office 2008/Microsoft PowerPoint.app | sdp -fh --basename Powerpoint

)

According to Script Editor's dictionary of Powerpoint, the "make" command is in the 'Standard Suite'.

But I have no idea how to find it's defintion, let alone how to use it from my Cocoa application.

Could somebody please give a hint to me?

Since I'm not (yet) subscribed to the applescript-users mailing list, I am taking the liberty to post my question here.

Thanks a lot in advance.

Best regards,

Gabriel.

1 reply

Sign in or join Beachball Help to reply.

  1. 0

    Hiroto

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hello

    You need to alloc and init to make an object instance in Scripting Bridge.

    See the following documents.

    Scripting Bridge Programming Guide for Cocoa

    http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ScriptingB ridgeConcepts/

    Scripting Bridge Framework Reference

    http://developer.apple.com/mac/library/documentation/ScriptingAutomation/Referen ce/ScriptingBridgeFramework/

    Some sample codes

    http://developer.apple.com/mac/library/samplecode/SBSendEmail/

    http://developer.apple.com/mac/library/samplecode/SBSetFinderComment/

    http://developer.apple.com/mac/library/samplecode/ScriptingBridgeFinder/

    http://developer.apple.com/mac/library/samplecode/ScriptingBridgeiCal

    ---

    As for your example, code would be something like this.

    NOT TESTED AT ALL. AND PROBABLY IT'S WRONG IN PARTS.

    Just for showing the outline, hopefully.


    PowerPointApplication *powerpoint = [SBApplication applicationWithBundleIdentifier:@"com.microsoft.powerpoint"];
    [powerpoint activate];
    PowerPointSlide *s = [[[powerpoint classForScriptingClass:@"slide"] alloc]
    initWithProperties:
    [NSDictionary dictionaryWithObjectsAndKeys:
    @"slideLayoutMediaClipAndText", @"layout",
    nil]];
    [[powerpoint.activePresentation slides] insertObject:s atArrangedObjectIndex:0];

    Good luck,

    H

    Message was edited by: Hiroto (fixed typo)