Macro for number of the current Impress slide

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
User avatar
Charlie Young
Volunteer
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: Macro for number of the current Impress slide

Post by Charlie Young »

There were a few more problems with the variables, and also, in the Open statement, it makes no sense to use Mode Output and Access Read Write, just skip the access and do

Code: Select all

Open sFileName For Output As #n
You can open it for Input later if you want to read the value.

See if the attached work better when running main.

Edit: for others who may look at maxtmacro, note that it contains a bit of code specific to Max's system

Code: Select all

Sub EV_slideTransitionStarted(oEv)
'Print "Transition Started"
'MsgBox("hello")


   Dim n As Integer
   Dim Slide As Integer
   Dim sFileName As String
   
   Slide = oController.getCurrentSlideIndex
   
    sFileName = "/home/luivin/Desktop/macro/LastSlide.txt"
    
    n = FreeFile()
    Open sFileName For Output As #n
   	Print #n,Slide
 	close #n


End Sub
Attachments
maxtmacro.odp
(12.18 KiB) Downloaded 134 times
Last edited by Charlie Young on Wed Mar 18, 2015 2:24 pm, edited 1 time in total.
Apache OpenOffice 4.1.1
Windows XP
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Macro for number of the current Impress slide

Post by RPG »

Hello

I have test the first example of Charlie Young and it is working for me when I add a wait, as told.

Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
Post Reply