Jump to content

Recommended Posts

Here's a simple workflow that lets you use Alfred Remote (https://itunes.apple.com/app/alfred-remote/id927944141) to control your powerpoint presentations.

 

Find it on Packalhttp://www.packal.org/workflow/powerpoint-remote.

 

Note: you need Alfred 2.6 to use this workflow. If you install this workflow on a version previous to v2.6, then you'll need to reinstall it after you install 2.6 in order to have the remote page available.

 

 

The icons are a bit awkward, but here's a screenshot of the remote page.

 

 

powerpoint-remote-screenshot.png

Share this post


Link to post

Does not work for me with PowerPoint 2011 on Yosemite 10.10.2. The Alfred debug log shows this upon pressing "Next Slide" in the Alfred remote app:

[ERROR: alfred.workflow.action.applescript] {

    NSAppleScriptErrorBriefMessage = "Expected end of line but found identifier.";

    NSAppleScriptErrorMessage = "Expected end of line but found identifier.";

    NSAppleScriptErrorNumber = "-2741";

    NSAppleScriptErrorRange = "NSRange: {782, 4}";

}
 

Share this post


Link to post

Does not work for me with PowerPoint 2011 on Yosemite 10.10.2. The Alfred debug log shows this upon pressing "Next Slide" in the Alfred remote app:

[ERROR: alfred.workflow.action.applescript] {

    NSAppleScriptErrorBriefMessage = "Expected end of line but found identifier.";

    NSAppleScriptErrorMessage = "Expected end of line but found identifier.";

    NSAppleScriptErrorNumber = "-2741";

    NSAppleScriptErrorRange = "NSRange: {782, 4}";

}

 

 

Well, that is just strange.

 

I'm also running PowerPoint 2011 on Yosemite 10.10.2, so there is no cause for the problem there.

 

Do any of the other actions work?

 

Try doing this:

 

(1) Open Script Editor and copy/paste this script:

tell application "Microsoft PowerPoint"
        activate
        run slide show slide show settings of active presentation
        delay 1
	go to next slide slide show view of slide show window 1
end tell

(2) Open a PowerPoint presentation that has a few slides

(3) Switch back to Script Editor and run the script.

 

If there are no errors, then I'm at a complete loss because that's (basically) the same AppleScript.

Share this post


Link to post

I am getting the same error with the new script:

Expected end of line, etc. but found identifier

 

I guess something must be different about my and your AppleScript?

Edited by N4M3Z

Share this post


Link to post

I think it might be, which, honestly, makes no sense to me whatsoever.

 

So, the code that I quoted above focuses PowerPoint, then it puts the open presentation into slideshow mode (does this happen for you?), and then it waits one second before trying to advance the slide.

 

I'm assuming that it's messing up on the line 

go to next slide slide show view of slide show window 1

AppleScript is such a screwed up language (honestly, I hate it, but for this purpose nothing else works). And, to boot, our systems seem to be the same, so the syntax should be the same. Do you have any pending updates for Microsoft Office?

 

Maybe you could try changing that line to something like

go to next slide slide show view of slide show

If that throws an error, then try

go to next slide slide show view

And, lastly,

go to next slide

Let me know if any of those work for you or if the error message changes.

Edited by Shawn Rice

Share this post


Link to post

Hi again Shawn,

 

I got it fixed, but you are not gonna believe this ... so I will try to be as clear as possible and write this step by step:

 

A few notes beforehand:

- My system is fully updated Yosemite 10.10.2, including all updates to MS Office for Mac.

- Before now, I was never even able to save your script in the Script Editor, the error I quoted popped up before I was actually able to save the script.

 

And now what happened:

1) I started Microsoft PowerPoint for Mac

2) I started Script Editor

3) Since I am completely unfamiliar with AppleScript, I just started adding "of" anytime I got an error from the script while attempting to save it in Script Editor. I ended up with someting that actually saved to a file and looked like this:

 

tell application "Microsoft PowerPoint"

activate

run slide of show of slide of show of settings of active of presentation

delay 1

go to next of slide of slide of show of view of slide of show of window 1

end tell

 
I assume this is just a completely broken piece of code. Interestingly enough, I was also able to run this in Script Editor.

 

4) I tried to run the code at which point an application called "Microsoft PowerPoint" opened.

However! This has actually opened "Microsoft PowerPoint" from my virtualized Windows through Parallels, not the native PowerPoint 2011 for Mac. After that the script failed (unsurprisingly):

error "The variable presentation is not defined." number -2753 from "presentation"

 

5) I quit Script Editor and the PowerPoint running from my virtualized Windows through Parallels.

 
6) I started Script Editor again, pasted in your code and voilá your script and the alfred workflow now work perfectly.

 

I wish I had an explanation or a way to make this reproducible. I assume the issue of misidentifying the two PowerPoint apps was probably at the heart of the problem, since both the native and the virtualized application are called "Microsoft PowerPoint", i.e. there was no way for the script to discern between the two. Do you think it is possible to call the application "Microsoft PowerPoint" through some other identifier? Maybe through process name instead?

 

Cheers,

 

Martin 

Edited by N4M3Z

Share this post


Link to post

I had a similar problem with two versions of Radium in Applescript the other day.  You can get the id as described here: http://www.macosxautomation.com/applescript/features/appobject.html

 

Just open Script Editor, and run the following one-liner:

 

get id of application "FakeApp"

 

Script Editor will ask you "Where is FakeApp?" and open a list of installed apps.  Select the correct version of PowerPoint there and you'll get its id.

 

You can then address it 

 

tell application id "com.microsoft.PowerPoint" (or whatever the actual id is)

 

instead of

 

tell application "PowerPoint"

 

 

 

 

Applescript is weird.

Edited by dfay

Share this post


Link to post

How do you activate the triggers? I have Powerpoint open, and I am connected on my device, but I don't see the buttons for next slide and such?

 

You need to make sure that you add the remote page. Click on the "Remote" tab in Alfred Preferences. On the left bottom side, you'll see a "+" button. You'll have three options: "Examples", "Workflows", and "Blank Page". Select "Workflows" and then select "PowerPoint Remote". That should add the Remote Page with all the buttons, and it should look like this:

 

powerpoint-remote-screenshot.png

Share this post


Link to post

Hi again Shawn,

 

I got it fixed, but you are not gonna believe this ... so I will try to be as clear as possible and write this step by step:

 

A few notes beforehand:

- My system is fully updated Yosemite 10.10.2, including all updates to MS Office for Mac.

- Before now, I was never even able to save your script in the Script Editor, the error I quoted popped up before I was actually able to save the script.

 

And now what happened:

1) I started Microsoft PowerPoint for Mac

2) I started Script Editor

3) Since I am completely unfamiliar with AppleScript, I just started adding "of" anytime I got an error from the script while attempting to save it in Script Editor. I ended up with someting that actually saved to a file and looked like this:

 

tell application "Microsoft PowerPoint"

activate

run slide of show of slide of show of settings of active of presentation

delay 1

go to next of slide of slide of show of view of slide of show of window 1

end tell

 
I assume this is just a completely broken piece of code. Interestingly enough, I was also able to run this in Script Editor.

 

4) I tried to run the code at which point an application called "Microsoft PowerPoint" opened.

However! This has actually opened "Microsoft PowerPoint" from my virtualized Windows through Parallels, not the native PowerPoint 2011 for Mac. After that the script failed (unsurprisingly):

error "The variable presentation is not defined." number -2753 from "presentation"

 

5) I quit Script Editor and the PowerPoint running from my virtualized Windows through Parallels.

 
6) I started Script Editor again, pasted in your code and voilá your script and the alfred workflow now work perfectly.

 

I wish I had an explanation or a way to make this reproducible. I assume the issue of misidentifying the two PowerPoint apps was probably at the heart of the problem, since both the native and the virtualized application are called "Microsoft PowerPoint", i.e. there was no way for the script to discern between the two. Do you think it is possible to call the application "Microsoft PowerPoint" through some other identifier? Maybe through process name instead?

 

Cheers,

 

Martin 

 

This sounds epic.

 

I'm curious is dfay's solution (above) would work in this case because I'm assuming that both would still be called "com.microsoft.PowerPoint". Could you check if Parallels gives the Windows version another name?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...