Skip to content

Instantly share code, notes, and snippets.

@Faibbus
Last active June 3, 2026 14:14
Show Gist options
  • Select an option

  • Save Faibbus/e7077abc22bf129b513145871a5608bc to your computer and use it in GitHub Desktop.

Select an option

Save Faibbus/e7077abc22bf129b513145871a5608bc to your computer and use it in GitHub Desktop.
Read-only context.sync in a loop (setInterval)
name: Read-only context.sync in a loop
description: ''
host: POWERPOINT
api_set: {}
script:
content: >
Office.onReady(() =>
document.getElementById("run").addEventListener("click", async () => {
console.log("launch one loop");
setInterval(async () => await PowerPoint.run(async (context) => {
const selectedSlides = context.presentation.getSelectedSlides();
const count = selectedSlides.getCount();
await context.sync();
console.log(count.value);
}), 500);
})
);
language: typescript
template:
content: <button id="run">Run</button>
language: html
style:
content: ''
language: css
libraries: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment