Using the code below, pressing F8 or F9 successfully deletes slide 3 of a PowerPoint presentation. As the F9 code shows, a variable can be used for the slide number to delete. However, pressing F10 where the slide number variable comes from parsing a comma-delimited list fails (an error pops up saying that the slide is not found in the Slides collection). Could anyone provide any help on what I'm doing wrong and why deleting the slides by parsing the list, as written below, does not work? Thanks for any help you may be able to provide! (Using AHK 1.1.23.01 ANSI 32 bit on Win 7 64 bit)
Code: Select all
#SingleInstance, Force
Setbatchlines, -1
List_Slides = 2,3,4
Return
F8::
ppt := ComObjCreate("PowerPoint.application")
pt := ppt.ActivePresentation.Slides(3).Delete
Return
F9::
ppt := ComObjCreate("PowerPoint.application")
Slide_To_Delete = 3
pt := ppt.ActivePresentation.Slides(Slide_To_Delete).Delete
Return
F10::
Loop, Parse, List_Slides, `,
{
;Msgbox, x_%A_LoopField%_x
ppt := ComObjCreate("PowerPoint.application")
pt := ppt.ActivePresentation.Slides(A_LoopField).Delete
}
Return