lightbulb789 Posted April 23, 2005 Share Posted April 23, 2005 HI, I'm making a Power Point Presentation for an Awards Ceremony. On one of the Awards we have a set of Quotes which need to be picked by random, Does anyone know of any Software that we can enter the Quotes and Import it into Powerpoint so when we run the Slide it will Run through all the Quotes and pick one at Random. Thanks in Advance, Adam. Link to comment Share on other sites More sharing options...
Modge Posted April 23, 2005 Share Posted April 23, 2005 If you want it to change just when clicked on then the following code as knocked up cos my project management essay is severly boring me would do it: 'declarations Dim fs Dim quotes(100) As String Dim I As Integer Dim picked As Integer Dim textstream Set fs = CreateObject("Scripting.FileSystemObject") 'open the file Set textstream = fs.OpenTextFile("c:\quote.txt", 1) 'startreading in the quotes I = 0 While Not textstream.AtEndOfStream And I < 100 quotes(I) = textstream.ReadLine I = I + 1 Wend 'pick a quote Randomize picked = Rnd * (I - 1) 'display it Label1.Caption = quotes(picked) 'clean up textstream.Close If Not fs Is Nothing Then Set fs = Nothing it won't win worlds most elegant code but it'll work (I tested it very briefly) note there's even comments! For this to work you need a label on the slide called label1. I don't know how patronising this is (if you do VB very - espessally coming from me but if not then may be not) you need to goto view->toolbars->control toolbox and tick it. on the toolbar you will then get the icon of a big capital "A" is a label. place that where you want the quote. double click on the control to get the code editor up. put the above code in. change the file name in the code (c:\quote.txt) to the name of a file contianing quotes one per line and your done. hit save in the code editor go back to power point run the show and click on the box. if you want the quote to pick it self when the slide is changed then file someone who knows VB and has more time on there hands than I do. There must be other geek types on the board who can do it. and can probably slate the code above. Edit:Forgot to mention change the quotes(100) and the I< 100 to however many quotes are in your file. if it's less than 100 then you may as well leave it in these memory rich days but if it's more it willonly pick from the first 100 unless you change it. Link to comment Share on other sites More sharing options...
Phill Power Posted April 23, 2005 Share Posted April 23, 2005 ^^^ nice code. ...or a simpler way (ie CHEAT) would be to make up all the quote slides and when the time comes get whoever's on cans to pick a number between 1 & 20 (or whatever), then go to that slide. They'll never know the difference! :o You could call it the Crew-Actuated Random Number Actuation GEnerator, or CARNAGE for short :blink: Link to comment Share on other sites More sharing options...
lightbulb789 Posted April 24, 2005 Author Share Posted April 24, 2005 Thanks for the code Modge, But.... What I was looking for was something where when you view the slide it will randomly go through all the quotes and then select one all on the slide. So say we have the quotes - Blueroom is the best - AdamI prefere blueroom anytime - Modge and so on, It will show all the quotes on the slide randomly flashing through untill it picks one. I hope you understand what I mean, I've lost my self Thanks Adam. Link to comment Share on other sites More sharing options...
Freddie Posted April 24, 2005 Share Posted April 24, 2005 like the rollout on an electronic dice? Link to comment Share on other sites More sharing options...
lightbulb789 Posted April 24, 2005 Author Share Posted April 24, 2005 like the rollout on an electronic dice?<{POST_SNAPBACK}> Yeh exactly like an Electronic Dice, Thanks zaphod. Adam Link to comment Share on other sites More sharing options...
Phill Power Posted April 24, 2005 Share Posted April 24, 2005 What version of PowerPoint are you using? I can think of how to animate the effect, but not to do it really randomly, just pretend - you will need some VB code for that. Link to comment Share on other sites More sharing options...
blackbird Posted April 24, 2005 Share Posted April 24, 2005 The solution is to combine both solutions: What you would ideally do is to greate a quick animated gif with all the quotes cycling through, which whilst not a particulary portable solution is sufficient if you have a finite number of quotes which you are using once for this presentation. Secondly, you follow Modge's code example, and create a label to put the quote in. Having not used VBA in powerpoint (and unfortunately being too lazy to load it up now and check), I would assume that there is more than an onClick method for a label, an onLoad or something similar would be ideal. Thirdly, you use one of powerpoint's annoying animation effects and have the auto-picked quote replace the cycling gif either after a certain time, or as standard with effects, have it change on click. (You may need a third object to blank out the gif, a solid box woud do if you can't get the label object to overlay properly). Hope that helps and I haven't been talking crap. Link to comment Share on other sites More sharing options...
henny Posted April 24, 2005 Share Posted April 24, 2005 can you enbed flash in powepoint , if so create a little flass file that does what you want using a little action script. Link to comment Share on other sites More sharing options...
peternewman Posted April 24, 2005 Share Posted April 24, 2005 I think you could also do it easily using just the label and a timer or something to keep on randomly picking quotes until you click again to move onto the fixed quote. PN Link to comment Share on other sites More sharing options...
Modge Posted April 24, 2005 Share Posted April 24, 2005 haven't got time to code this now (the project management nastiness I was putting off is due in tomorrow!)but a way you could do it would be to have in the slides on load event (which is a to access - unlike VBA in the rest of office this is actaully quite hard - see http://msdn.microsoft.com/library/default...._HV03082461.asp for help - there's a link on there for how to access application events in power point in general as well) some code which displays a random snippet for a certain amount of time repeatedly until another time out is reached. You'd need a timer (I assume you can get them in power points VBA - never tried but VBA force access definitely does) every e.g. 1 second (customizable) it'll call it's on click handler where you can put code that displays a random quote. You could have a quotes displayed count and when it hits as long as you want it to just disable the timer and the quote will stop changing. Learning VBA isn't that hard if you allready have any programing experience and the help at microsoft.com is very good, hard as I find it to use the words very good about microsoft. Link to comment Share on other sites More sharing options...
Phill Power Posted April 24, 2005 Share Posted April 24, 2005 I was assuming the OP wanted all the quotes on the slide, but highlighted in order over and over until coming to rest with the one final "random" quote highlighted. Link to comment Share on other sites More sharing options...
lightbulb789 Posted April 24, 2005 Author Share Posted April 24, 2005 Thanks for all the help, I'm getting a little confused but I'm going to read through it all again in a bit. Basically all I want is a slide Looking like this - Stupidest Quote And the Winner is.... [Then here it will be blank until a key is pressed and it will randomly go through all the quotes like a electronic dice then Stop at a Quote.] Hope this makes more sense then my last post. I'm doing all the Designing on 'Open Office Presentation' then the final presentation will be run from Microsoft Power Point. Adam Link to comment Share on other sites More sharing options...
skdean Posted April 26, 2005 Share Posted April 26, 2005 I don;t supose there is any software where you could type in stuff live and have it show on screen? Link to comment Share on other sites More sharing options...
Modge Posted April 26, 2005 Share Posted April 26, 2005 'declarations Const count As Integer = 10 'number of quotes to display Const eachItem As Single = 0.5 'time to display each quote for inseconds Dim fs As Object Dim quotes(100) As String Dim I, n As Integer Dim picked As Integer Dim textstream As Object Dim start As Single Set fs = CreateObject("Scripting.FileSystemObject") 'open the file Set textstream = fs.OpenTextFile("c:\quote.txt", 1) 'startreading in the quotes I = 0 While Not textstream.AtEndOfStream And I < 100 quotes(I) = textstream.ReadLine I = I + 1 Wend For n = 0 To count 'pick a quote Randomize picked = Rnd * (I - 1) 'display it Label1.Caption = quotes(picked) 'wait start = Timer While Timer < start + eachItem DoEvents 'kill time - let other stuff have the processor Wend Next n 'clean up textstream.Close If Not fs Is Nothing Then Set fs = Nothing If Not textstream Is Nothing Then Set textstream = Nothing Try that code instead then. Still needs you click on the label though sadly - access Application events to get it to work when the slide changes really looks like a pig. Sorry I didn't post this earlier I've had a bad outbreak of deadlines recently this being my final year at uni. Use it the same way you used the previous code. Change the constants I've labeled as number of quotes and time to display (the first to lines) to what ever makes sense for you.Note to those who code:PowerPoint has no timer object to do this the elegant wayIf someone can be bothered making it trigger on slide change would be better but I dont have that much time free Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.