Sign in to follow this  
Followers 0
fmen

Sleep Problem

6 posts in this topic

#1 ·  Posted (edited)

#include <GUIConstants.au3>
;Opt("GuiOnEventMode", 1)
Opt("WinTitleMatchMode", 4)
Global $slider1, $pig, $dif, $td, $t, $n, $last, $begin


$pig = GUICreate("0", 220,100, 100,200); Slider to start at 0
GUISetBkColor (123)
GuiSetState();Display gui

$slider1 = GuiCtrlCreateSlider (10,10,200,20)

GUICtrlSetLimit($slider1,360,0)
$button = GUICtrlCreateButton ("Start Timer",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,0); Slider to start at 0.

;_________________________________________________________

;_________________________________________________________


While 1
Sleep(10)
    $t = GuiCtrlRead($slider1)
    If $last = $t Then
    Else
        WinSetTitle ( "handle=" & $pig , "", $t & "  Minutes To Go" )
        $last = $t
      $td = $t * 60 * 1000
    EndIf

  $n = GUIGetMsg ()
     
   If $n = $button Then
;_________________________________________________________
  [b]Sleep($td) 
   Sleep(1500)
   MsgBox(0,"slider1",$td,5)
   Exitloop[/b]
;_________________________________________________________

   EndIf
Wend

Why oh why won't either of the sleep functions work? MsgBox comes up without delay no matter how many seconds or minutes I use.

My forhead is bloody from hitting the keyboard....Help!!!

Thanks in advance

Edited by fmen

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
;Opt("GuiOnEventMode", 1)
Opt("WinTitleMatchMode", 4)
Global $slider1, $pig, $dif, $td, $t, $n, $last, $begin
$pig = GUICreate("0", 220,100, 100,200); Slider to start at 0
GUISetBkColor (123)
GuiSetState();Display gui

$slider1 = GuiCtrlCreateSlider (10,10,200,20)

GUICtrlSetLimit($slider1,360,0)
$button = GUICtrlCreateButton ("Start Timer",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,0); Slider to start at 0.

;_________________________________________________________

;_________________________________________________________
While 1
Sleep(10)
    $t = GuiCtrlRead($slider1)
    If $last = $t Then
    Else
        WinSetTitle ( "handle=" & $pig , "", $t & "  Minutes To Go" )
        $last = $t
      $td = $t * 60 * 1000
    EndIf

  $n = GUIGetMsg ()
     
   If $n = $button Then
;_________________________________________________________
  [b]Sleep(%td) 
   Sleep(1500)
   MsgBox(0,"slider1",$td,5)
   Exitloop[/b]
;_________________________________________________________

   EndIf
Wend

Why oh why won't either of the sleep functions work? MsgBox comes up without delay no matter how many seconds or minutes I use.

My forhead is bloody from hitting the keyboard....Help!!!

Thanks in advance

Maybe some Ambien and a good sleep would help with typos... :P

Sleep(%td) should be Sleep($td)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Maybe some Ambien and a good sleep would help with typos... :P

Sleep(%td) should be Sleep($td)

He he....

yup, unfortunately the typo was only in posting to the forum.

My script has both Sleep($td) and Sleep (1500), neither of which work.

Help.

Share this post


Link to post
Share on other sites

He he....

yup, unfortunately the typo was only in posting to the forum.

My script has both Sleep($td) and Sleep (1500), neither of which work.

Help.

Well, what sets the value of $td? Your script shows:

If $last = $t Then
Else
     WinSetTitle ( "handle=" & $pig , "", $t & "  Minutes To Go" )
     $last = $t
     $td = $t * 60 * 1000
EndIf

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Well, what sets the value of $td? Your script shows:

If $last = $t Then
Else
     WinSetTitle ( "handle=" & $pig , "", $t & "  Minutes To Go" )
     $last = $t
     $td = $t * 60 * 1000
EndIfoÝ÷ Ø:²Ø^2È£!£ayìiyË^vö¥¹êÓ~­uhZ¶ö¥¹ë­ì¨ºÇx"Ø^ë,j­{péâµÚ²)º®¶­sdbb33c¶âÒb33c¶'WGFöâFVà¦WfVâ6ÆVWWFB¢6ÆVWS¢×6t&÷ÂgV÷C·6ÆFW#gV÷C²Âb33c·FBÃR¢WFÆö÷²ö%ФVæD`

:P

Thanks for your response...

I think that the $td is a red herring here.

It needs to be in the form of

If $last = $td Then

in order for the slider to show the changing numbers as it is slid over.

Any way,

MsgBox(0,"slider1",$td,5)

DOES show the correct value, ie

$td = $t * 60 * 1000

Here's what's bugging me:

even if you substitute

Sleep(%td)
with
sleep(150000)

the script will not delay even one microsecond.

Thanks.

Share this post


Link to post
Share on other sites

OMG, this is crazzzzy!!

All I did was to delete these two lines from the script and......

;_________________________________________________________

;_________________________________________________________

...NOW IT WORKS!

WTF?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0