[Solved] Random Sorting of Slides

Discuss the presentation application
Post Reply
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

[Solved] Random Sorting of Slides

Post by LaurieFlood »

I am using Impress as Spanish flash cards. I am wondering how I can get Impress to randomly sort the slides. Actually, any kind of a sort is okay, even alphabetically. I did try Open Cards, but it is too slow and unresponsive with the number of slides I have (700). I just want the cards in any other order than I created them. The slide sorter seems slow and unwieldy with such a large file, if it works as it appears - drag and drop.

Also, can one put the presentation on an iPod?

Thanks in advance,
Last edited by Hagar Delest on Sat Apr 17, 2010 6:16 pm, edited 1 time in total.
Reason: Tagged as solved
Laurie Flood
OpenOffice 3.2 on Windows Vista
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Random Sorting of Slides

Post by RoryOF »

I think the immediate answer to both of your questions is that it is not readily possible. The Slide Sorter is really a Slide Rearranger, to allow the presenter to order his slides differently; as far as I know it does not apply any ordering algorithm other than his drag and drop.

It may be possible to export your presentation as a series of slides and import them to an iPod; you may have to invent how to do this!
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Random Sorting of Slides

Post by acknak »

You may want to have a look at this extension: http://extensions.services.openoffice.o ... /OpenCards

If you want to do something manually, you can set up a custom slide order, which you can "randomize". Not the same as displaying the slides in a random order, but maybe useful nonetheless.
AOO4/LO5 • Linux • Fedora 23
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: Random Sorting of Slides

Post by LaurieFlood »

Thanks for your replies, RoryOF and Acknak!

I will try to export the slides as a series and see if iPod will play them.

Acknak,

I have tried Open Cards, but it works too slowly and crashes too frequently with this many cards (slides). When you say I can set up a custom slide order, will I have to drag and drop in the slide sorter to do that? That looks way too cumbersome with such a big file. Is there any other way to set up a custom slide order?

Thanks again to both of you!

I have used the OO Writer for quite a few years now. I am really impressed with it and very grateful. Impress is also a fine product. I am just stretching it to its limits here, but it is the best way to learn a foreign language, along with comprehensible and engaging little stories. When you are not in a total immersion environment, that is! Combining the Barron's Spanish books and Spanishpod101 with the Impress flash cards really makes it stick!
Laurie Flood
OpenOffice 3.2 on Windows Vista
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Random Sorting of Slides

Post by acknak »

When you say I can set up a custom slide order, will I have to drag and drop in the slide sorter to do that That looks way too cumbersome with such a big file. Is there any other way to set up a custom slide order?
Yes, That seems to be the only way to do it.

If you're handy with a text editor, you could edit the xml source directly; the custom show amounts to a simple list of slide names:
  • <presentation:show
      presentation:name="New Custom Slide Show"
      presentation:pages="page1,page3,page5,page7,page10,page12,page15"
    />
but that doesn't seem very practical either.

You might want to ask in one of the macro areas here, if it's a simple matter, someone might be willing to help you cobble together a little macro to create a custom show with the slides in random order.
AOO4/LO5 • Linux • Fedora 23
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: Random Sorting of Slides

Post by LaurieFlood »

Thanks again, Acknak!

This idea sounds easier. I think that you are saying that the custom slide show creates its own file. I can go in that file and just organize the numbers in a more random fashion. That beats the dragging and dropping. It does make sense that I could create some kind of random number generating line of code to create the generator within the XML. It's been a long time since I learned Pascal, C, and XML for classes, but I never put them to use, since I became a teacher. I'll have to give that one some thought...

Thanks for the great idea! This is still a work in progress, but it seems a bit easier now.
Laurie Flood
OpenOffice 3.2 on Windows Vista
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Random Sorting of Slides

Post by acknak »

I think that you are saying that the custom slide show creates its own file.
Not quite.

If you wanted to try that, you'd have to dig into the document file: unpack the document's xml content, edit that, and then update the document file with the modified version. Not hard, but also not for the faint of heart.

I think the macro is probably the way to go.

Hmm... one other possibility: you can export all the slides as images and then use an image viewer to display the images in random order. As long as you don't need any animations, that would work fine and be fairly easy to set up.
AOO4/LO5 • Linux • Fedora 23
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: Random Sorting of Slides

Post by LaurieFlood »

Thanks again, Acknak!

I did find out that Lightroom will present slides randomly, but I am unable to get Impress to export the presentation as individual jpegs. When I tried to export to jpeg, it only exported the first slide, not the entire presentation in individual jpegs. How would I do that? I could not find the info in the documentation for the program.

Thanks again!
Laurie Flood
OpenOffice 3.2 on Windows Vista
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Random Sorting of Slides

Post by acknak »

Sorry, it's not obvious how to do it.

If you use File > Export, as type: "HTML Document", then OOo will create a set of files suitable for viewing in a web browser. Among the files is a set of images, one per slide, along with some html files to organize and incorporate the image files. You just keep the images and throw the rest away. An image viewer should just ignore the other files.

Just be careful to create a new folder to contain just the exported files: Impress will create 3-4 files per slide, and if that big pile of files ends up mixed in with your other documents and files, it can be a real pain to sort out.
AOO4/LO5 • Linux • Fedora 23
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Random Sorting of Slides

Post by FJCC »

I wrote this macro that modifies a pre-existing custom presentation to have the slides in random order. When you create the custom presentation, it doesn't have to have all of your slides in it, just one will do. I named the custom presentation FirstCust and coded that into the macro. If you want to use a different name, you'll have to change the line of code

Code: Select all

MyCust = CustPres.getByName("FirstCust")
to have whatever name you choose. I tested it on a 128 slide presentation and it seemed to run instantaneously. I bet the run time will be noticeable for 700 slides, but I hope it won't be too long. Every time you run the macro you will get a new order for the slides.

Code: Select all

Sub SlideShuffle
oDoc = ThisComponent
DPages = oDoc.getDrawPages
Count = DPages.Count
DIM List(Count-1) as Integer
DIM RndList(Count-1) as Integer
DIM TmpList(Count-1) as Integer
For i = 0 to Count-1
	List(i) = i
next i
For x = Count-1 to 0 Step -1
Redim TmpList(x)
RndNum = INT(Rnd*(x+1))
RndList(Count-1-x) = List(RndNum)
If x > 0 then
	
	If RndNum > 0 then
		For i = 0 to RndNum - 1
			TmpList(i) = List(i)
		next i
	end if
	If RndNum < x then
		For i = RndNum + 1 to x
			TmpList(i-1) = List(i)
		next i
	end if 
	Redim List(x-1)
	List() = TmpList()
end if
next x

CustPres = oDoc.getCustomPresentations()
MyCust = CustPres.getByName("FirstCust")
SlideCount = MyCust.Count
If SlideCount > 0 then
For x = 0 to SlideCount -1
	MyCust.removeByIndex(0)
next x
end if
For x = 0 to Count-1
	RndSlide = DPages.getByIndex(RndList(x))
	MyCust.insertByIndex(x, RndSlide)
next x


End Sub
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: Random Sorting of Slides

Post by LaurieFlood »

Thanks, FJCC!

I imagine I save the macro in Writer and then place it where Impress can find it. Where would that be?

Thanks everyone! This is going to really help my studying!
Laurie Flood
OpenOffice 3.2 on Windows Vista
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Random Sorting of Slides

Post by FJCC »

There are a couple of places you could save the macro, but in this case I think it is best to save it within the document itself, so you can run it regardless of which computer you are on.
Open the Impress presentation and press ALT+F11. This will open a window titled OpenOffice.org Basic Macros. On the left will be a tree list with categories of My Macros, OpenOffice.org Macros and one for each document you have open.
Click on the + sign next to your Impress presentation. This will highlight the document
Click on the New button on the right. A little dialog will appear titled New Module and with Module1 as the suggested name. Click OK.
This will bring up the window titled YourDocumentName.Standard - OpenOffice.org Basic into which you will save the macro.
In the window you will see text similar to

Code: Select all

REM ****** BASIC  *****
Sub Main

End Sub
Delete the Sub Main and the End Sub
Copy the entire text of the macro from my post, including the Sub SlideShuffle and the End Sub.
Paste the macro into the window you opened through the above instructions.
Select File -> Save from the window.
Close the window and you should be back to the original presentation
To run the macro, press ALT+F11 and click on the + next to the file name. You will see a folder called Standard. Click on the + next to that and then select Module 1. On the right you will see SlideShuffle. If it is not highlighted, click on it, then select Run.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: [Solved] Random Sorting of Slides

Post by LaurieFlood »

Thanks FJCC!

Muchas gracias. Es muy amable!

Thanks ever so much! The macro works great! It works very quickly, even with such a big file! The Open Cards was so choked by the large file, that I could only study about 50 cards in a half an hour. With such a big list - that will likely be 1500 cards before I am through - it was much too slow. This works as quickly and responsively as if I had a 30 card presentation.

The only thing I would add to your directions for others who might need it, would be to remind them to set up a custom slideshow with one card and remember to click the box to use the custom presentation.

Thanks to FJCC and everyone that responded. I love OO and the OO community of users! You are all wonderful!
Laurie Flood
OpenOffice 3.2 on Windows Vista
bunny-ears
Posts: 1
Joined: Tue May 18, 2010 10:50 am

Re: [Solved] Random Sorting of Slides

Post by bunny-ears »

I realize this is a solved problem, but there's some oooBasic code, similar to that which appears above. The main difference is, instead of requiring a pre-existing custom slideshow, it creates and saves a new one. http://www.oooforum.org/forum/viewtopic.phtml?t=92222
OpenOffice 3.2 on Ubuntu 10.04
LaurieFlood
Posts: 9
Joined: Fri Apr 16, 2010 9:03 am

Re: [Solved] Random Sorting of Slides

Post by LaurieFlood »

Thanks, Bunny-ears. I'll try that one, too. The one with the custom slide show is working great!
Laurie Flood
OpenOffice 3.2 on Windows Vista
JJ Henry
Posts: 1
Joined: Mon Jan 14, 2019 7:11 pm

Re: [Solved] Random Sorting of Slides

Post by JJ Henry »

Gorgeous!

It's worked very well.

Now one more question... could you suggest me a way to show the first slide with a button on it, which can shuffle the next slides, assigning it the (modified, somehow) macro you wrote?
Thanx everybody out there
JJ Henry
OpenOffice 2.4 on Ubuntu 18.04
Post Reply