Need QuoteSwitcher or (lots of) help making one

Greetings all -

Hope I'm posting this in somewhat the right place... I've been using OD for ages, but been away for a couple years and I'm still getting my bearings again with a new computer and new OS, so forgive me if I'm in the totally wrong spot, and please point me to where I should be. (Is there still a newsgroup for nitty-gritty questions?) I'm posting here as DesktopX seems the most likely program to do what I need, but if I'm wrong or there's a better choice, let me know. :)

Anyhow, I'm looking for or trying to make a "quote switcher" widget or object. That is... a thing that displays a random quote on bootup (or could change every 12 hours or something, but I don't want them changing really often). I will use this with a wallpaper switcher so that when I boot I will get a random wallpaper and a random quote. I don't imagine this would work a whole lot differently than a wall switcher or slide show /photo switcher, but I'm not certain. I suck at script stuff, so taking those apart and looking at them hasn't helped me so far. :(

Requirements/Specifics:

Quotes - The quotations I want to use are selected by me, not from a quote of the day website or something. I'd like them to have different colors, fonts, and effects, so it's probably best if I just make them up ahead of time rather than requiring the object to try to change all that stuff. I want them to be frameless and on a transparent background so the quote can sit on any wallpaper. My best idea at the moment is to make a bunch of .gifs or .pngs of various quotes and tell the switcher thingy to just go thru that directory.

Interface - The launcher/options thingy should be either tiny or invisible. I'd like to be able to set everything up and then just have it run on bootup and/or stay in the background.

As I said, this seems very similar to a photo frame or slideshow- I just can't figure out how to translate it to work with transparency and such. All the switchers I've toyed with olny look at .jpgs and .bmps, so I don't know if this is doable.

Here's a small example picture to show what I'm talking about in case I wasn't clear.
Example

Any help would be greatly appreciated!
Thanks - RR
23,931 views 21 replies
Reply #1 Top
This is easily doable. I'd use a text object for the quote then just randomize the font type, size and colour.

Unfortunately, at the moment I'm busy with another widget but, if I get some time I'll whip something up.

Some suggestions if anyone else thinks of doing this. Obviously a timer and persist storage with two arrays. One to list used wallpaper's and the other to list available. The reset when the second array is empty?
Reply #2 Top
Thanks for the reply, and appreciate the help. :)

Glad to hear it's not too difficult. Couple things, though...

I'm not sure how well a text object would work. I know that would be the simplest thing, but it's not quite what I'm going for. I don't so much want to randomize the look of an individual quote as just switch from one pre-made quote image to another. That way I can design each quote in a style I like, and make it fancy with my graphics programs. So, for example... If I have a quote about butterflies I might make it shiny pink with a swirly font. Then if I have another one that's really long, I might want to make it in a small font. And if I have an edgy quote I might put it in a spiky font in vinyl-look red.

So, really what I need (I think) is most similar to a photo frame/slideshow/wallswitcher/etc. I just need something to say... Hi, today is Tuesday and I'm gonna display quote image A. Then the next day (or 12 hours later, or however the timer is set)... display quote image Z, and so on...

Really the only thing that I'm finding tricky is figuring out a way to make it work with transparent background images like .gifs or .pngs. Otherwise, a regular slideshow thingy works fine. It's just that all the ones I've played with only take .bmps and .jpgs. Any way to tweak one to look for .gifs or .pngs or... something transparent? :)

Thanks very much and look forward to further suggestions. :)

RR
Reply #3 Top
I'd recommend making all your quotes and backrounds into images (text + background = 1 image) and then just do a slideshow of them. It seems like alot of photoshopping to do but if you want specific fonts, colors, font sizes that seems to be the easiest way, rather than making several (or MANY, depending on how many quotes you have) different text objects, and having to set each one.

From there you just have to load the images with a slideshow widget like this one: OMNI SLIDESHOW by Tiggz


For what it's worth: WC Wiki Tutorials


I realize you want the images to change less frequently than what a slideshow widget might offer but, I'll try to get back to you tomorrow when I've got more time.
Reply #4 Top
I figure the basic concept would be to:

-Create all your images
-Have a timer (set to 12 hrs, a day, whatever)
-load all the images into an array
-On start up, set a new image and increment a variable that keeps track of how many images have been displayed.

Sorry, I don't have a script example for you, but I'm unable to do testing at this time.




BUMP...if anyone else wanna take a whack at this.
Reply #5 Top
Thanks for the reply sViz

Yeah that's something I had considered. Just seems silly to make 18 zillion wallpapers when I could use a handful and switch the only quotes around, so I was hoping to find an alternative. It's not that it's hard, just a waste of space to store a bunch of full sized images vs. a tile and a few small ones. But I have plenty of room on my HD, so I guess I'll use that method for now, and see if anyone here comes up with a different solution.

Thanks very much :) And the link to the wiki should be useful.

RR
Reply #6 Top
i thought there was one of these out there that read in an ini file and randomly showed the quote.
Reply #7 Top
Hmm, I haven't seen anything thus far, but if you come across it please let me know, and I will keep looking as well. Any idea if it was at WinCustomize or somewhere else?

Thanks for the tip!

RR
Reply #8 Top
Im not sure.. i really thought there was one. It wouldnt be too hard.
Let me look at it later tonight (headed out to a plant).
Reply #9 Top
Cool, thanks very much. I'll try searching around some more. I'm working on a different project right now, so it's no big rush. Something for the next theme after I finish this one. I basically see how to do it, but I get kinda bogged down in the middle of the code, since I'm still trying to teach myself. :)

RR
Reply #10 Top
basic steps.

1 write INI/TXT file (or find an RSS Feed) with quotes you want to use
2 read these into the system into an array
3 pick a random one for whatever interval (timer) you want to use
4 set the items .TEXT to the string

thats about it
Reply #11 Top
Hmm, okay, sounds reasonable...

*goes back to her trusty vbscript book*

Hehe, I'm still very much a beginner, but this is how I learn new stuff - by fooling around with it until I get it right. :)

Thanks for all the help- I will get there eventually I'm sure.

RR
Reply #12 Top
As a simple start:

Read a txt file and put into an array:

Code: vbscript
  1. Dim Quote(1000)
  2. Sub Object_OnScriptEnter
  3. object.Text = ""
  4. baseDir = "D:\"
  5. fn = baseDir & "Quotes.txt"
  6. TextList = System.SimpleRead(fn, 1)
  7. Lines = Split(TextList, Chr(10))
  8. IniCnt = 0
  9. For A = UBound(Lines) To LBound(Lines) Step -1
  10. IniCnt = IniCnt + 1
  11. Quote(IniCnt) = Lines(A)
  12. l = len(Quote(IniCnt))
  13. Quote(IniCnt) = left(Quote(IniCnt),l-1)
  14. object.Text = object.Text & "Quote (" & IniCnt & ") " & Quote(IniCnt) & Vbnewline
  15. Next
  16. End Sub


Add this to a TEXT Object and see how it reads in the file.

The File is simple:
Quote1
Quote2
Quote3
Quote4

1 Quote/Line.

I will Add some code in a little on how to show a random item from this array.
Reply #13 Top
Look over this new code:

Code: vbscript
  1. Dim Quote(1000), IniCnt
  2. Sub Object_OnScriptEnter
  3. object.Text = ""
  4. baseDir = "D:\"
  5. fn = baseDir & "Quotes.txt"
  6. TextList = System.SimpleRead(fn, 1)
  7. Lines = Split(TextList, Chr(10))
  8. IniCnt = 0
  9. For A = UBound(Lines) To LBound(Lines) Step -1
  10. IniCnt = IniCnt + 1
  11. Quote(IniCnt) = Lines(A)
  12. l = len(Quote(IniCnt))
  13. Quote(IniCnt) = left(Quote(IniCnt),l-1)
  14. ' object.Text = object.Text & "Quote (" & IniCnt & ") " & Quote(IniCnt) & Vbnewline
  15. Next
  16. Object.SetTimer 1000, 3000
  17. Call Object_OnTimer1000
  18. End Sub
  19. Sub Object_OnTimer1000
  20. randomize()
  21. randomNumber=Int(IniCnt * rnd())
  22. If randomNumber <1 Then randomNumber = 1
  23. If randomNumber > IniCnt Then randomNumber = Initcnt
  24. Object.text = time & " " & Quote(randomNumber)
  25. End Sub


The RandomNumber is set to make sure that the # it returns is in the range of the array.

This should work as a base for your project.
+1 Loading…
Reply #14 Top
Thank you very much for taking the time to do those examples. :)

Unfortunately, I'm looking to use graphical quotes so I can make them pretty, rather than a text object, so it really would be more like a wallswitcher or slideshow, I think. (Yeah, I have to make everything complicated - Hah). I have been looking through your wallpaper switcher tutorial and that seems to cover more what I need, codewise. Still trying to figure out how to put in the option to change on bootup rather than on a timer. It seems I need to use BootTrigger for that but I haven't figured out the right syntax yet.

It's helpful to see your examples - never know when I may need that information and it does help me see basic structure. It does help me see how to set up arrays better and so forth, also. I may go ahead and try the text version just to see if I can get it to work.

The biggest problem I'm having so far with teaching myself code is getting lost when it gets too long - I lose track of what is what of part Sub and such! I can read along up to a point and go "Okay, yes, I see whats happening there.. mhmm, yep there's the sub for that thing... uhhh..." and then *blank look*

(Have I mentioned I've only been working on learning scripting for like a week-and-a-half now? So, at this point don't worry about trying to explain all this stuff. I only asked because I figured maybe someone had a snippet of code lying around for a wallswitcher or something that could be modified). *shrug*

LoL - Sorry to keep going back and forth with ya - I appreciate the help! :)

RR



Reply #15 Top
well heck thats easier..

make 1 object with multiple states
call each state 1,2,3,4,5,6,7, etc..
add each image you want into that state.
then the code could be cut down to just about nothing..

Code: vbscript
  1. Dim QuoteCnt
  2. Sub Object_OnScriptEnter
  3. QuoteCnt = 6 ' NUMBER OF STATES YOU ADDED (if you have 7 states, put 7)
  4. Object.SetTimer 1000, 3000 '-3000 is 3 seconds, make it whatever u want
  5. Call Object_OnTimer1000
  6. End Sub
  7. Sub Object_OnTimer1000
  8. randomize()
  9. QuoteToShow = Int(QuoteCnt * rnd())
  10. If QuoteToShow > QuoteCnt Then QuoteToShow = QuoteCnt
  11. if QuoteToShow < 1 then QuoteToShow = 1
  12. Object.state = QuoteToShow '--- this changes the state to the #
  13. End Sub


This should work, you can then add as many "States" as you want just name each one the next # in sequence. I guess i missed this in the above post, i SKIM more than i READ.

You might have to change the states to something like "STATE1" "STATE2" "STATE3"
then the line in the timer would be:
object.state = "STATE" & QuoteToShow

Good luck.
+1 Loading…
Reply #16 Top
If you only want it to change on start up, it should really only call the Sub once from OnScriptEnter. There shouldn't be a need for a timer, I think.

Reply #17 Top
You'll need the timer because unfortunately randomize isn't that random! ;)

To do it without a timer you could save the last image to persist storage and exclude it in the randomize function on startup.
Reply #18 Top
Hehe... now I've got ya'll going! *grin*

That looks like what I need, Roman... I was thinking it probably had to do with states, but wasn't sure if that would be the most efficient way to do it when you get into a large number of items. I know most wallswitchers and slideshows let you just point to a folder and say "Use the stuff in here."

That's what I was thinking, sViz. I really just need it to run at boot, display a new quote/image/whatever and then shut down. (Personal preference, though I'll probably eventually add options to do it with a normal timer and such if I actually distribute this silly thing).

Smiley, are you saying I need the timer even if I have it set to run at boot? I actually did think about writing a reg key or a log file or something so it would know which item it had displayed last and wouldn't do that again (basically force it to go through my quotes folder in sequence), but I think that's overly complicated for me at the moment. As long as it switches on bootup, I don't think the world will end if I occasionally get the same thing twice. :)

Though, typical of me, the project has mutated from a simple thing to something much more complex. I will post my little concept thingy in a bit.

RR

Reply #19 Top
I don't think you need the timer but, every time you shut down and startup the widget, it may pull the same first value. At least that has been my experience but, I was using a timer on a text object that randomized each character.

My work-a-round was a timer that randomized the other timer...if that makes sense. I'm sure there are some better random functions out there and maybe I have one or two in my codebase. Looking forward to your creations. ;)
Reply #21 Top
Gah, sorry, was seeing if I had the link in there properly and then found I couldn't edit the reply... weird forums. *shrug*

Anyhow... the real link *crosses fingers* Superswitcher Idea

As you can see my silly little idea has mutated into an all purpose wallpaper switcher/slideshow. Yes, my ambitions tend to exceed my abilities - hehe. Like I said, that's how I learn stuff. :)

I can figure out fairly good chunks of the code by looking at others' wallswitchers and slideshows and/or modifying existing stuff, but I just have a few things where I'm not finding the right examples or not getting everything to cooperate together.

Thanks for the encouragement everyone. I'm in the middle of 18 different projects - always - so don't worry too much about this... I'll let ya know when I get to specific questions.

It's not like this is some great original concept on my part, so feel free to play with it.

I just hadn't found any slideshow objects that were set up to use .pngs, .gifs, etc., so I could put my quotes on a transparent background - otherwise none of this would have come up. And then I decided it was silly to have to have a seperate wallswitcher and a slideshow dealy... and then...yeah. :P

Anyhow, thanks everyone

RR