Jump to content

Sleep() with parameters dont work


rack001
 Share

Recommended Posts

Hi,

I am using a sleep() condition with parameters like -

Sleep($s*1000)

And

Sleep(GUICtrlRead($is)) 

Where $is is an inputbox

I also tried to do the guictrlread and store its value into a variable! 

I also tried for loops using the input from the input box

None of them works 

I need a way to make this work, i need to take input (no. Of seconds)from input box and execute sleep! 

Note - the normal sleep function works!

Link to comment
Share on other sites

Please post a working script that demonstrates your issue. We need to see exactly how you're doing this.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

44 minutes ago, BrewManNH said:

Please post a working script that demonstrates your issue. We need to see exactly how you're doing this.

#RequireAdmin


#include <FileConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("OpenAll", 451, 126, 192, 124)
$pth = GUICtrlCreateInput("path of the exe", 16, 16, 417, 21)
$tim = GUICtrlCreateInput("Time in seconds", 280, 96, 96, 21)
$links = GUICtrlCreateInput("no of links", 32, 96, 121, 21)
GUICtrlSetTip(-1, "Enter the tor path !!")
$Start = GUICtrlCreateButton("Start", 176, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $lnk = GUICtrlRead($links)
Global $j = 1
Global $tii = GUICtrlRead($tim)
Func dol()
   ;Send("^t")
   FileOpen($file,0)
   Send("^t")
   For $i=1 To $lnk+1
      $line = FileReadLine($file,$j)
  
     Sleep(1500)


      Send($line&"{ENTER}")
      Sleep(1000)
      Send("^t")
      $j=$j+1
   Next

   For $z=0 To $lnk+1
      ;Send("^w")
     ; If tii>0

      Sleep($tii*1000)

   Send("^w")

   Next
   
   FileClose($file)
EndFunc

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

Put this line in before your sleep

ConsoleWrite($tii & @CRLF)

It looks like the GUICtrlRead is too high in your script, returning "Time in Seconds" rather than what you think.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers

Of course it doesn't work as you are not waiting with reading the Input value, so will still be "" when you do.  
You actually never run dol() so this can't be the script you are testing with.

Jos

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

9 minutes ago, Jos said:

Of course it doesn't work as you are not waiting with reading the Input value, so will still be "" when you do.  
You actually never run dol() so this can't be the script you are testing with.

Jos

 

The dol() is called in the further code ! I thought it would not be necessary for useless code be in the post ! And thanks for helping i got it!

32 minutes ago, JLogan3o13 said:

Put this line in before your sleep

ConsoleWrite($tii & @CRLF)

It looks like the GUICtrlRead is too high in your script, returning "Time in Seconds" rather than what you think.

Thanks For the help !

i just reinitialized the variable  in the event when the "start" button is clicked !

 

Link to comment
Share on other sites

  • Developers
Just now, rack001 said:

I thought it would not be necessary for useless code be in the post !

Well, the posted code doesn't do anything so you can't really expect a proper answer other then the observation I made. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...