topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 1:30 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Replace Hourglass with Quote from text file  (Read 18445 times)

skooter1121

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
IDEA: Replace Hourglass with Quote from text file
« on: April 20, 2009, 09:54 AM »
Occasionally when I load a large program or a huge data file  from a file server the omnipresent hourglass appears and spins away and away .....

IDEA:

HourGlassPane, or WaitData, or  LoadInfo or IdleWhile:

A program that displays as a tooltip or message box a line from a text file instead. A text file containing a  quote, joke, reminder, any little tidbit of information.  It shouldn't slowdown the loading but just replace the hourglass only when it is on the screen, with the ability to click on it to freeze the display.

Coeluh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 273
  • Family Guy ^^
    • View Profile
    • Jeroen Coelen
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #1 on: April 21, 2009, 08:19 AM »
Occasionally when I load a large program or a huge data file  from a file server the omnipresent hourglass appears and spins away and away .....

IDEA:

HourGlassPane, or WaitData, or  LoadInfo or IdleWhile:

A program that displays as a tooltip or message box a line from a text file instead. A text file containing a  quote, joke, reminder, any little tidbit of information.  It shouldn't slowdown the loading but just replace the hourglass only when it is on the screen, with the ability to click on it to freeze the display.
How would you click on a tooltip that is following your mouse?

skooter1121

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #2 on: April 21, 2009, 05:42 PM »
The ckickable feature : (not necessarily ON the tooltip itself), with a right mouse button, or key command could freeze the note so you could read it, if you so wished, Otherwise it would disappear as normal and load the application.

I just thought a program such as this that could be providing some kind of information while the hourglass was working could be useful. Anything would be better than the mindless WAIT icon.

Don't you think so?

Coeluh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 273
  • Family Guy ^^
    • View Profile
    • Jeroen Coelen
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #3 on: April 22, 2009, 03:37 AM »
The ckickable feature : (not necessarily ON the tooltip itself), with a right mouse button, or key command could freeze the note so you could read it, if you so wished, Otherwise it would disappear as normal and load the application.

I just thought a program such as this that could be providing some kind of information while the hourglass was working could be useful. Anything would be better than the mindless WAIT icon.

Don't you think so?
Yeah that would be cool! I think it shouldn't be that hard to do. Random quotes, funny facts, system information like cpu usage...

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,205
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #4 on: April 22, 2009, 04:35 AM »
Reminds me of an old tagline.  "Windows loading.  Come back tomorrow." 


nosh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,441
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #5 on: April 22, 2009, 05:09 AM »
Random quotes, funny facts, system information like cpu usage...

Little (expandable) thumbnails of girlie pix!!!
No? OK, I'll just shut up.

r0bertdenir0

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 50
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #6 on: April 29, 2009, 10:25 AM »
Something like this maybe...
That's the basic structure I think - you'd just have to modify the IF statements that generate the tooltip so that it reads from a joke file, shows weather info, or even show reads nosh's My Pictures folder to show those girlie pix in a splash screen...


#SingleInstance,Force
#UseHook On
SetBatchLines,-1


IDC_APPSTARTING := 32650
IDC_WAIT := 32514

ShowWaitCursorTip:
{
   loop
   {
      hCurAppStarting := DllCall("LoadCursor", "Uint", NULL, "Int", IDC_APPSTARTING, "Uint")
      hCurWait := DllCall("LoadCursor", "Uint", NULL, "Int", IDC_WAIT, "Uint")
      
      VarSetCapacity(CurrentCursorStruct, 20, 0)
      NumPut(20, CurrentCursorStruct)
      result := DllCall("GetCursorInfo", "str", CurrentCursorStruct)
      hCursor := NumGet(CurrentCursorStruct, 8)
      
      sTip :=
      If(hCursor==hCurAppStarting)
      {
         sTip := "This should just take a sec..."
      }
      If(hCursor==hCurWait)
      {
         sTip := "This may take some time.... probably lots..."
      }
      
      ToolTip, %sTip%
      
      Sleep, 20
      
   }
   
Return
}


^!X::Gosub, EXIT

EXIT:
ExitApp
« Last Edit: April 29, 2009, 10:26 AM by r0bertdenir0 »

skooter1121

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #7 on: May 09, 2009, 04:30 PM »
Thanks (TaxiDriverWithStuckCapsLockKey)

But, I was unable to get your script to work.

I tried to load OpenOffice as a test case, but your "This should just take a sec..." would not show.

I've attached a text file of Oscar Wilde quotes I have created. I'd like to use it if possible.


-S

« Last Edit: May 09, 2009, 04:54 PM by skooter1121 »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #8 on: May 10, 2009, 08:59 AM »
 :) Try HourglassQuotes!

It displays a quote when the PC is busy, either from a file or from www.quotableonline.com.

Place the quotes in a text file and edit the files= and timer= lines.

To keep the quote from dissapearing, just click inside the window. It dissappears when it loses focus.

Skrommel

;HourglassQuotes.ahk
; Displays a quote when the PC is busy
;Skrommel @ 2009

delay=9                                                             ;seconds to show the quote
file=                                                               ;file with quotes. if empty, retrieve quote from internet
internet=http://www.quotableonline.com/index.php                    ;url to page with random quote
html1:="<div class=leftnavText><blockquote id=blockquote > &nbsp; " ;text to look for before the quote
html2:="</blockquote>"                                              ;text to look for after the quote
filter:="  "                                                        ;string to remove from the quote

#NoEnv
#SingleInstance,Force

applicationname=HourglassQuotes

IniRead,counter,%applicationname%.ini,Settings,counter
If (counter="Error" Or counter<1 Or counter>999999)
  counter=1

If file=
  Gosub,DOWNLOAD
Else
  Gosub,READ

Loop
{
  Sleep,1000
  ;Stolen from Sean at http://www.autohotkey.com/forum/topic32959.html
  VarSetCapacity(ci,20,0),NumPut(20,ci)
  DllCall("GetCursorInfo","Uint",&ci)
  hCursor:=NumGet(ci,8)
  If showing<>1
  If hCursor In 65575,65557  ;65575=appstarting 65557=wait
  {
    Gui,Destroy
    Gui,+ToolWindow +AlwaysOntop
    Gui,Color,FFFFFF
    Gui,Add,Text,w200,%quote%
    Gui,Show,x0 y0 NoActivate,%applicationname%
    Gui,+LastFound
    guiid:=WinExist()
    SetTimer,QUOTEOFF,% delay*-1000
    showing=1
    If file=
      Gosub,DOWNLOAD
    Else
      Gosub,READ
    If quote=
      Continue
  }
}
ExitApp


READ:
FileReadLine,quote,%file%,%counter%
If ErrorLevel=1
{
  counter=1
  FileReadLine,quote,%file%,%counter%
}
Else
  counter+=1
IniWrite,%counter%,%applicationname%.ini,Settings,counter
Return


DOWNLOAD:
UrlDownloadToFile,% internet,quote.htm
FileRead,quote,quote.htm
StringGetPos,pos,quote,% html1
StringTrimLeft,quote,quote,% pos+StrLen(html1)
StringGetPos,pos,quote,% html2
StringLeft,quote,quote,% pos
StringReplace,quote,quote,% filter,,All
Return


QUOTEOFF:
active:=WinExist("A")
If (active=guiid)
{
  SetTimer,QUOTEOFF,-1000
  Return
}
showing=0
Gui,Destroy
Return

« Last Edit: May 11, 2009, 02:29 PM by skrommel »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #9 on: May 11, 2009, 11:01 AM »
:) Try HourglassQuotes!

It displays a quote when the PC is busy.

cool, works nicely. :up:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #10 on: May 11, 2009, 11:16 AM »
Great work skrommel, and much credit also to r0bertdenir0, who basically showed the way.  :up: :up:

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #11 on: May 11, 2009, 02:31 PM »
 :) Just updated HourglassQuote above!

If the file= is empty, it goes online to retrieve a quote.

Also, you can click inside the quote window to keep it from dissappearing.

Skrommel

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #12 on: May 11, 2009, 02:44 PM »
one thing that might be nice skrommel, is if you can support the file formats i use in my various quote programs (popup wisdom and multiphoto quotes).
you can download quote files here:
https://www.donation...pUpWisdom/books.html

there are basically 2 formats:
1) standard fortune file format, which uses % on newlines to separate quotes
2) single quote per line format (and i use first line of file for extra info)

skooter1121

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 25
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #13 on: May 14, 2009, 07:54 PM »
skrommel,

Great thought to get a quote online if txt file not found.  I wonder what other online text data is available? Word of the hour/day perhaps? CNN Headlines? (Please no joke of the day!)

I like the choice of the MessageBox rather than the ToolTip. The ToolTip limits the quotes to 256 Char and I'd need to edit all my text files. Plus I dislike that anoying POP sound, although easily disabled. 

I am running into a problem, with the default settings, as  I cannot drag the QuoteBox and have it stay, and a ghost image of the box remains on the screen. I've also seen a significant slow down of the PC when your Gone in 60 Seconds program is also running. (This is running on a fresh install XP Pro, and when 60 sec is closed the PC responds as usual.)

I tried to eliminate the Caption completely, with a single click to freeze, a double-click to close but was unsuccessful.(Not even close.)  A fade in and out were also beyond my meager 4 months AHK experience.

-Thanks for your expert assistance.
-Skooter1121

I have dozens of Quote/Trivia/Puzzle txt files I have created over the years. If you wish to add some to your script.

As another thought; my grandson is now learning the multiplication tables. A scrolling window where 5x9 =  eventually displays 45 might help him.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: Replace Hourglass with Quote from text file
« Reply #14 on: May 14, 2009, 08:24 PM »
also another request, can you move 'file=' setting to an INI file? it will be a tad easier to edit. :)